Commit fdf13dfa authored by Jo Sama's avatar Jo Sama 😱
Browse files

Add test for create_operator()

parent b8e62754
......@@ -3,6 +3,7 @@ import os
import json
from topdesk_client import get_client
from topdesk_client.models import Operator
# @pytest.fixture
# def request():
......@@ -39,6 +40,12 @@ def operator_data():
return load_json_file('operator.json')
@pytest.fixture
def operator():
d = load_json_file('operator.json')
return Operator.from_dict(d)
@pytest.fixture
def operator_list_data():
return load_json_file('operator_list.json')
......@@ -18,3 +18,17 @@ def test_list_operators(client, base_url, requests_mock, operator_list_data):
assert isinstance(expected, types.GeneratorType)
for x in expected:
assert isinstance(x, Operator)
def test_create_operator(client,
base_url,
requests_mock,
operator_data,
operator):
m = requests_mock.post(client.urls.get_operators())
client.create_operator(operator)
object_sent = m.request_history[-1].text
sent_operator = Operator.from_json(object_sent)
assert(sent_operator == operator)
assert(sent_operator.dict() == operator.dict())
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment