fix devpi gateway auth
This commit is contained in:
@@ -177,16 +177,16 @@ class CmdGetTests(unittest.TestCase):
|
||||
self.assertEqual(parsed["password"], "LIVETOKEN")
|
||||
self.assertEqual(parsed["host"], "g.example:8443")
|
||||
|
||||
def test_no_store_passes_through(self) -> None:
|
||||
def test_no_store_emits_no_credentials(self) -> None:
|
||||
rc, out, _ = self._run(
|
||||
store_payload=None,
|
||||
stdin_text="protocol=https\nhost=g.example:8443\n\n",
|
||||
)
|
||||
self.assertEqual(rc, 0)
|
||||
self.assertEqual(out, "")
|
||||
self.assertNotIn("password=", out)
|
||||
self.assertIn("host=g.example:8443", out)
|
||||
|
||||
def test_non_matching_host_passes_through(self) -> None:
|
||||
def test_non_matching_host_emits_no_credentials(self) -> None:
|
||||
payload = {
|
||||
"username": "alice",
|
||||
"gitea_access_token": "LIVETOKEN",
|
||||
@@ -198,10 +198,10 @@ class CmdGetTests(unittest.TestCase):
|
||||
stdin_text="protocol=https\nhost=github.com\n\n",
|
||||
)
|
||||
self.assertEqual(rc, 0)
|
||||
self.assertEqual(out, "")
|
||||
self.assertNotIn("password=", out)
|
||||
self.assertIn("host=github.com", out)
|
||||
|
||||
def test_match_but_no_token_passes_through(self) -> None:
|
||||
def test_match_but_no_token_emits_no_credentials(self) -> None:
|
||||
payload = {
|
||||
"username": "alice",
|
||||
"gitea_access_token": "",
|
||||
@@ -212,6 +212,7 @@ class CmdGetTests(unittest.TestCase):
|
||||
stdin_text="protocol=https\nhost=g.example:8443\n\n",
|
||||
)
|
||||
self.assertEqual(rc, 0)
|
||||
self.assertEqual(out, "")
|
||||
self.assertNotIn("password=", out)
|
||||
|
||||
# --- expired token + refresh -------------------------------------
|
||||
@@ -263,6 +264,7 @@ class CmdGetTests(unittest.TestCase):
|
||||
stdin_text="protocol=https\nhost=g.example:8443\n\n",
|
||||
)
|
||||
self.assertEqual(rc, 0)
|
||||
self.assertEqual(out, "")
|
||||
self.assertNotIn("password=", out)
|
||||
self.assertIn("token refresh failed", err)
|
||||
self.assertIn("just login", err)
|
||||
|
||||
@@ -24,13 +24,15 @@ assert() {
|
||||
|
||||
assert 'setup.sh parses as valid bash' bash -n "$root/scripts/setup.sh"
|
||||
|
||||
help_out="$(bash "$root/scripts/setup.sh" --help 2>&1)"
|
||||
help_file="$(mktemp)"
|
||||
bash "$root/scripts/setup.sh" --help >"$help_file" 2>&1
|
||||
assert '--help prints the Usage header' \
|
||||
bash -c "printf '%s' \"$help_out\" | grep -q '^Usage: just setup'"
|
||||
grep -q '^Usage: just setup' "$help_file"
|
||||
assert '--help documents --headless' \
|
||||
bash -c "printf '%s' \"$help_out\" | grep -q -- '--headless'"
|
||||
grep -q -- '--headless' "$help_file"
|
||||
assert '--help documents FORGE_SETUP_YES' \
|
||||
bash -c "printf '%s' \"$help_out\" | grep -q 'FORGE_SETUP_YES'"
|
||||
grep -q 'FORGE_SETUP_YES' "$help_file"
|
||||
rm -f "$help_file"
|
||||
|
||||
set +e
|
||||
bash "$root/scripts/setup.sh" --not-a-flag >/dev/null 2>"$here/.bad.err"
|
||||
|
||||
Reference in New Issue
Block a user