Skip to content

Development and testing

Greg Bowler edited this page Jul 20, 2020 · 1 revision

Use fake login or replaceable session and redirect handlers to test application behavior without visiting the provider.

A local fake login

auth.fake_login('development-user')
auth.fake_login('development-user', 'developer@example.test', '/members/')

Fake login stores synthetic user data and redirects with an encrypted response. The redirected request processes that response, invokes the callback and removes the parameter. The default email is fakelogin@authwave.com.

Use a destination without an existing query: fake login appends its own ?. The current authenticator's user is refreshed on the redirected request. Only the default fake email takes the local logout branch.

Warning

Fake login bypasses the provider. Restrict it to local development; never expose a production route that accepts an arbitrary identity.

Recording redirects in a test

class RecordingRedirectHandler(RedirectHandler):
    def __init__(self):
        self.destination = None
    def redirect(self, uri, code=303):
        self.destination = str(uri)

Recording handlers return normally for controlled tests. Production integrations transfer control back to the runtime adapter.

Running the repository checks

pip install -e '.[test]'
pytest
python -m build

Tests cover core behavior, complete runtime login/logout flows and 68 deterministic PHP-reference scenarios. Set AUTHWAVE_PHP_REFERENCE to a PHP checkout with installed Composer dependencies to execute that source and verify the stored fixtures. PARITY.md in the repository maps the language APIs.


Next, see Troubleshooting.

Clone this wiki locally