feat(tests): add e2e test suite#1564
Open
LioriE wants to merge 13 commits into
Open
Conversation
|
🐕 Review complete — View session on Shuni Portal 🐾 |
There was a problem hiding this comment.
🐕 Shuni's Review
Adds a parametrized (sync+async) e2e suite that runs the SDK against a real Descope backend, plus a CI e2e job. Clean, well-organized port — good bones!
Sniffed out 2 issues:
- 2 🟡 MEDIUM: dev-only
python-dotenvhard-imported in an always-collected conftest; e2e added to the required merge gate while running against prod.
No crash bugs found. See inline comments. Woof!
Coverage reportThe coverage rate went from
Diff Coverage details (click to unfold)descope/management/authz_async.py
descope/management/user_async.py
descope/authmethod/webauthn.py
descope/authmethod/webauthn_async.py
|
Ports the Python integration tests from integrationtests/python/tests/ into tests/e2e/, restructured as pytest async tests that run against a real Descope backend via the unified sync/async client fixture. - Adds UnifiedClientBase to tests/_unified.py (shared by unit and e2e) - Adds tests/e2e/conftest.py with parametrised descope_client fixture - Ports auth tests: access_keys, magiclink, otp, password - Ports management tests: descoper, flow, jwt, mgmtkey, project, sso, user - Wires an e2e CI job gated on DESCOPE_PROJECT_ID / DESCOPE_MANAGEMENT_KEY - Marks tests with pytest.mark.e2e; skipped automatically when env absent
Guard the dotenv import with try/except ImportError so that running pytest tests/ in a non-dev install (uv sync --no-dev / --group tests) does not fail collection for the entire suite.
Replace the skipif guard and requires_e2e_env mark with a module-level check that prints a clear error to stderr and calls pytest.exit() when DESCOPE_PROJECT_ID or DESCOPE_MANAGEMENT_KEY are absent.
The build job has no e2e secrets; the e2e conftest now exits on missing env vars instead of skipping. Explicitly ignore tests/e2e so the build matrix doesn't hit that guard. The e2e job still targets tests/e2e directly.
…group, debounce - Exempt renovate[bot] from the prod-hitting step (job stays green, no API call) - Serialize e2e runs across all PRs via a global concurrency group (e2e-prod) - Add 5-min debounce on PR runs so rapid pushes cancel stale runs before they hit prod - Debounce skippable via 'e2e-fast' PR label or skip_debounce workflow_dispatch input
Adds a sandbox smoke-check before hitting the rate-limited prod API. If sandbox fails the prod job is skipped (not failed), keeping the done gate green and preserving prod rate-limit budget. Also moves the debounce and renovate/draft guards onto e2e-sandbox so the e2e-prod concurrency slot is held only during the actual prod run, not during the 5-min debounce or sandbox execution. Requires three new repo secrets: DESCOPE_SANDBOX_PROJECT_ID, DESCOPE_SANDBOX_MANAGEMENT_KEY, DESCOPE_SANDBOX_BASE_URI.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds an end-to-end test suite that runs the SDK against a real Descope backend, covering both the sync and async clients in a single parametrized pass.
Key changes
New shared base (
tests/_unified.py)Extracts
UnifiedClientBase(theinvoke()+ attribute-delegation wrapper) into a standalone module. Both the unit-testUnifiedClientintests/conftest.pyand the new e2e fixture inherit from it, eliminating duplication.E2E fixture (
tests/e2e/conftest.py)A
pytest-parametrizeddescope_clientfixture (params:["sync", "async"]) that wrapsDescopeClient/DescopeClientAsyncagainst a real backend. Tests auto-skip whenDESCOPE_PROJECT_ID/DESCOPE_MANAGEMENT_KEYare absent — normal mocked CI runs are unaffected.Test coverage
test_access_keys,test_magiclink,test_otp,test_passwordtest_descoper,test_flow,test_jwt,test_mgmtkey,test_project,test_sso,test_userEach test runs twice (sync + async) via the parametrized fixture. All tests use
pytest.mark.e2e.CI job
Adds an
e2ejob to.github/workflows/ci.ymlthat runspytest tests/e2e -m e2ewith project secrets injected. Added to theall-checks-passedgate.Dependency
python-dotenvadded as a dev dependency to support.envfiles for local runs.