voipms-python/tests/tests.py

32 lines
807 B
Python
Raw Normal View History

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
from unittest.mock import MagicMock
2020-03-17 02:58:09 +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 02:58:09 +00:00
@patch('voipms.api.general.balance')
def test_make_get_request(mock_requests):
mock_response_obj = MagicMock()
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"}