-
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.
GH-4: Allow multiple users to be added via the API
- Loading branch information
1 parent
63584cc
commit 7950d92
Showing
7 changed files
with
18 additions
and
18 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -122,5 +122,4 @@ def _create_database() -> None: | |
def _configure_users() -> None: | ||
users = inject.instance(UserRepository) | ||
if not users.get_all(): | ||
users.add(User("[email protected]")) | ||
users.add(User("[email protected]")) | ||
users.add(User("[email protected]"), User("[email protected]")) |
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
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
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 |
---|---|---|
|
@@ -12,11 +12,11 @@ def users_fixture() -> UserRepository: | |
return inject.instance(UserRepository) | ||
|
||
|
||
def test_add_user(users: UserRepository, client: FlaskClient) -> None: | ||
response = client.post("/api/users", json={"email": "[email protected]"}) | ||
def test_add_users(users: UserRepository, client: FlaskClient) -> None: | ||
response = client.post("/api/users", json=[{"email": "[email protected]"}, {"email": "[email protected]"}]) | ||
|
||
assert response.status_code == 201 | ||
assert users.get_by_email("[email protected]") | ||
assert users.get_all() == [User("[email protected]"), User("[email protected]")] | ||
|
||
|
||
def test_clear_users(users: UserRepository, client: FlaskClient) -> None: | ||
|
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 |
---|---|---|
|
@@ -16,10 +16,10 @@ def users_fixture() -> DatabaseUserRepository: | |
return repository | ||
|
||
|
||
def test_add_user(users: DatabaseUserRepository) -> None: | ||
users.add(User("[email protected]")) | ||
def test_add_users(users: DatabaseUserRepository) -> None: | ||
users.add(User("[email protected]"), User("[email protected]")) | ||
|
||
assert users.get_by_email("[email protected]") == User("boardman@example.com") | ||
assert users.get_all() == [User("[email protected]"), User("obree@example.com")] | ||
|
||
|
||
def test_get_user_by_email(users: DatabaseUserRepository) -> None: | ||
|