-
Notifications
You must be signed in to change notification settings - Fork 1
speed up tests by by removing redundant logins #21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughIntroduces lazy caching for the create_authenticated_headers fixture in tests, consolidates a duplicate import in auth tests, and updates multiple test files to decouple entity creation from authentication by removing direct header usage. Adds post-condition assertions in a category duplicate-name test and adjusts token-error tests to rely on get_headers. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Test
participant Fixture as create_authenticated_headers (fixture)
participant Auth as Auth API
rect rgba(200,230,255,0.3)
note over Fixture: First call
Test->>Fixture: request headers
alt cache empty
Fixture->>Auth: register + login
Auth-->>Fixture: access token
Fixture->>Fixture: store headers in cache
end
Fixture-->>Test: cached headers
end
rect rgba(220,255,220,0.3)
note over Fixture: Subsequent calls
Test->>Fixture: request headers
Fixture-->>Test: return cached headers (no API calls)
end
sequenceDiagram
autonumber
actor Test
participant Helpers as create_* helpers
participant API as REST API
participant Headers as get_headers
rect rgba(245,245,245,1)
note over Test,Helpers: Entity setup without auth
Test->>Helpers: create_category / create_subcategory / create_product
Helpers->>API: POST (no headers)
API-->>Helpers: created entity
end
rect rgba(255,240,200,0.5)
note over Test,API: Token check phase
Test->>Headers: get_headers(expected_token_state)
Headers-->>Test: headers (valid/invalid/missing)
Test->>API: PATCH/DELETE/GET with headers
API-->>Test: response (success or token error)
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (6)
🧰 Additional context used🧬 Code graph analysis (5)tests/conftest.py (1)
tests/test_product.py (2)
tests/test_relationships.py (1)
tests/test_subcategory.py (1)
tests/test_category.py (1)
🔇 Additional comments (14)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary by CodeRabbit
Tests
Chores/Refactor