Commit b3f4b9a9 authored by Joern jkuensem's avatar Joern jkuensem

TMSS-162: Fix bug in unittest setup that silently lets broken tests pass...

TMSS-162: Fix bug in unittest setup that silently lets broken tests pass (error in range definition)
parent 804f8ab0
......@@ -377,22 +377,22 @@ class SubtaskTestCase(unittest.TestCase):
url = r_dict['url']
GET_and_assert_expected_response(self, url, 200, st_test_data)
# Verify state log count is zero
# Verify state log count is 1
segments = url.split('/')
identifier = ''
while identifier == '':
identifier = segments.pop()
GET_and_assert_expected_response(self, BASE_URL + '/subtask_state_log/?subtask=' + identifier, 200, {"count":0})
GET_and_assert_expected_response(self, BASE_URL + '/subtask_state_log/?subtask=' + identifier, 200, {"count":1})
# PATCH item with something else than state and verify no log record is created
test_patch = {"specifications_doc": {"somespec": "somevalue"}}
PATCH_and_assert_expected_response(self, url, test_patch, 200, test_patch)
GET_and_assert_expected_response(self, BASE_URL + '/subtask_state_log/?subtask=' + identifier, 200, {"count": 0})
GET_and_assert_expected_response(self, BASE_URL + '/subtask_state_log/?subtask=' + identifier, 200, {"count": 1})
# PATCH item with state update and verify log record is created
test_patch = {"state": BASE_URL + "/subtask_state/finishing/"}
PATCH_and_assert_expected_response(self, url, test_patch, 200, test_patch)
GET_and_assert_expected_response(self, BASE_URL + '/subtask_state_log/?subtask=' + identifier, 200, {"count": 1})
GET_and_assert_expected_response(self, BASE_URL + '/subtask_state_log/?subtask=' + identifier, 200, {"count": 2})
class DataproductTestCase(unittest.TestCase):
......
......@@ -68,7 +68,7 @@ def _call_API_and_assert_expected_response(test_instance, url, call, data, expec
content = response.content.decode('utf-8')
if response.status_code in range(200, 100):
if response.status_code in range(200, 300):
r_dict = json.loads(content)
for key, value in expected_content.items():
if key not in r_dict.keys():
......
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