|
|
|
@ -8,7 +8,7 @@ import json |
|
|
|
|
import pytest |
|
|
|
|
from mock import (patch, PropertyMock, MagicMock) |
|
|
|
|
from pyfbx import Fbx |
|
|
|
|
from pyfbx.client import (FbxErrorResponse, FbxTransport) |
|
|
|
|
from pyfbx.client import (ResponseError, Transport) |
|
|
|
|
from pyfbx.mdns import FbxMDNS |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -16,7 +16,7 @@ def test_fbx_register(): |
|
|
|
|
f = Fbx("http://192.168.1.254/api/v6") |
|
|
|
|
with pytest.raises(Exception): |
|
|
|
|
f.mksession() |
|
|
|
|
with patch('pyfbx.client.FbxTransport.api_exec', |
|
|
|
|
with patch('pyfbx.client.Transport.api_exec', |
|
|
|
|
side_effect=iter([ |
|
|
|
|
{"track_id": "id", "app_token": "tok"}, |
|
|
|
|
{"status": "pending"}, |
|
|
|
@ -37,10 +37,10 @@ def test_fbx_session_local(): |
|
|
|
|
"first_name": "Sandy", |
|
|
|
|
"last_name": "Kilo"}) |
|
|
|
|
f.Contacts.Delete_a_contact(id=r['id']) |
|
|
|
|
with pytest.raises(FbxErrorResponse): |
|
|
|
|
with pytest.raises(ResponseError): |
|
|
|
|
try: |
|
|
|
|
f.Contacts.Access_a_given_contact_entry(1) |
|
|
|
|
except FbxErrorResponse as e: |
|
|
|
|
except ResponseError as e: |
|
|
|
|
print(e) |
|
|
|
|
raise |
|
|
|
|
with patch('requests.Response', PropertyMock) as mock_resp: |
|
|
|
@ -66,7 +66,7 @@ def test_mdns(): |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_nonet(): |
|
|
|
|
with patch('pyfbx.client.FbxTransport._session', new_callable=PropertyMock, return_value=MagicMock(), create=True) as mock_session: |
|
|
|
|
with patch('pyfbx.client.Transport._session', new_callable=PropertyMock, return_value=MagicMock(), create=True) as mock_session: |
|
|
|
|
f = Fbx("http://192.168.12.34/api/v9") |
|
|
|
|
f.System.Reboot_the_system() |
|
|
|
|
f = Fbx() |
|
|
|
|