Skip to content
Snippets Groups Projects
Verified Commit fd5956bd authored by Yoann Schneider's avatar Yoann Schneider :tennis:
Browse files

provide slim output as kwargs

parent fcca9c33
No related branches found
No related tags found
No related merge requests found
Pipeline #79417 failed
...@@ -104,6 +104,7 @@ class ElementMixin(object): ...@@ -104,6 +104,7 @@ class ElementMixin(object):
sub_element = self.request( sub_element = self.request(
"CreateElement", "CreateElement",
slim_output=slim_output,
body={ body={
"type": type, "type": type,
"name": name, "name": name,
......
...@@ -447,7 +447,7 @@ def test_create_sub_element_api_error(responses, mock_elements_worker): ...@@ -447,7 +447,7 @@ def test_create_sub_element_api_error(responses, mock_elements_worker):
) )
responses.add( responses.add(
responses.POST, responses.POST,
"http://testserver/api/v1/elements/create/", "http://testserver/api/v1/elements/create/?slim_output=True",
status=500, status=500,
) )
...@@ -464,11 +464,11 @@ def test_create_sub_element_api_error(responses, mock_elements_worker): ...@@ -464,11 +464,11 @@ def test_create_sub_element_api_error(responses, mock_elements_worker):
(call.request.method, call.request.url) for call in responses.calls (call.request.method, call.request.url) for call in responses.calls
] == BASE_API_CALLS + [ ] == BASE_API_CALLS + [
# We retry 5 times the API call # We retry 5 times the API call
("POST", "http://testserver/api/v1/elements/create/"), ("POST", "http://testserver/api/v1/elements/create/?slim_output=True"),
("POST", "http://testserver/api/v1/elements/create/"), ("POST", "http://testserver/api/v1/elements/create/?slim_output=True"),
("POST", "http://testserver/api/v1/elements/create/"), ("POST", "http://testserver/api/v1/elements/create/?slim_output=True"),
("POST", "http://testserver/api/v1/elements/create/"), ("POST", "http://testserver/api/v1/elements/create/?slim_output=True"),
("POST", "http://testserver/api/v1/elements/create/"), ("POST", "http://testserver/api/v1/elements/create/?slim_output=True"),
] ]
...@@ -488,7 +488,7 @@ def test_create_sub_element(responses, mock_elements_worker, slim_output): ...@@ -488,7 +488,7 @@ def test_create_sub_element(responses, mock_elements_worker, slim_output):
} }
responses.add( responses.add(
responses.POST, responses.POST,
"http://testserver/api/v1/elements/create/", f"http://testserver/api/v1/elements/create/?slim_output={slim_output}",
status=200, status=200,
json=child_elt, json=child_elt,
) )
...@@ -505,7 +505,10 @@ def test_create_sub_element(responses, mock_elements_worker, slim_output): ...@@ -505,7 +505,10 @@ def test_create_sub_element(responses, mock_elements_worker, slim_output):
assert [ assert [
(call.request.method, call.request.url) for call in responses.calls (call.request.method, call.request.url) for call in responses.calls
] == BASE_API_CALLS + [ ] == BASE_API_CALLS + [
("POST", "http://testserver/api/v1/elements/create/"), (
"POST",
f"http://testserver/api/v1/elements/create/?slim_output={slim_output}",
),
] ]
assert json.loads(responses.calls[-1].request.body) == { assert json.loads(responses.calls[-1].request.body) == {
"type": "something", "type": "something",
...@@ -533,7 +536,7 @@ def test_create_sub_element_confidence(responses, mock_elements_worker): ...@@ -533,7 +536,7 @@ def test_create_sub_element_confidence(responses, mock_elements_worker):
) )
responses.add( responses.add(
responses.POST, responses.POST,
"http://testserver/api/v1/elements/create/", "http://testserver/api/v1/elements/create/?slim_output=True",
status=200, status=200,
json={"id": "12345678-1234-1234-1234-123456789123"}, json={"id": "12345678-1234-1234-1234-123456789123"},
) )
...@@ -550,7 +553,7 @@ def test_create_sub_element_confidence(responses, mock_elements_worker): ...@@ -550,7 +553,7 @@ def test_create_sub_element_confidence(responses, mock_elements_worker):
assert [ assert [
(call.request.method, call.request.url) for call in responses.calls (call.request.method, call.request.url) for call in responses.calls
] == BASE_API_CALLS + [ ] == BASE_API_CALLS + [
("POST", "http://testserver/api/v1/elements/create/"), ("POST", "http://testserver/api/v1/elements/create/?slim_output=True"),
] ]
assert json.loads(responses.calls[-1].request.body) == { assert json.loads(responses.calls[-1].request.body) == {
"type": "something", "type": "something",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment