-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updating sign-up route to handle user groups (#95)
Problem sign up route doesn't handle or expect a user group Solution - sign-up now expects user group - sign-up puts user in appropriate db given user_group - created 1 unit test for valid sign in - TODO: write tests for invalid sign in Ticket URL https://mediform.atlassian.net/browse/MEDI-58 Documentation NA Tests Run - make all && make api && make testapi
- Loading branch information
1 parent
7183439
commit 2fa26a2
Showing
2 changed files
with
44 additions
and
5 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import pytest | ||
from fastapi.testclient import TestClient | ||
|
||
from api.constants import MEDICAL | ||
from api.models.user import create_user | ||
from api.main.database import SessionLocal | ||
|
||
|
||
@pytest.mark.needs(postgres=True) | ||
def test_valid_register(client: TestClient) -> None: | ||
""" | ||
Test that a new user is able to sign up successfully | ||
""" | ||
|
||
resp = client.post( | ||
"/api/sign-up", | ||
json={ | ||
"email": "[email protected]", | ||
"password": "Testing-123", | ||
"user_group": MEDICAL, | ||
}, | ||
) | ||
resp_data = resp.json() | ||
assert ( | ||
resp.status_code == 200 | ||
), "Error while signing up test user" + str(resp_data) | ||
assert ( | ||
"access_token" in resp_data | ||
), "Access token was not provided after signing up a valid user" |