|
| 1 | +# 🧪 Test Suite: Identity Pool Credentials |
| 2 | + |
| 3 | +This test suite provides full coverage for identity pool credential logic using mocks, simulated refreshes, and precise validation. |
| 4 | + |
| 5 | +--- |
| 6 | + |
| 7 | +## ✅ File: `tests/test_identity_pool.py` |
| 8 | + |
| 9 | +| Section | Description | |
| 10 | +|---------|-------------| |
| 11 | +| **I1** | Credential creation via `from_info()` | |
| 12 | +| **I2** | Credential creation via file loading | |
| 13 | +| **I3** | Subject token source variants: text, JSON, supplier | |
| 14 | +| **I4** | Constructor validation (error cases) | |
| 15 | +| **I5** | Token URL and impersonation URL overrides | |
| 16 | +| **I6** | Simulated credential refresh (mocked response) | |
| 17 | + |
| 18 | +--- |
| 19 | + |
| 20 | +## 🧩 Fixture: `make_credentials()` |
| 21 | + |
| 22 | +Located inside `test_identity_pool.py`, this fixture DRYs up test setup by allowing override injection: |
| 23 | + |
| 24 | +```python |
| 25 | +def test_example(make_credentials): |
| 26 | + creds = make_credentials(token_url="https://override") |
| 27 | + assert creds.init_kwargs["token_url"] == "https://override" |
| 28 | +``` |
| 29 | + |
| 30 | +--- |
| 31 | + |
| 32 | +## 🚀 Running Tests |
| 33 | + |
| 34 | +```bash |
| 35 | +pytest tests/ --tb=short -v |
| 36 | +``` |
| 37 | + |
| 38 | +--- |
| 39 | + |
| 40 | +## 🔒 Isolation Strategy |
| 41 | + |
| 42 | +All tests: |
| 43 | +- Mock `identity_pool.Credentials` to avoid upstream bugs |
| 44 | +- Avoid real network or crypto logic |
| 45 | +- Simulate real-world failure and refresh behavior |
| 46 | + |
| 47 | +--- |
| 48 | + |
| 49 | +## 🧼 Notes |
| 50 | + |
| 51 | +- Files have been sanitized for UTF-8 encoding |
| 52 | +- Built for rapid contribution, validation, and evolution |
| 53 | +``` |
| 54 | +
|
| 55 | +--- |
0 commit comments