|
22 | 22 | CLIENT_SECRET = "client-secret-xyz" |
23 | 23 |
|
24 | 24 |
|
25 | | -# --------------------------------------------------------------------------- |
26 | | -# Helpers |
27 | | -# --------------------------------------------------------------------------- |
28 | | - |
29 | | - |
30 | 25 | class FakeResponse: |
31 | 26 | """Minimal stand-in for requests.Response used by token-request tests.""" |
32 | 27 |
|
@@ -105,11 +100,6 @@ def fake_getaddrinfo(host, *args, **kwargs): |
105 | 100 | monkeypatch.setattr(cc_module.socket, "getaddrinfo", fake_getaddrinfo) |
106 | 101 |
|
107 | 102 |
|
108 | | -# --------------------------------------------------------------------------- |
109 | | -# Construction validation |
110 | | -# --------------------------------------------------------------------------- |
111 | | - |
112 | | - |
113 | 103 | class TestConstructionValidation: |
114 | 104 | def test_unsupported_auth_method_raises(self, monkeypatch): |
115 | 105 | _bypass_dns(monkeypatch) |
@@ -184,11 +174,6 @@ def test_https_url_accepted_no_warning(self, monkeypatch, caplog): |
184 | 174 | assert not any(r.levelno == logging.WARNING for r in caplog.records) |
185 | 175 |
|
186 | 176 |
|
187 | | -# --------------------------------------------------------------------------- |
188 | | -# Request shape |
189 | | -# --------------------------------------------------------------------------- |
190 | | - |
191 | | - |
192 | 177 | class TestRequestShape: |
193 | 178 | def _provider(self, monkeypatch, **kwargs): |
194 | 179 | _bypass_dns(monkeypatch) |
@@ -398,11 +383,6 @@ def test_invalid_expires_in_defaults_to_300(self, monkeypatch, caplog, expires_i |
398 | 383 | assert any("expires_in" in r.message for r in caplog.records) |
399 | 384 |
|
400 | 385 |
|
401 | | -# --------------------------------------------------------------------------- |
402 | | -# Caching |
403 | | -# --------------------------------------------------------------------------- |
404 | | - |
405 | | - |
406 | 386 | class TestCaching: |
407 | 387 | def _provider(self, monkeypatch, **kwargs): |
408 | 388 | _bypass_dns(monkeypatch) |
@@ -475,11 +455,6 @@ def fake_post(*a, **kw): |
475 | 455 | assert calls["n"] == 2 |
476 | 456 |
|
477 | 457 |
|
478 | | -# --------------------------------------------------------------------------- |
479 | | -# Concurrency — double-checked locking |
480 | | -# --------------------------------------------------------------------------- |
481 | | - |
482 | | - |
483 | 458 | class TestConcurrency: |
484 | 459 | def test_concurrent_get_token_makes_single_http_call(self, monkeypatch): |
485 | 460 | """Two threads call get_token() with empty cache simultaneously. |
@@ -545,11 +520,6 @@ def worker(idx): |
545 | 520 | ) |
546 | 521 |
|
547 | 522 |
|
548 | | -# --------------------------------------------------------------------------- |
549 | | -# Storage |
550 | | -# --------------------------------------------------------------------------- |
551 | | - |
552 | | - |
553 | 523 | class TestStorage: |
554 | 524 | def test_token_persists_across_provider_instances(self, monkeypatch): |
555 | 525 | _bypass_dns(monkeypatch) |
@@ -647,11 +617,6 @@ def test_cache_does_not_contain_credentials(self, monkeypatch): |
647 | 617 | assert "https://api.example.com" not in as_text |
648 | 618 |
|
649 | 619 |
|
650 | | -# --------------------------------------------------------------------------- |
651 | | -# current_secrets |
652 | | -# --------------------------------------------------------------------------- |
653 | | - |
654 | | - |
655 | 620 | class TestCurrentSecrets: |
656 | 621 | def _provider(self, monkeypatch): |
657 | 622 | _bypass_dns(monkeypatch) |
@@ -687,11 +652,6 @@ def test_after_invalidate_returns_empty(self, monkeypatch): |
687 | 652 | assert provider.current_secrets() == [] |
688 | 653 |
|
689 | 654 |
|
690 | | -# --------------------------------------------------------------------------- |
691 | | -# Error sanitization |
692 | | -# --------------------------------------------------------------------------- |
693 | | - |
694 | | - |
695 | 655 | class TestErrorSanitization: |
696 | 656 | def _provider(self, monkeypatch): |
697 | 657 | _bypass_dns(monkeypatch) |
@@ -751,7 +711,7 @@ def test_401_includes_provider_error_fields(self, monkeypatch): |
751 | 711 | assert "invalid_client" in msg |
752 | 712 | assert "Client authentication failed" in msg |
753 | 713 | assert CLIENT_SECRET not in msg |
754 | | - assert CLIENT_ID in msg or "client_id" in msg # client_id is not a secret |
| 714 | + assert CLIENT_ID in msg or "client_id" in msg |
755 | 715 |
|
756 | 716 | def test_redirect_response_treated_as_error(self, monkeypatch): |
757 | 717 | provider = self._provider(monkeypatch) |
|
0 commit comments