-
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.
Signed-off-by: viste <[email protected]>
- Loading branch information
Showing
1 changed file
with
6 additions
and
4 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 |
---|---|---|
|
@@ -20,6 +20,7 @@ def test_authorize_vk_success(mock_setup_routes, client): | |
mock_setup_routes.side_effect = lambda app, oauth: oauth | ||
app.oauth = mock_oauth | ||
|
||
# Mock the returned access token and VK profile | ||
mock_vk.authorize_access_token.return_value = { | ||
'access_token': 'mock_access_token', | ||
'email': '[email protected]' | ||
|
@@ -49,12 +50,13 @@ def test_authorize_vk_no_token(mock_setup_routes, client): | |
mock_setup_routes.side_effect = lambda app, oauth: oauth | ||
app.oauth = mock_oauth | ||
|
||
mock_vk.authorize_access_token.return_value = None # Simulate a failed token retrieval | ||
# Simulate a failed token retrieval | ||
mock_vk.authorize_access_token.return_value = None | ||
|
||
response = client.get('/vk/callback') | ||
|
||
assert response.status_code == 302 | ||
assert 'login' in response.location | ||
assert '/login' in response.location | ||
|
||
|
||
@patch('app.setup_routes') | ||
|
@@ -68,9 +70,9 @@ def test_authorize_vk_profile_failure(mock_setup_routes, client): | |
'access_token': 'mock_access_token', | ||
'email': '[email protected]' | ||
} | ||
mock_vk.get.return_value.json.return_value = {'response': []} | ||
mock_vk.get.return_value.json.return_value = {'response': []} # Simulate empty profile | ||
|
||
response = client.get('/vk/callback') | ||
|
||
assert response.status_code == 302 | ||
assert 'login' in response.location | ||
assert '/login' in response.location |