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)
|
||||
|
||||
Reference in New Issue
Block a user