-
Notifications
You must be signed in to change notification settings - Fork 118
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
finish adding network apis and prepare for release
- Loading branch information
Showing
22 changed files
with
148 additions
and
89 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
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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
# 1.0.0 | ||
# 0.1.0b0 | ||
- Initial upload |
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"type": "https://developer.vonage.com/api-errors#invalid-param", | ||
"title": "Bad Request", | ||
"detail": "No Network Application associated with Vonage Application: 29f760f8-7ce1-46c9-ade3-f2dedee4ed5f", | ||
"instance": "b45ae630-7621-42b0-8ff0-6c1ad98e6e32" | ||
} |
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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
# 1.0.0 | ||
# 0.1.0b0 | ||
- Initial upload |
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
{ | ||
"latestSimChange": "2019-08-24T14:15:22Z" | ||
"latestSimChange": "2023-12-22T04:00:44.000Z" | ||
} |
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 |
---|---|---|
@@ -1,49 +1,49 @@ | ||
from os.path import abspath | ||
from unittest.mock import MagicMock, patch | ||
|
||
import responses | ||
from util import * | ||
from vonage_gnp_sim_swap import SimSwap | ||
from vonage_http_client.http_client import HttpClient | ||
from vonage_network_sim_swap import NetworkSimSwap | ||
|
||
from testutils import build_response, get_mock_jwt_auth | ||
|
||
path = abspath(__file__) | ||
|
||
sim_swap = NetworkSimSwap(HttpClient(get_mock_jwt_auth())) | ||
|
||
|
||
def test_http_client_property(): | ||
http_client = sim_swap.http_client | ||
assert isinstance(http_client, HttpClient) | ||
|
||
|
||
@patch('vonage_network_auth.NetworkAuth.get_oauth2_user_token') | ||
@responses.activate | ||
def test_check_sim_swap(sim_swap: SimSwap): | ||
stub( | ||
responses.POST, | ||
'https://api-eu.vonage.com/oauth2/bc-authorize', | ||
fixture_path='camara_auth/oidc_request.json', | ||
) | ||
stub( | ||
responses.POST, | ||
'https://api-eu.vonage.com/oauth2/token', | ||
fixture_path='camara_auth/token_request.json', | ||
) | ||
stub( | ||
responses.POST, | ||
def test_check_sim_swap(mock_get_oauth2_user_token: MagicMock): | ||
build_response( | ||
path, | ||
'POST', | ||
'https://api-eu.vonage.com/camara/sim-swap/v040/check', | ||
fixture_path='sim_swap/check_sim_swap.json', | ||
'check_sim_swap.json', | ||
) | ||
mock_get_oauth2_user_token.return_value = 'token' | ||
|
||
response = sim_swap.check('447700900000', max_age=24) | ||
|
||
assert response['swapped'] == True | ||
|
||
|
||
@patch('vonage_network_auth.NetworkAuth.get_oauth2_user_token') | ||
@responses.activate | ||
def test_get_last_swap_date(sim_swap: SimSwap): | ||
stub( | ||
responses.POST, | ||
'https://api-eu.vonage.com/oauth2/bc-authorize', | ||
fixture_path='camara_auth/oidc_request.json', | ||
) | ||
stub( | ||
responses.POST, | ||
'https://api-eu.vonage.com/oauth2/token', | ||
fixture_path='camara_auth/token_request.json', | ||
) | ||
stub( | ||
responses.POST, | ||
def test_get_last_swap_date(mock_get_oauth2_user_token: MagicMock): | ||
build_response( | ||
path, | ||
'POST', | ||
'https://api-eu.vonage.com/camara/sim-swap/v040/retrieve-date', | ||
fixture_path='sim_swap/get_swap_date.json', | ||
'get_swap_date.json', | ||
) | ||
mock_get_oauth2_user_token.return_value = 'token' | ||
|
||
response = sim_swap.get_last_swap_date('447700900000') | ||
|
||
assert response['latestSimChange'] == '2019-08-24T14:15:22Z' | ||
assert response['latestSimChange'] == '2023-12-22T04:00:44.000Z' |
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
Oops, something went wrong.