Repository navigation
Conversation
find_by_identifier now uses the user list (GET /v1/:app_id/users, q=...) with the secret key and keeps only an exact match: the email in any case, or the phone compared as digits. It returns None when nobody by that identifier uses the app, and never creates a user. It follows the list's pages, up to 10 pages of 100. sessions.list and sessions.revoke work with the app's secret key alone; the docstrings and README say so. The README also says meta keys have to be the app's declared user meta fields. The live suite's tests for these (a refreshed token verifying locally, listing and revoking sessions, find_by_identifier for nobody) are normal tests again: 53 passed against scute-api-v2 v23.
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 changes
users.find_by_identifiernow searches the app's users with the secret key and never creates a user.GET /v1/:app_id/userswithq=), a loose search over email, phone and name. It keeps only an exact match: the email in any case, or the phone compared as digits (so pass it with the country code).Nonewhen nobody by that identifier uses the app, and makes no call for an identifier with nothing to search for.users.getshows it.It used to call the public identifier lookup (
GET /v1/auth/:app_id/users?identifier=), which now returns only what sign-in needs.sessions.list/sessions.revoke: they work with the app's secret key alone, with no user session. The API now accepts that. The docstrings and README say so.README: also says
meta/user_metakeys have to be the app's declared user meta fields. Other keys are left out on create (listed inuser_meta_errors) and refused on update.Tests
Unit: the fake API's user list now answers loosely and pages by 2. New tests cover:
Noneafter every pageLive: the strict xfails from Live suite: scute-python against a real Scute API (pytest -m live) #2 now pass, so they're normal tests again:
find_by_identifierreturningNonefor nobodyA new live test checks that only the exact email counts when the search also answers a near-identical one.
Results
mypy src,mypy --strict src tests/live: clean.pytest -m liveagainst scute-api-v2 v23: 53 passed, 0 failed, 0 xfailed. It used five sign-ins.Run it with
pytest -m live(setup in the README's "Live suite" section).