2020-03-17 02:58:09 +00:00
|
|
|
from __future__ import absolute_import
|
|
|
|
from __future__ import print_function
|
|
|
|
from unittest.mock import patch
|
|
|
|
from voipms.api import Client
|
2020-03-17 03:18:51 +00:00
|
|
|
from unittest.mock import MagicMock
|
2020-03-17 02:58:09 +00:00
|
|
|
|
2020-03-17 03:18:51 +00:00
|
|
|
import credentials
|
2020-03-17 02:58:09 +00:00
|
|
|
|
|
|
|
|
|
|
|
def test_instantiation():
|
|
|
|
username = credentials.username
|
|
|
|
password = credentials.password
|
|
|
|
|
|
|
|
client = Client(username, password)
|
|
|
|
return client
|
|
|
|
|
2020-03-17 03:18:51 +00:00
|
|
|
|
2020-03-17 02:58:09 +00:00
|
|
|
@patch('voipms.api.general.balance')
|
|
|
|
def test_make_get_request(mock_requests):
|
|
|
|
mock_response_obj = MagicMock()
|
2020-03-17 03:18:51 +00:00
|
|
|
mock_response_obj.json = {"test": "test"}
|
2020-03-17 02:58:09 +00:00
|
|
|
mock_response_obj.status_code = 200
|
|
|
|
mock_requests.get.return_value = mock_response_obj
|
|
|
|
|
|
|
|
username = credentials.username
|
|
|
|
password = credentials.password
|
|
|
|
|
|
|
|
client = Client(username, password)
|
|
|
|
|
|
|
|
res = client.registration_status.fetch()
|
|
|
|
assert res == {"test": "test"}
|