testing: add shims to mock authentication locally (Bug 1978881)#440
testing: add shims to mock authentication locally (Bug 1978881)#440cgsheeh wants to merge 1 commit intomozilla-conduit:mainfrom
Conversation
Add a `MockAuthBackend` which overrides `authenticate` to always return a mocked local user. Add a `MockAuthMiddleware` to log the user in to a session. With these shims loaded, running Lando locally with `docker compose` will show an authenticated view.
|
@zzzeid @shtrom posting this as a draft so we can discuss the best approach for using this in the repo. Test failures are expected since it's currently loading into the main My initial thought is we should add this in a separate |
Initial thoughts:
Aside from the comments above:
See implementation of test_settings.py and remote_settings.py which could be used in a similar way for local_settings.py. |
…927013) (mozilla-conduit#440) The `PhabricatorDouble` mock API calls take the `limit` parameter, but do not actually limit the number of entries in the response data. Add a check if `limit` is set and slice the `items `list at that index.
Add a
MockAuthBackendwhich overridesauthenticateto alwaysreturn a mocked local user. Add a
MockAuthMiddlewareto log theuser in to a session.
With these shims loaded, running Lando locally with
docker composewill show an authenticated view.