Skip to content

Commit

Permalink
update tests again
Browse files Browse the repository at this point in the history
Signed-off-by: viste <[email protected]>
  • Loading branch information
Viste committed Aug 20, 2024
1 parent 760e7c1 commit 6120581
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions tests/test_vk_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]'
Expand Down Expand Up @@ -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')
Expand All @@ -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

0 comments on commit 6120581

Please sign in to comment.