Commit 73e8436b authored by Jo Sama's avatar Jo Sama 😱
Browse files

Proper test for {create,update}_operator()

parent b8265eda
......@@ -48,6 +48,9 @@ def operator():
d = load_json_file('operator.json')
return Operator.from_dict(d)
@pytest.fixture
def operator_as_dict():
return load_json_file('operator.json')
@pytest.fixture
def uncreated_operator():
......
......@@ -50,8 +50,11 @@ def _patch_operator_for_comparison(obj, operator):
def test_create_operator(client,
base_url,
requests_mock,
uncreated_operator):
m = requests_mock.post(client.urls.get_operators())
uncreated_operator,
operator_as_dict):
m = requests_mock.post(client.urls.get_operators(),
status_code=201,
json=operator_as_dict)
client.create_operator(uncreated_operator)
object_sent = m.request_history[-1].text
......@@ -63,8 +66,11 @@ def test_create_operator(client,
def test_update_operator(client,
base_url,
requests_mock,
operator_as_dict,
operator):
m = requests_mock.patch(client.urls.get_operator(operator.id))
m = requests_mock.put(client.urls.get_operator(operator.id),
status_code=200,
json=operator_as_dict)
client.update_operator(operator)
object_sent = m.request_history[-1].text
......
Markdown is supported
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