-
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.
Add/Edit Fixutres for get_current_user Add Test get_current_active_admin
- Loading branch information
1 parent
0761b45
commit 90a3102
Showing
2 changed files
with
64 additions
and
25 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 |
---|---|---|
|
@@ -198,7 +198,7 @@ def mock_user(): | |
|
||
|
||
@pytest.fixture | ||
def mock_user_is_active(): | ||
def mock_user_is_active_not_admin(): | ||
"""Fixture for mocking a user.""" | ||
user = User( | ||
id=1, | ||
|
@@ -211,7 +211,7 @@ def mock_user_is_active(): | |
|
||
|
||
@pytest.fixture | ||
def mock_user_is_not_active(): | ||
def mock_user_not_active_not_admin(): | ||
"""Fixture for mocking a user.""" | ||
user = User( | ||
id=1, | ||
|
@@ -238,7 +238,7 @@ def mock_user_is_active_is_admin(): | |
|
||
|
||
@pytest.fixture | ||
def mock_user_is_not_active_is_admin(): | ||
def mock_user_not_active_is_admin(): | ||
"""Fixture for mocking a user.""" | ||
user = User( | ||
id=1, | ||
|
@@ -252,32 +252,34 @@ def mock_user_is_not_active_is_admin(): | |
|
||
|
||
@pytest.fixture | ||
def mock_user_is_not_active_is_not_admin(): | ||
"""Fixture for mocking a user.""" | ||
user = User( | ||
id=1, | ||
email="[email protected]", | ||
password="test1", | ||
hashed_password="test1fake_hash", | ||
is_active=False, | ||
is_admin=False, | ||
) | ||
return user | ||
def mock_get_current_user_is_active_not_admin(mock_user_is_active_not_admin): | ||
"""Fixture for mocking get_current_user to return the mock user.""" | ||
mock_function = MagicMock() | ||
mock_function.return_value = mock_user_is_active_not_admin | ||
return mock_function | ||
|
||
|
||
@pytest.fixture | ||
def mock_get_current_user_not_active_not_admin(mock_user_not_active_not_admin): | ||
"""Fixture for mocking get_current_user to return the mock user.""" | ||
mock_function = MagicMock() | ||
mock_function.return_value = mock_user_not_active_not_admin | ||
return mock_function | ||
|
||
|
||
@pytest.fixture | ||
def mock_get_current_user_active(mock_user_is_active): | ||
def mock_get_current_user_is_active_is_admin(mock_user_is_active_is_admin): | ||
"""Fixture for mocking get_current_user to return the mock user.""" | ||
mock_function = MagicMock() | ||
mock_function.return_value = mock_user_is_active | ||
mock_function.return_value = mock_user_is_active_is_admin | ||
return mock_function | ||
|
||
|
||
@pytest.fixture | ||
def mock_get_current_user_not_active(mock_user_is_not_active): | ||
def mock_get_current_user_not_active_is_admin(mock_user_not_active_is_admin): | ||
"""Fixture for mocking get_current_user to return the mock user.""" | ||
mock_function = MagicMock() | ||
mock_function.return_value = mock_user_is_not_active | ||
mock_function.return_value = mock_user_not_active_is_admin | ||
return mock_function | ||
|
||
|
||
|
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