fix devpi gateway auth

This commit is contained in:
Nathan Trudeau
2026-05-03 07:25:31 -04:00
parent c5bcd24e06
commit 6dca4aceb9
3 changed files with 28 additions and 19 deletions

View File

@@ -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)