Skip to content

feat(tests): add e2e test suite#1564

Open
LioriE wants to merge 13 commits into
feat/poc-async-base-and-totpfrom
feat/e2e-tests
Open

feat(tests): add e2e test suite#1564
LioriE wants to merge 13 commits into
feat/poc-async-base-and-totpfrom
feat/e2e-tests

Conversation

@LioriE

@LioriE LioriE commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator

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 (the invoke() + attribute-delegation wrapper) into a standalone module. Both the unit-test UnifiedClient in tests/conftest.py and the new e2e fixture inherit from it, eliminating duplication.

E2E fixture (tests/e2e/conftest.py)
A pytest-parametrized descope_client fixture (params: ["sync", "async"]) that wraps DescopeClient / DescopeClientAsync against a real backend. Tests auto-skip when DESCOPE_PROJECT_ID / DESCOPE_MANAGEMENT_KEY are absent — normal mocked CI runs are unaffected.

Test coverage

  • Auth: test_access_keys, test_magiclink, test_otp, test_password
  • Management: test_descoper, test_flow, test_jwt, test_mgmtkey, test_project, test_sso, test_user

Each test runs twice (sync + async) via the parametrized fixture. All tests use pytest.mark.e2e.

CI job
Adds an e2e job to .github/workflows/ci.yml that runs pytest tests/e2e -m e2e with project secrets injected. Added to the all-checks-passed gate.

Dependency
python-dotenv added as a dev dependency to support .env files for local runs.

@shuni-bot-dev

shuni-bot-dev Bot commented Jun 11, 2026

Copy link
Copy Markdown

🐕 Review complete — View session on Shuni Portal 🐾

@shuni-bot-dev shuni-bot-dev Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🐕 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-dotenv hard-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!

Comment thread tests/e2e/conftest.py Outdated
Comment thread .github/workflows/ci.yml Outdated
@github-actions

github-actions Bot commented Jun 11, 2026

Copy link
Copy Markdown

Coverage report

The coverage rate went from 98.31% to 97.67% ⬇️

100% of new lines are covered.

Diff Coverage details (click to unfold)

descope/management/authz_async.py

100% of new lines are covered (100% of the complete file).

descope/management/user_async.py

100% of new lines are covered (98.35% of the complete file).

descope/authmethod/webauthn.py

100% of new lines are covered (100% of the complete file).

descope/authmethod/webauthn_async.py

100% of new lines are covered (100% of the complete file).

LioriE added 3 commits June 11, 2026 17:26
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
LioriE added 10 commits June 11, 2026 17:33
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant