diff --git a/SAS/TMSS/test/t_subtask_validation.py b/SAS/TMSS/test/t_subtask_validation.py index c20c88b61703f4847ea45ca8528d152f4a81d870..bf33a8e4fc1abdf4c9024e8eec8886484ce6c446 100755 --- a/SAS/TMSS/test/t_subtask_validation.py +++ b/SAS/TMSS/test/t_subtask_validation.py @@ -151,7 +151,7 @@ class SubtaskValidationTest(unittest.TestCase): # POST and GET a new item and assert correctness r_dict = POST_and_assert_expected_response(self, BASE_URL + '/subtask/', subtask_test_data, 201, subtask_test_data) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, subtask_test_data) + GET_OK_and_assert_equal_expected_response(self, url, subtask_test_data) def test_validate_simple_string_schema_with_invalid_specification_via_rest(self): template = rest_data_creator.SubtaskTemplate(schema='{"type": "string"}') @@ -183,7 +183,7 @@ class SubtaskValidationTest(unittest.TestCase): # POST and GET a new item and assert correctness r_dict = POST_and_assert_expected_response(self, BASE_URL + '/subtask/', subtask_test_data, 201, subtask_test_data) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, subtask_test_data) + GET_OK_and_assert_equal_expected_response(self, url, subtask_test_data) def test_validate_correlator_schema_with_invalid_specification_via_rest(self): # fetch correlator_schema for Dupplo UC1 which should be in the initially populated database diff --git a/SAS/TMSS/test/t_tmssapp_scheduling_functional.py b/SAS/TMSS/test/t_tmssapp_scheduling_functional.py index 0b4345a35d6069ecceb663fcdcd8d8bcc8cccf39..42ad59be4d671e53101ae0a29dd16e4fd344614b 100755 --- a/SAS/TMSS/test/t_tmssapp_scheduling_functional.py +++ b/SAS/TMSS/test/t_tmssapp_scheduling_functional.py @@ -53,7 +53,7 @@ class SubtaskTemplateTestCase(unittest.TestCase): self.assertTrue("Subtask Template List" in r.content.decode('utf8')) def test_subtask_template_template_GET_nonexistant_raises_error(self): - GET_and_assert_equal_expected_response(self, BASE_URL + '/subtask_template/1234321/', 404, {}) + GET_and_assert_equal_expected_code(self, BASE_URL + '/subtask_template/1234321/', 404) def test_subtask_template_POST_and_GET(self): st_test_data = test_data_creator.SubtaskTemplate() @@ -61,7 +61,7 @@ class SubtaskTemplateTestCase(unittest.TestCase): # POST and GET a new item and assert correctness r_dict = POST_and_assert_expected_response(self, BASE_URL + '/subtask_template/', st_test_data, 201, st_test_data) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, st_test_data) + GET_OK_and_assert_equal_expected_response(self, url, st_test_data) def test_subtask_template_PUT_invalid_raises_error(self): st_test_data = test_data_creator.SubtaskTemplate() @@ -74,11 +74,11 @@ class SubtaskTemplateTestCase(unittest.TestCase): # POST new item, verify r_dict = POST_and_assert_expected_response(self, BASE_URL + '/subtask_template/', st_test_data, 201, st_test_data) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, st_test_data) + GET_OK_and_assert_equal_expected_response(self, url, st_test_data) # PUT new values, verify PUT_and_assert_expected_response(self, url, st_test_data2, 200, st_test_data2) - GET_and_assert_equal_expected_response(self, url, 200, st_test_data2) + GET_OK_and_assert_equal_expected_response(self, url, st_test_data2) def test_subtask_template_PATCH(self): st_test_data = test_data_creator.SubtaskTemplate() @@ -86,7 +86,7 @@ class SubtaskTemplateTestCase(unittest.TestCase): # POST new item, verify r_dict = POST_and_assert_expected_response(self, BASE_URL + '/subtask_template/', st_test_data, 201, st_test_data) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, st_test_data) + GET_OK_and_assert_equal_expected_response(self, url, st_test_data) test_patch = {"type": BASE_URL + '/subtask_type/inspection/', "version": 'v6.28318530718', @@ -97,7 +97,7 @@ class SubtaskTemplateTestCase(unittest.TestCase): PATCH_and_assert_expected_response(self, url, test_patch, 200, test_patch) expected_data = dict(st_test_data) expected_data.update(test_patch) - GET_and_assert_equal_expected_response(self, url, 200, expected_data) + GET_OK_and_assert_equal_expected_response(self, url, expected_data) def test_subtask_template_DELETE(self): st_test_data = test_data_creator.SubtaskTemplate() @@ -105,7 +105,7 @@ class SubtaskTemplateTestCase(unittest.TestCase): # POST new item, verify r_dict = POST_and_assert_expected_response(self, BASE_URL + '/subtask_template/', st_test_data, 201, st_test_data) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, st_test_data) + GET_OK_and_assert_equal_expected_response(self, url, st_test_data) # DELETE and check it's gone DELETE_and_assert_gone(self, url) @@ -122,14 +122,14 @@ class SubtaskTemplateTestCase(unittest.TestCase): test_data = dict(st_test_data) test_data['type'] = type_url url = POST_and_assert_expected_response(self, BASE_URL + '/subtask_template/', test_data, 201, test_data)['url'] - GET_and_assert_equal_expected_response(self, url, 200, test_data) + GET_OK_and_assert_equal_expected_response(self, url, test_data) # Try to DELETE dependency, verify that was not successful # Unfortunately we don't get a nice error in json, but a Django debug page on error 500... response = requests.delete(type_url, auth=AUTH) self.assertEqual(500, response.status_code) self.assertTrue("ProtectedError" in str(response.content)) - GET_and_assert_equal_expected_response(self, type_url, 200, type_data) + GET_OK_and_assert_equal_expected_response(self, type_url, type_data) def test_GET_SubtaskTemplate_list_view_shows_entry(self): @@ -146,8 +146,8 @@ class SubtaskTemplateTestCase(unittest.TestCase): id1 = models.SubtaskTemplate.objects.create(**test_data_1).id id2 = models.SubtaskTemplate.objects.create(**test_data_2).id # assert - GET_and_assert_in_expected_response(self, BASE_URL + '/subtask_template/%s/' % id1, test_data_1) - GET_and_assert_in_expected_response(self, BASE_URL + '/subtask_template/%s/' % id2, test_data_2) + GET_OK_and_assert_equal_expected_response(self, BASE_URL + '/subtask_template/%s/' % id1, test_data_1) + GET_OK_and_assert_equal_expected_response(self, BASE_URL + '/subtask_template/%s/' % id2, test_data_2) class DataproductSpecificationsTemplateTestCase(unittest.TestCase): @@ -157,7 +157,7 @@ class DataproductSpecificationsTemplateTestCase(unittest.TestCase): self.assertTrue("Dataproduct Specifications Template List" in r.content.decode('utf8')) def test_dataproduct_specifications_template_template_GET_nonexistant_raises_error(self): - GET_and_assert_equal_expected_response(self, BASE_URL + '/dataproduct_specifications_template/1234321/', 404, {}) + GET_and_assert_equal_expected_code(self, BASE_URL + '/dataproduct_specifications_template/1234321/', 404) def test_dataproduct_specifications_template_POST_and_GET(self): dst_test_data = test_data_creator.DataproductSpecificationsTemplate() @@ -165,7 +165,7 @@ class DataproductSpecificationsTemplateTestCase(unittest.TestCase): # POST and GET a new item and assert correctness r_dict = POST_and_assert_expected_response(self, BASE_URL + '/dataproduct_specifications_template/', dst_test_data, 201, dst_test_data) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, dst_test_data) + GET_OK_and_assert_equal_expected_response(self, url, dst_test_data) def test_dataproduct_specifications_template_PUT_invalid_raises_error(self): dst_test_data = test_data_creator.DataproductSpecificationsTemplate() @@ -179,11 +179,11 @@ class DataproductSpecificationsTemplateTestCase(unittest.TestCase): # POST new item, verify r_dict = POST_and_assert_expected_response(self, BASE_URL + '/dataproduct_specifications_template/', dst_test_data, 201, dst_test_data) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, dst_test_data) + GET_OK_and_assert_equal_expected_response(self, url, dst_test_data) # PUT new values, verify PUT_and_assert_expected_response(self, url, dst_test_data2, 200, dst_test_data2) - GET_and_assert_equal_expected_response(self, url, 200, dst_test_data2) + GET_OK_and_assert_equal_expected_response(self, url, dst_test_data2) def test_dataproduct_specifications_template_PATCH(self): dst_test_data = test_data_creator.DataproductSpecificationsTemplate() @@ -191,7 +191,7 @@ class DataproductSpecificationsTemplateTestCase(unittest.TestCase): # POST new item, verify r_dict = POST_and_assert_expected_response(self, BASE_URL + '/dataproduct_specifications_template/', dst_test_data, 201, dst_test_data) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, dst_test_data) + GET_OK_and_assert_equal_expected_response(self, url, dst_test_data) test_patch = {"version": 'v6.28318530718', "schema": {"mykey": "my better value"}, @@ -201,7 +201,7 @@ class DataproductSpecificationsTemplateTestCase(unittest.TestCase): PATCH_and_assert_expected_response(self, url, test_patch, 200, test_patch) expected_data = dict(dst_test_data) expected_data.update(test_patch) - GET_and_assert_equal_expected_response(self, url, 200, expected_data) + GET_OK_and_assert_equal_expected_response(self, url, expected_data) def test_dataproduct_specifications_template_DELETE(self): dst_test_data = test_data_creator.DataproductSpecificationsTemplate() @@ -209,7 +209,7 @@ class DataproductSpecificationsTemplateTestCase(unittest.TestCase): # POST new item, verify r_dict = POST_and_assert_expected_response(self, BASE_URL + '/dataproduct_specifications_template/', dst_test_data, 201, dst_test_data) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, dst_test_data) + GET_OK_and_assert_equal_expected_response(self, url, dst_test_data) # DELETE and check it's gone DELETE_and_assert_gone(self, url) @@ -229,8 +229,8 @@ class DataproductSpecificationsTemplateTestCase(unittest.TestCase): id1 = models.DataproductSpecificationsTemplate.objects.create(**test_data_1).id id2 = models.DataproductSpecificationsTemplate.objects.create(**test_data_2).id # assert - GET_and_assert_in_expected_response(self, BASE_URL + '/dataproduct_specifications_template/%s/' % id1, test_data_1) - GET_and_assert_in_expected_response(self, BASE_URL + '/dataproduct_specifications_template/%s/' % id2, test_data_2) + GET_OK_and_assert_equal_expected_response(self, BASE_URL + '/dataproduct_specifications_template/%s/' % id1, test_data_1) + GET_OK_and_assert_equal_expected_response(self, BASE_URL + '/dataproduct_specifications_template/%s/' % id2, test_data_2) class DataproductFeedbackTemplateTestCase(unittest.TestCase): @@ -267,7 +267,7 @@ class DefaultSubtaskTemplatesTestCase(unittest.TestCase): response = requests.delete(template_url, auth=AUTH) self.assertEqual(500, response.status_code) self.assertTrue("ProtectedError" in str(response.content)) - GET_and_assert_equal_expected_response(self, template_url, 200, st_test_data) + GET_OK_and_assert_equal_expected_response(self, template_url, st_test_data) def test_default_dataproduct_specifications_template_PROTECT_behavior_on_template_deleted(self): dpst_test_data = test_data_creator.DataproductSpecificationsTemplate() @@ -282,7 +282,7 @@ class DefaultSubtaskTemplatesTestCase(unittest.TestCase): response = requests.delete(template_url, auth=AUTH) self.assertEqual(500, response.status_code) self.assertTrue("ProtectedError" in str(response.content)) - GET_and_assert_equal_expected_response(self, template_url, 200, dpst_test_data) + GET_OK_and_assert_equal_expected_response(self, template_url, dpst_test_data) class SubtaskTestCase(unittest.TestCase): @@ -299,7 +299,7 @@ class SubtaskTestCase(unittest.TestCase): self.assertTrue("Subtask List" in r.content.decode('utf8')) def test_subtask_GET_nonexistant_raises_error(self): - GET_and_assert_equal_expected_response(self, BASE_URL + '/subtask/1234321/', 404, {}) + GET_and_assert_equal_expected_code(self, BASE_URL + '/subtask/1234321/', 404) def test_subtask_POST_and_GET(self): st_test_data = test_data_creator.Subtask(cluster_url=self.cluster_url, task_blueprint_url=self.task_blueprint_url, specifications_template_url=self.specifications_template_url) @@ -307,7 +307,7 @@ class SubtaskTestCase(unittest.TestCase): # POST and GET a new item and assert correctness r_dict = POST_and_assert_expected_response(self, BASE_URL + '/subtask/', st_test_data, 201, st_test_data) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, st_test_data) + GET_OK_and_assert_equal_expected_response(self, url, st_test_data) minimium_subtaskid = 2000000 subtask_id = url.split("subtask/")[1].replace("/","") self.assertGreaterEqual(int(subtask_id), minimium_subtaskid) @@ -324,11 +324,11 @@ class SubtaskTestCase(unittest.TestCase): # POST new item, verify r_dict = POST_and_assert_expected_response(self, BASE_URL + '/subtask/', st_test_data, 201, st_test_data) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, st_test_data) + GET_OK_and_assert_equal_expected_response(self, url, st_test_data) # PUT new values, verify PUT_and_assert_expected_response(self, url, st_test_data2, 200, st_test_data2) - GET_and_assert_equal_expected_response(self, url, 200, st_test_data2) + GET_OK_and_assert_equal_expected_response(self, url, st_test_data2) def test_subtask_PATCH(self): st_test_data = test_data_creator.Subtask(cluster_url=self.cluster_url, task_blueprint_url=self.task_blueprint_url, specifications_template_url=self.specifications_template_url) @@ -336,7 +336,7 @@ class SubtaskTestCase(unittest.TestCase): # POST new item, verify r_dict = POST_and_assert_expected_response(self, BASE_URL + '/subtask/', st_test_data, 201, st_test_data) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, st_test_data) + GET_OK_and_assert_equal_expected_response(self, url, st_test_data) test_patch = {"specifications_doc": {"somespec": "somevalue"}} @@ -344,7 +344,7 @@ class SubtaskTestCase(unittest.TestCase): PATCH_and_assert_expected_response(self, url, test_patch, 200, test_patch) expected_data = dict(st_test_data) expected_data.update(test_patch) - GET_and_assert_equal_expected_response(self, url, 200, expected_data) + GET_OK_and_assert_equal_expected_response(self, url, expected_data) def test_subtask_DELETE(self): st_test_data = test_data_creator.Subtask(cluster_url=self.cluster_url, task_blueprint_url=self.task_blueprint_url, specifications_template_url=self.specifications_template_url) @@ -352,7 +352,7 @@ class SubtaskTestCase(unittest.TestCase): # POST new item, verify r_dict = POST_and_assert_expected_response(self, BASE_URL + '/subtask/', st_test_data, 201, st_test_data) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, st_test_data) + GET_OK_and_assert_equal_expected_response(self, url, st_test_data) # DELETE and check it's gone DELETE_and_assert_gone(self, url) @@ -369,14 +369,14 @@ class SubtaskTestCase(unittest.TestCase): test_data = dict(st_test_data) test_data['state'] = state_url url = POST_and_assert_expected_response(self, BASE_URL + '/subtask/', test_data, 201, test_data)['url'] - GET_and_assert_equal_expected_response(self, url, 200, test_data) + GET_OK_and_assert_equal_expected_response(self, url, test_data) # Try to DELETE dependency, verify that was not successful # Unfortunately we don't get a nice error in json, but a Django debug page on error 500... response = requests.delete(state_url, auth=AUTH) self.assertEqual(500, response.status_code) self.assertTrue("ProtectedError" in str(response.content)) - GET_and_assert_equal_expected_response(self, state_url, 200, state_data) + GET_OK_and_assert_equal_expected_response(self, state_url, state_data) def test_subtask_SET_NULL_behavior_on_task_blueprint_deleted(self): # make new task_blueprint_url instance, but reuse related data for speed @@ -388,7 +388,7 @@ class SubtaskTestCase(unittest.TestCase): # POST new item and verify url = POST_and_assert_expected_response(self, BASE_URL + '/subtask/', st_test_data, 201, st_test_data)['url'] - GET_and_assert_equal_expected_response(self, url, 200, st_test_data) + GET_OK_and_assert_equal_expected_response(self, url, st_test_data) # DELETE dependency and check it's gone DELETE_and_assert_gone(self, task_blueprint_url) @@ -396,7 +396,7 @@ class SubtaskTestCase(unittest.TestCase): # assert item reference is set null expected_data = dict(st_test_data) expected_data['task_blueprint'] = None - GET_and_assert_equal_expected_response(self, url, 200, expected_data) + GET_OK_and_assert_equal_expected_response(self, url, expected_data) def test_subtask_PROTECT_behavior_on_template_deleted(self): stt_test_data = test_data_creator.SubtaskTemplate() @@ -405,14 +405,14 @@ class SubtaskTestCase(unittest.TestCase): # POST new item and verify url = POST_and_assert_expected_response(self, BASE_URL + '/subtask/', st_test_data, 201, st_test_data)['url'] - GET_and_assert_equal_expected_response(self, url, 200, st_test_data) + GET_OK_and_assert_equal_expected_response(self, url, st_test_data) # Try to DELETE dependency, verify that was not successful # Unfortunately we don't get a nice error in json, but a Django debug page on error 500... response = requests.delete(specifications_template_url, auth=AUTH) self.assertEqual(500, response.status_code) self.assertTrue("ProtectedError" in str(response.content)) - GET_and_assert_equal_expected_response(self, specifications_template_url, 200, stt_test_data) + GET_OK_and_assert_equal_expected_response(self, specifications_template_url, stt_test_data) def test_GET_Subtask_list_view_shows_entry(self): @@ -429,8 +429,8 @@ class SubtaskTestCase(unittest.TestCase): id1 = models.Subtask.objects.create(**test_data_1).id id2 = models.Subtask.objects.create(**test_data_2).id # assert - GET_and_assert_in_expected_response(self, BASE_URL + '/subtask/%s/' % id1, test_data_1) - GET_and_assert_in_expected_response(self, BASE_URL + '/subtask/%s/' % id2, test_data_2) + GET_OK_and_assert_equal_expected_response(self, BASE_URL + '/subtask/%s/' % id1, test_data_1) + GET_OK_and_assert_equal_expected_response(self, BASE_URL + '/subtask/%s/' % id2, test_data_2) def test_nested_Subtask_are_filtered_according_to_TaskBlueprint(self): @@ -451,7 +451,7 @@ class SubtaskTestCase(unittest.TestCase): # assert the returned list contains related items, a list of length 1 is retrieved GET_and_assert_in_expected_response_result_list(self, BASE_URL + '/task_blueprint/%s/subtask/' % task_blueprint_2.id, test_data_2, 1) # assert an existing related item is returned - GET_and_assert_in_expected_response(self, BASE_URL + '/task_blueprint/%s/subtask/%s/' % + GET_OK_and_assert_equal_expected_response(self, BASE_URL + '/task_blueprint/%s/subtask/%s/' % (task_blueprint_2.id, subtask_2.id), test_data_2) # assert an existing unrelated item is not returned GET_and_assert_equal_expected_code(self, @@ -463,24 +463,24 @@ class SubtaskTestCase(unittest.TestCase): # POST new item, verify r_dict = POST_and_assert_expected_response(self, BASE_URL + '/subtask/', st_test_data, 201, st_test_data) url = r_dict['url'] - GET_and_assert_expected_response(self, url, 200, st_test_data) + GET_OK_and_assert_equal_expected_response(self, url, st_test_data) # 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":1}) + GET_OK_and_assert_equal_expected_response(self, BASE_URL + '/subtask_state_log/?subtask=' + identifier, {"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": 1}) + GET_OK_and_assert_equal_expected_response(self, BASE_URL + '/subtask_state_log/?subtask=' + identifier, {"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": 2}) + GET_OK_and_assert_equal_expected_response(self, BASE_URL + '/subtask_state_log/?subtask=' + identifier, {"count": 2}) class DataproductTestCase(unittest.TestCase): @@ -496,7 +496,7 @@ class DataproductTestCase(unittest.TestCase): self.assertTrue("Dataproduct List" in r.content.decode('utf8')) def test_dataproduct_GET_nonexistant_raises_error(self): - GET_and_assert_equal_expected_response(self, BASE_URL + '/dataproduct/1234321/', 404, {}) + GET_and_assert_equal_expected_code(self, BASE_URL + '/dataproduct/1234321/', 404) def test_dataproduct_POST_and_GET(self): dp_test_data = test_data_creator.Dataproduct(specifications_template_url=self.specifications_template_url, subtask_output_url=self.subtask_output_url, dataproduct_feedback_template_url=self.dataproduct_feedback_template_url) @@ -504,7 +504,7 @@ class DataproductTestCase(unittest.TestCase): # POST and GET a new item and assert correctness r_dict = POST_and_assert_expected_response(self, BASE_URL + '/dataproduct/', dp_test_data, 201, dp_test_data) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, dp_test_data) + GET_OK_and_assert_equal_expected_response(self, url, dp_test_data) def test_dataproduct_PUT_invalid_raises_error(self): dp_test_data = test_data_creator.Dataproduct(specifications_template_url=self.specifications_template_url, subtask_output_url=self.subtask_output_url, dataproduct_feedback_template_url=self.dataproduct_feedback_template_url) @@ -518,11 +518,11 @@ class DataproductTestCase(unittest.TestCase): # POST new item, verify r_dict = POST_and_assert_expected_response(self, BASE_URL + '/dataproduct/', dp_test_data, 201, dp_test_data) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, dp_test_data) + GET_OK_and_assert_equal_expected_response(self, url, dp_test_data) # PUT new values, verify PUT_and_assert_expected_response(self, url, dp_test_data2, 200, dp_test_data2) - GET_and_assert_equal_expected_response(self, url, 200, dp_test_data2) + GET_OK_and_assert_equal_expected_response(self, url, dp_test_data2) def test_dataproduct_PATCH(self): dp_test_data = test_data_creator.Dataproduct(specifications_template_url=self.specifications_template_url, subtask_output_url=self.subtask_output_url, dataproduct_feedback_template_url=self.dataproduct_feedback_template_url) @@ -530,7 +530,7 @@ class DataproductTestCase(unittest.TestCase): # POST new item, verify r_dict = POST_and_assert_expected_response(self, BASE_URL + '/dataproduct/', dp_test_data, 201, dp_test_data) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, dp_test_data) + GET_OK_and_assert_equal_expected_response(self, url, dp_test_data) test_patch = {"filename": 'my_better.filename', "deleted_since": datetime.utcnow().isoformat()} @@ -539,7 +539,7 @@ class DataproductTestCase(unittest.TestCase): PATCH_and_assert_expected_response(self, url, test_patch, 200, test_patch) expected_data = dict(dp_test_data) expected_data.update(test_patch) - GET_and_assert_equal_expected_response(self, url, 200, expected_data) + GET_OK_and_assert_equal_expected_response(self, url, expected_data) def test_dataproduct_DELETE(self): dp_test_data = test_data_creator.Dataproduct(specifications_template_url=self.specifications_template_url, subtask_output_url=self.subtask_output_url, dataproduct_feedback_template_url=self.dataproduct_feedback_template_url) @@ -547,7 +547,7 @@ class DataproductTestCase(unittest.TestCase): # POST new item, verify r_dict = POST_and_assert_expected_response(self, BASE_URL + '/dataproduct/', dp_test_data, 201, dp_test_data) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, dp_test_data) + GET_OK_and_assert_equal_expected_response(self, url, dp_test_data) # DELETE and check it's gone DELETE_and_assert_gone(self, url) @@ -564,14 +564,14 @@ class DataproductTestCase(unittest.TestCase): test_data = dict(dp_test_data) test_data['dataformat'] = dataformat_url url = POST_and_assert_expected_response(self, BASE_URL + '/dataproduct/', test_data, 201, test_data)['url'] - GET_and_assert_equal_expected_response(self, url, 200, test_data) + GET_OK_and_assert_equal_expected_response(self, url, test_data) # Try to DELETE dependency, verify that was not successful # Unfortunately we don't get a nice error in json, but a Django debug page on error 500... response = requests.delete(dataformat_url, auth=AUTH) self.assertEqual(500, response.status_code) self.assertTrue("ProtectedError" in str(response.content)) - GET_and_assert_equal_expected_response(self, dataformat_url, 200, dataformat_data) + GET_OK_and_assert_equal_expected_response(self, dataformat_url, dataformat_data) def test_dataproduct_CASCADE_behavior_on_specifications_template_deleted(self): specifications_template_url = test_data_creator.post_data_and_get_url(test_data_creator.SubtaskTemplate(), '/dataproduct_specifications_template/') @@ -579,13 +579,13 @@ class DataproductTestCase(unittest.TestCase): # POST new item, verify url = POST_and_assert_expected_response(self, BASE_URL + '/dataproduct/', dp_test_data, 201, dp_test_data)['url'] - GET_and_assert_equal_expected_response(self, url, 200, dp_test_data) + GET_OK_and_assert_equal_expected_response(self, url, dp_test_data) # DELETE dependency and check it's gone DELETE_and_assert_gone(self, specifications_template_url) # assert item gone - GET_and_assert_equal_expected_response(self, url, 404, {}) + GET_and_assert_equal_expected_code(self, url, 404) def test_GET_Dataproduct_list_view_shows_entry(self): @@ -602,8 +602,8 @@ class DataproductTestCase(unittest.TestCase): id1 = models.Dataproduct.objects.create(**test_data_1).id id2 = models.Dataproduct.objects.create(**test_data_2).id # assert - GET_and_assert_in_expected_response(self, BASE_URL + '/dataproduct/%s/' % id1, test_data_1) - GET_and_assert_in_expected_response(self, BASE_URL + '/dataproduct/%s/' % id2, test_data_2) + GET_OK_and_assert_equal_expected_response(self, BASE_URL + '/dataproduct/%s/' % id1, test_data_1) + GET_OK_and_assert_equal_expected_response(self, BASE_URL + '/dataproduct/%s/' % id2, test_data_2) class SubtaskConnectorTestCase(unittest.TestCase): @@ -613,7 +613,7 @@ class SubtaskConnectorTestCase(unittest.TestCase): self.assertTrue("Subtask Connector List" in r.content.decode('utf8')) def test_subtask_connector_GET_nonexistant_raises_error(self): - GET_and_assert_equal_expected_response(self, BASE_URL + '/subtask_connector/1234321/', 404, {}) + GET_and_assert_equal_expected_code(self, BASE_URL + '/subtask_connector/1234321/', 404) def test_subtask_connector_POST_and_GET(self): stc_test_data = test_data_creator.SubtaskConnector() @@ -621,7 +621,7 @@ class SubtaskConnectorTestCase(unittest.TestCase): # POST and GET a new item and assert correctness r_dict = POST_and_assert_expected_response(self, BASE_URL + '/subtask_connector/', stc_test_data, 201, stc_test_data) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, stc_test_data) + GET_OK_and_assert_equal_expected_response(self, url, stc_test_data) def test_subtask_connector_PUT_invalid_raises_error(self): stc_test_data = test_data_creator.SubtaskConnector() @@ -635,11 +635,11 @@ class SubtaskConnectorTestCase(unittest.TestCase): # POST new item, verify r_dict = POST_and_assert_expected_response(self, BASE_URL + '/subtask_connector/', stc_test_data, 201, stc_test_data) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, stc_test_data) + GET_OK_and_assert_equal_expected_response(self, url, stc_test_data) # PUT new values, verify PUT_and_assert_expected_response(self, url, stc_test_data2, 200, stc_test_data2) - GET_and_assert_equal_expected_response(self, url, 200, stc_test_data2) + GET_OK_and_assert_equal_expected_response(self, url, stc_test_data2) def test_subtask_connector_PATCH(self): stc_test_data = test_data_creator.SubtaskConnector() @@ -647,7 +647,7 @@ class SubtaskConnectorTestCase(unittest.TestCase): # POST new item, verify r_dict = POST_and_assert_expected_response(self, BASE_URL + '/subtask_connector/', stc_test_data, 201, stc_test_data) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, stc_test_data) + GET_OK_and_assert_equal_expected_response(self, url, stc_test_data) test_patch = {"role": BASE_URL + '/role/calibrator/', "datatype": BASE_URL + '/datatype/quality/', } @@ -656,7 +656,7 @@ class SubtaskConnectorTestCase(unittest.TestCase): PATCH_and_assert_expected_response(self, url, test_patch, 200, test_patch) expected_data = dict(stc_test_data) expected_data.update(test_patch) - GET_and_assert_equal_expected_response(self, url, 200, expected_data) + GET_OK_and_assert_equal_expected_response(self, url, expected_data) def test_subtask_connector_DELETE(self): stc_test_data = test_data_creator.SubtaskConnector() @@ -664,7 +664,7 @@ class SubtaskConnectorTestCase(unittest.TestCase): # POST new item, verify r_dict = POST_and_assert_expected_response(self, BASE_URL + '/subtask_connector/', stc_test_data, 201, stc_test_data) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, stc_test_data) + GET_OK_and_assert_equal_expected_response(self, url, stc_test_data) # DELETE and check it's gone DELETE_and_assert_gone(self, url) @@ -682,14 +682,14 @@ class SubtaskConnectorTestCase(unittest.TestCase): test_data = dict(stc_test_data) test_data['role'] = role_url url = POST_and_assert_expected_response(self, BASE_URL + '/subtask_connector/', test_data, 201, test_data)['url'] - GET_and_assert_equal_expected_response(self, url, 200, test_data) + GET_OK_and_assert_equal_expected_response(self, url, test_data) # Try to DELETE dependency, verify that was not successful # Unfortunately we don't get a nice error in json, but a Django debug page on error 500... response = requests.delete(role_url, auth=AUTH) self.assertEqual(500, response.status_code) self.assertTrue("ProtectedError" in str(response.content)) - GET_and_assert_equal_expected_response(self, role_url, 200, role_data) + GET_OK_and_assert_equal_expected_response(self, role_url, role_data) def test_subtask_connector_PROTECT_behavior_on_datatype_deleted(self): stc_test_data = test_data_creator.SubtaskConnector() @@ -703,14 +703,14 @@ class SubtaskConnectorTestCase(unittest.TestCase): test_data = dict(stc_test_data) test_data['datatype'] = datatype_url url = POST_and_assert_expected_response(self, BASE_URL + '/subtask_connector/', test_data, 201, test_data)['url'] - GET_and_assert_equal_expected_response(self, url, 200, test_data) + GET_OK_and_assert_equal_expected_response(self, url, test_data) # Try to DELETE dependency, verify that was not successful # Unfortunately we don't get a nice error in json, but a Django debug page on error 500... response = requests.delete(datatype_url, auth=AUTH) self.assertEqual(500, response.status_code) self.assertTrue("ProtectedError" in str(response.content)) - GET_and_assert_equal_expected_response(self, datatype_url, 200, datatype_data) + GET_OK_and_assert_equal_expected_response(self, datatype_url, datatype_data) def test_GET_SubtaskConnector_list_view_shows_entry(self): @@ -727,8 +727,8 @@ class SubtaskConnectorTestCase(unittest.TestCase): id1 = models.SubtaskConnector.objects.create(**test_data_1).id id2 = models.SubtaskConnector.objects.create(**test_data_2).id # assert - GET_and_assert_in_expected_response(self, BASE_URL + '/subtask_connector/%s/' % id1, test_data_1) - GET_and_assert_in_expected_response(self, BASE_URL + '/subtask_connector/%s/' % id2, test_data_2) + GET_OK_and_assert_equal_expected_response(self, BASE_URL + '/subtask_connector/%s/' % id1, test_data_1) + GET_OK_and_assert_equal_expected_response(self, BASE_URL + '/subtask_connector/%s/' % id2, test_data_2) def test_SubtaskConnector_allows_setting_dataformats(self): """ @@ -742,7 +742,7 @@ class SubtaskConnectorTestCase(unittest.TestCase): models.Dataformat.objects.get(value='MeasurementSet')]) tior.save() # assert - GET_and_assert_in_expected_response(self, BASE_URL + '/subtask_connector/%s' % tior.id, test_data_2) + GET_OK_and_assert_equal_expected_response(self, BASE_URL + '/subtask_connector/%s' % tior.id, test_data_2) class SubtaskInputTestCase(unittest.TestCase): @@ -764,7 +764,7 @@ class SubtaskInputTestCase(unittest.TestCase): self.assertTrue("Subtask Input List" in r.content.decode('utf8')) def test_subtask_input_GET_nonexistant_raises_error(self): - GET_and_assert_equal_expected_response(self, BASE_URL + '/subtask_input/1234321/', 404, {}) + GET_and_assert_equal_expected_code(self, BASE_URL + '/subtask_input/1234321/', 404) def test_subtask_input_POST_and_GET(self): sti_test_data = test_data_creator.SubtaskInput(subtask_url=self.subtask_url, task_relation_blueprint_url=self.task_relation_blueprint_url, dataproduct_urls=self.dataproduct_urls, subtask_connector_url=self.subtask_connector_url, subtask_output_url=self.subtask_output_url, subtask_input_selection_template_url=self.subtask_input_selection_template_url) @@ -772,7 +772,7 @@ class SubtaskInputTestCase(unittest.TestCase): # POST and GET a new item and assert correctness r_dict = POST_and_assert_expected_response(self, BASE_URL + '/subtask_input/', sti_test_data, 201, sti_test_data) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, sti_test_data) + GET_OK_and_assert_equal_expected_response(self, url, sti_test_data) def test_subtask_input_PUT_invalid_raises_error(self): sti_test_data = test_data_creator.SubtaskInput(subtask_url=self.subtask_url, task_relation_blueprint_url=self.task_relation_blueprint_url, dataproduct_urls=self.dataproduct_urls, subtask_connector_url=self.subtask_connector_url, subtask_output_url=self.subtask_output_url, subtask_input_selection_template_url=self.subtask_input_selection_template_url) @@ -785,12 +785,12 @@ class SubtaskInputTestCase(unittest.TestCase): # POST new item, verify r_dict = POST_and_assert_expected_response(self, BASE_URL + '/subtask_input/', sti_test_data, 201, sti_test_data) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, sti_test_data) + GET_OK_and_assert_equal_expected_response(self, url, sti_test_data) # PUT new values, verify sti_test_data2 = test_data_creator.SubtaskInput(subtask_url=self.subtask_url, task_relation_blueprint_url=self.task_relation_blueprint_url, dataproduct_urls=self.dataproduct_urls, subtask_connector_url=self.subtask_connector_url, subtask_output_url=self.subtask_output_url, subtask_input_selection_template_url=self.subtask_input_selection_template_url) PUT_and_assert_expected_response(self, url, sti_test_data2, 200, sti_test_data2) - GET_and_assert_equal_expected_response(self, url, 200, sti_test_data2) + GET_OK_and_assert_equal_expected_response(self, url, sti_test_data2) def test_subtask_input_PATCH(self): sti_test_data = test_data_creator.SubtaskInput(subtask_url=self.subtask_url, task_relation_blueprint_url=self.task_relation_blueprint_url, dataproduct_urls=self.dataproduct_urls, subtask_connector_url=self.subtask_connector_url, subtask_output_url=self.subtask_output_url, subtask_input_selection_template_url=self.subtask_input_selection_template_url) @@ -798,7 +798,7 @@ class SubtaskInputTestCase(unittest.TestCase): # POST new item, verify r_dict = POST_and_assert_expected_response(self, BASE_URL + '/subtask_input/', sti_test_data, 201, sti_test_data) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, sti_test_data) + GET_OK_and_assert_equal_expected_response(self, url, sti_test_data) # make new subtask_url instance, but reuse related data for speed subtask_url = test_data_creator.post_data_and_get_url(test_data_creator.Subtask(cluster_url=self.subtask_data['cluster'], @@ -813,7 +813,7 @@ class SubtaskInputTestCase(unittest.TestCase): PATCH_and_assert_expected_response(self, url, test_patch, 200, test_patch) expected_data = dict(sti_test_data) expected_data.update(test_patch) - GET_and_assert_equal_expected_response(self, url, 200, expected_data) + GET_OK_and_assert_equal_expected_response(self, url, expected_data) def test_subtask_input_DELETE(self): sti_test_data = test_data_creator.SubtaskInput(subtask_url=self.subtask_url, task_relation_blueprint_url=self.task_relation_blueprint_url, dataproduct_urls=self.dataproduct_urls, subtask_connector_url=self.subtask_connector_url, subtask_output_url=self.subtask_output_url, subtask_input_selection_template_url=self.subtask_input_selection_template_url) @@ -821,7 +821,7 @@ class SubtaskInputTestCase(unittest.TestCase): # POST new item, verify r_dict = POST_and_assert_expected_response(self, BASE_URL + '/subtask_input/', sti_test_data, 201, sti_test_data) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, sti_test_data) + GET_OK_and_assert_equal_expected_response(self, url, sti_test_data) # DELETE and check it's gone DELETE_and_assert_gone(self, url) @@ -836,13 +836,13 @@ class SubtaskInputTestCase(unittest.TestCase): # POST new item, verify url = POST_and_assert_expected_response(self, BASE_URL + '/subtask_input/', sti_test_data, 201, sti_test_data)['url'] - GET_and_assert_equal_expected_response(self, url, 200, sti_test_data) + GET_OK_and_assert_equal_expected_response(self, url, sti_test_data) # DELETE dependency and check it's gone DELETE_and_assert_gone(self, subtask_url) # assert item gone - GET_and_assert_equal_expected_response(self, url, 404, {}) + GET_and_assert_equal_expected_code(self, url, 404) def test_subtask_input_SET_NULL_behavior_on_connector_deleted(self): subtask_connector_url = test_data_creator.post_data_and_get_url(test_data_creator.SubtaskConnector(), '/subtask_connector/') @@ -850,7 +850,7 @@ class SubtaskInputTestCase(unittest.TestCase): # POST new item, verify url = POST_and_assert_expected_response(self, BASE_URL + '/subtask_input/', sti_test_data, 201, sti_test_data)['url'] - GET_and_assert_equal_expected_response(self, url, 200, sti_test_data) + GET_OK_and_assert_equal_expected_response(self, url, sti_test_data) # DELETE dependency and check it's gone DELETE_and_assert_gone(self, subtask_connector_url) @@ -858,7 +858,7 @@ class SubtaskInputTestCase(unittest.TestCase): # assert item reference is set null expected_data = dict(sti_test_data) expected_data['connector'] = None - GET_and_assert_equal_expected_response(self, url, 200, expected_data) + GET_OK_and_assert_equal_expected_response(self, url, expected_data) def test_subtask_input_SET_NULL_behavior_on_task_relation_blueprint_deleted(self): # make new task_relation_blueprint instance, but reuse related data for speed @@ -869,7 +869,7 @@ class SubtaskInputTestCase(unittest.TestCase): # POST new item, verify url = POST_and_assert_expected_response(self, BASE_URL + '/subtask_input/', sti_test_data, 201, sti_test_data)['url'] - GET_and_assert_equal_expected_response(self, url, 200, sti_test_data) + GET_OK_and_assert_equal_expected_response(self, url, sti_test_data) # DELETE dependency and check it's gone DELETE_and_assert_gone(self, task_relation_blueprint_url) @@ -877,7 +877,7 @@ class SubtaskInputTestCase(unittest.TestCase): # assert item reference is set null expected_data = dict(sti_test_data) expected_data['task_relation_blueprint'] = None - GET_and_assert_equal_expected_response(self, url, 200, expected_data) + GET_OK_and_assert_equal_expected_response(self, url, expected_data) def test_subtask_input_PROTECT_behavior_on_producer_deleted(self): # make new subtask_output_url instance, but reuse related data for speed @@ -886,14 +886,14 @@ class SubtaskInputTestCase(unittest.TestCase): # POST with dependency url = POST_and_assert_expected_response(self, BASE_URL + '/subtask_input/', sti_test_data, 201, sti_test_data)['url'] - GET_and_assert_equal_expected_response(self, url, 200, sti_test_data) + GET_OK_and_assert_equal_expected_response(self, url, sti_test_data) # Try to DELETE dependency, verify that was not successful # Unfortunately we don't get a nice error in json, but a Django debug page on error 500... response = requests.delete(subtask_output_url, auth=AUTH) self.assertEqual(500, response.status_code) self.assertTrue("ProtectedError" in str(response.content)) - GET_and_assert_equal_expected_response(self, subtask_output_url, 200, {}) + GET_and_assert_equal_expected_code(self, subtask_output_url, 200) def test_subtask_input_PROTECT_behavior_on_selection_template_deleted(self): subtask_input_selection_template_url = test_data_creator.post_data_and_get_url(test_data_creator.SubtaskInputSelectionTemplate(), '/subtask_input_selection_template/') @@ -906,14 +906,14 @@ class SubtaskInputTestCase(unittest.TestCase): # POST with dependency url = POST_and_assert_expected_response(self, BASE_URL + '/subtask_input/', sti_test_data, 201, sti_test_data)['url'] - GET_and_assert_equal_expected_response(self, url, 200, sti_test_data) + GET_OK_and_assert_equal_expected_response(self, url, sti_test_data) # Try to DELETE dependency, verify that was not successful # Unfortunately we don't get a nice error in json, but a Django debug page on error 500... response = requests.delete(subtask_input_selection_template_url, auth=AUTH) self.assertEqual(500, response.status_code) self.assertTrue("ProtectedError" in str(response.content)) - GET_and_assert_equal_expected_response(self, subtask_input_selection_template_url, 200, {}) + GET_and_assert_equal_expected_code(self, subtask_input_selection_template_url, 200) def test_GET_SubtaskInput_list_view_shows_entry(self): @@ -930,8 +930,8 @@ class SubtaskInputTestCase(unittest.TestCase): id1 = models.SubtaskInput.objects.create(**test_data_1).id id2 = models.SubtaskInput.objects.create(**test_data_2).id # assert - GET_and_assert_in_expected_response(self, BASE_URL + '/subtask_input/%s/' % id1, test_data_1) - GET_and_assert_in_expected_response(self, BASE_URL + '/subtask_input/%s/' % id2, test_data_2) + GET_OK_and_assert_equal_expected_response(self, BASE_URL + '/subtask_input/%s/' % id1, test_data_1) + GET_OK_and_assert_equal_expected_response(self, BASE_URL + '/subtask_input/%s/' % id2, test_data_2) def test_SubtaskInput_allows_setting_dataproducts(self): @@ -944,7 +944,7 @@ class SubtaskInputTestCase(unittest.TestCase): models.Dataproduct.objects.create(**dpt_test_data_2)]) si.save() # assert - GET_and_assert_in_expected_response(self, BASE_URL + '/subtask_input/%s/' % si.id, test_data_1) + GET_OK_and_assert_equal_expected_response(self, BASE_URL + '/subtask_input/%s/' % si.id, test_data_1) class SubtaskOutputTestCase(unittest.TestCase): @@ -961,7 +961,7 @@ class SubtaskOutputTestCase(unittest.TestCase): self.assertTrue("Subtask Output List" in r.content.decode('utf8')) def test_subtask_output_GET_nonexistant_raises_error(self): - GET_and_assert_equal_expected_response(self, BASE_URL + '/subtask_output/1234321/', 404, {}) + GET_and_assert_equal_expected_code(self, BASE_URL + '/subtask_output/1234321/', 404) def test_subtask_output_POST_and_GET(self): sto_test_data = test_data_creator.SubtaskOutput(subtask_url=self.subtask_url, subtask_connector_url=self.subtask_connector_url) @@ -970,7 +970,7 @@ class SubtaskOutputTestCase(unittest.TestCase): r_dict = POST_and_assert_expected_response(self, BASE_URL + '/subtask_output/', sto_test_data, 201, sto_test_data) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, sto_test_data) + GET_OK_and_assert_equal_expected_response(self, url, sto_test_data) def test_subtask_output_PUT_invalid_raises_error(self): sto_test_data = test_data_creator.SubtaskOutput(subtask_url=self.subtask_url, subtask_connector_url=self.subtask_connector_url) @@ -983,11 +983,11 @@ class SubtaskOutputTestCase(unittest.TestCase): # POST new item, verify r_dict = POST_and_assert_expected_response(self, BASE_URL + '/subtask_output/', sto_test_data, 201,sto_test_data) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, sto_test_data) + GET_OK_and_assert_equal_expected_response(self, url, sto_test_data) # PUT new values, verify PUT_and_assert_expected_response(self, url, sto_test_data2, 200, sto_test_data2) - GET_and_assert_equal_expected_response(self, url, 200, sto_test_data2) + GET_OK_and_assert_equal_expected_response(self, url, sto_test_data2) def test_subtask_output_PATCH(self): sto_test_data = test_data_creator.SubtaskOutput(subtask_url=self.subtask_url, subtask_connector_url=self.subtask_connector_url) @@ -997,7 +997,7 @@ class SubtaskOutputTestCase(unittest.TestCase): r_dict = POST_and_assert_expected_response(self, BASE_URL + '/subtask_output/', sto_test_data, 201, sto_test_data) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, sto_test_data) + GET_OK_and_assert_equal_expected_response(self, url, sto_test_data) test_patch = {"subtask": sto_test_data2["subtask"], "tags": ['FANCYTAG'], } @@ -1006,7 +1006,7 @@ class SubtaskOutputTestCase(unittest.TestCase): PATCH_and_assert_expected_response(self, url, test_patch, 200, test_patch) expected_data = dict(sto_test_data) expected_data.update(test_patch) - GET_and_assert_equal_expected_response(self, url, 200, expected_data) + GET_OK_and_assert_equal_expected_response(self, url, expected_data) def test_subtask_output_DELETE(self): sto_test_data = test_data_creator.SubtaskOutput(subtask_url=self.subtask_url, subtask_connector_url=self.subtask_connector_url) @@ -1015,7 +1015,7 @@ class SubtaskOutputTestCase(unittest.TestCase): r_dict = POST_and_assert_expected_response(self, BASE_URL + '/subtask_output/', sto_test_data, 201, sto_test_data) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, sto_test_data) + GET_OK_and_assert_equal_expected_response(self, url, sto_test_data) # DELETE and check it's gone DELETE_and_assert_gone(self, url) @@ -1027,13 +1027,13 @@ class SubtaskOutputTestCase(unittest.TestCase): # POST new item, verify url = POST_and_assert_expected_response(self, BASE_URL + '/subtask_output/', sto_test_data, 201, sto_test_data)['url'] - GET_and_assert_equal_expected_response(self, url, 200, sto_test_data) + GET_OK_and_assert_equal_expected_response(self, url, sto_test_data) # DELETE dependency and check it's gone DELETE_and_assert_gone(self, subtask_url) # assert item gone - GET_and_assert_equal_expected_response(self, url, 404, {}) + GET_and_assert_equal_expected_code(self, url, 404) def test_subtask_output_SET_NULL_behavior_on_connector_deleted(self): sto_test_data = test_data_creator.SubtaskOutput(subtask_url=self.subtask_url, subtask_connector_url=self.subtask_connector_url) @@ -1042,7 +1042,7 @@ class SubtaskOutputTestCase(unittest.TestCase): url = \ POST_and_assert_expected_response(self, BASE_URL + '/subtask_output/', sto_test_data, 201, sto_test_data)[ 'url'] - GET_and_assert_equal_expected_response(self, url, 200, sto_test_data) + GET_OK_and_assert_equal_expected_response(self, url, sto_test_data) # DELETE dependency and check it's gone DELETE_and_assert_gone(self, sto_test_data['connector']) @@ -1050,7 +1050,7 @@ class SubtaskOutputTestCase(unittest.TestCase): # assert item reference is set null expected_data = dict(sto_test_data) expected_data['connector'] = None - GET_and_assert_equal_expected_response(self, url, 200, expected_data) + GET_OK_and_assert_equal_expected_response(self, url, expected_data) def test_GET_SubtaskOutput_list_view_shows_entry(self): @@ -1067,8 +1067,8 @@ class SubtaskOutputTestCase(unittest.TestCase): id1 = models.SubtaskOutput.objects.create(**test_data_1).id id2 = models.SubtaskOutput.objects.create(**test_data_2).id # assert - GET_and_assert_in_expected_response(self, BASE_URL + '/subtask_output/%s/' % id1, test_data_1) - GET_and_assert_in_expected_response(self, BASE_URL + '/subtask_output/%s/' % id2, test_data_2) + GET_OK_and_assert_equal_expected_response(self, BASE_URL + '/subtask_output/%s/' % id1, test_data_1) + GET_OK_and_assert_equal_expected_response(self, BASE_URL + '/subtask_output/%s/' % id2, test_data_2) class AntennaSetTestCase(unittest.TestCase): @@ -1078,7 +1078,7 @@ class AntennaSetTestCase(unittest.TestCase): self.assertTrue("Antenna Set List" in r.content.decode('utf8')) def test_antenna_set_GET_nonexistant_raises_error(self): - GET_and_assert_equal_expected_response(self, BASE_URL + '/antenna_set/1234321/', 404, {}) + GET_and_assert_equal_expected_code(self, BASE_URL + '/antenna_set/1234321/', 404) def test_antenna_set_POST_and_GET(self): antennaset_test_data = test_data_creator.AntennaSet() @@ -1086,7 +1086,7 @@ class AntennaSetTestCase(unittest.TestCase): # POST and GET a new item and assert correctness r_dict = POST_and_assert_expected_response(self, BASE_URL + '/antenna_set/', antennaset_test_data, 201, antennaset_test_data) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, antennaset_test_data) + GET_OK_and_assert_equal_expected_response(self, url, antennaset_test_data) def test_antenna_set_PUT_invalid_raises_error(self): antennaset_test_data = test_data_creator.AntennaSet() @@ -1100,11 +1100,11 @@ class AntennaSetTestCase(unittest.TestCase): # POST new item, verify r_dict = POST_and_assert_expected_response(self, BASE_URL + '/antenna_set/', antennaset_test_data, 201, antennaset_test_data) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, antennaset_test_data) + GET_OK_and_assert_equal_expected_response(self, url, antennaset_test_data) # PUT new values, verify PUT_and_assert_expected_response(self, url, antennaset_test_data2, 200, antennaset_test_data2) - GET_and_assert_equal_expected_response(self, url, 200, antennaset_test_data2) + GET_OK_and_assert_equal_expected_response(self, url, antennaset_test_data2) def test_antenna_set_PATCH(self): antennaset_test_data = test_data_creator.AntennaSet() @@ -1112,7 +1112,7 @@ class AntennaSetTestCase(unittest.TestCase): # POST new item, verify r_dict = POST_and_assert_expected_response(self, BASE_URL + '/antenna_set/', antennaset_test_data, 201, antennaset_test_data) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, antennaset_test_data) + GET_OK_and_assert_equal_expected_response(self, url, antennaset_test_data) test_patch = {"rcus": [11, 12, 13, 14, 15], "station_type": BASE_URL + '/station_type/remote/'} @@ -1121,7 +1121,7 @@ class AntennaSetTestCase(unittest.TestCase): PATCH_and_assert_expected_response(self, url, test_patch, 200, test_patch) expected_data = dict(antennaset_test_data) expected_data.update(test_patch) - GET_and_assert_equal_expected_response(self, url, 200, expected_data) + GET_OK_and_assert_equal_expected_response(self, url, expected_data) def test_antenna_set_DELETE(self): antennaset_test_data = test_data_creator.AntennaSet() @@ -1129,7 +1129,7 @@ class AntennaSetTestCase(unittest.TestCase): # POST new item, verify r_dict = POST_and_assert_expected_response(self, BASE_URL + '/antenna_set/', antennaset_test_data, 201, antennaset_test_data) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, antennaset_test_data) + GET_OK_and_assert_equal_expected_response(self, url, antennaset_test_data) # DELETE and check it's gone DELETE_and_assert_gone(self, url) @@ -1146,14 +1146,14 @@ class AntennaSetTestCase(unittest.TestCase): test_data = dict(antennaset_test_data) test_data['station_type'] = dataformat_url url = POST_and_assert_expected_response(self, BASE_URL + '/antenna_set/', test_data, 201, test_data)['url'] - GET_and_assert_equal_expected_response(self, url, 200, test_data) + GET_OK_and_assert_equal_expected_response(self, url, test_data) # Try to DELETE dependency, verify that was not successful # Unfortunately we don't get a nice error in json, but a Django debug page on error 500... response = requests.delete(dataformat_url, auth=AUTH) self.assertEqual(500, response.status_code) self.assertTrue("ProtectedError" in str(response.content)) - GET_and_assert_equal_expected_response(self, dataformat_url, 200, dataformat_data) + GET_OK_and_assert_equal_expected_response(self, dataformat_url, dataformat_data) def test_GET_AntennaSet_list_view_shows_entry(self): @@ -1170,8 +1170,8 @@ class AntennaSetTestCase(unittest.TestCase): id1 = models.AntennaSet.objects.create(**test_data_1).id id2 = models.AntennaSet.objects.create(**test_data_2).id # assert - GET_and_assert_in_expected_response(self, BASE_URL + '/antenna_set/%s/' % id1, test_data_1) - GET_and_assert_in_expected_response(self, BASE_URL + '/antenna_set/%s/' % id2, test_data_2) + GET_OK_and_assert_equal_expected_response(self, BASE_URL + '/antenna_set/%s/' % id1, test_data_1) + GET_OK_and_assert_equal_expected_response(self, BASE_URL + '/antenna_set/%s/' % id2, test_data_2) class DataproductTransformTestCase(unittest.TestCase): @@ -1188,7 +1188,7 @@ class DataproductTransformTestCase(unittest.TestCase): self.assertTrue("Dataproduct Transform List" in r.content.decode('utf8')) def test_dataproduct_transform_GET_nonexistant_raises_error(self): - GET_and_assert_equal_expected_response(self, BASE_URL + '/dataproduct_transform/1234321/', 404, {}) + GET_and_assert_equal_expected_code(self, BASE_URL + '/dataproduct_transform/1234321/', 404) def test_dataproduct_transform_POST_and_GET(self): dpt_test_data = test_data_creator.DataproductTransform(input_dataproduct_url=self.input_dataproduct_url, output_dataproduct_url=self.output_dataproduct_url) @@ -1196,7 +1196,7 @@ class DataproductTransformTestCase(unittest.TestCase): # POST and GET a new item and assert correctness r_dict = POST_and_assert_expected_response(self, BASE_URL + '/dataproduct_transform/', dpt_test_data, 201, dpt_test_data) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, dpt_test_data) + GET_OK_and_assert_equal_expected_response(self, url, dpt_test_data) def test_dataproduct_transform_PUT_invalid_raises_error(self): dpt_test_data = test_data_creator.DataproductTransform(input_dataproduct_url=self.input_dataproduct_url, output_dataproduct_url=self.output_dataproduct_url) @@ -1210,11 +1210,11 @@ class DataproductTransformTestCase(unittest.TestCase): # POST new item, verify r_dict = POST_and_assert_expected_response(self, BASE_URL + '/dataproduct_transform/', dpt_test_data, 201, dpt_test_data) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, dpt_test_data) + GET_OK_and_assert_equal_expected_response(self, url, dpt_test_data) # PUT new values, verify PUT_and_assert_expected_response(self, url, dpt_test_data2, 200, dpt_test_data2) - GET_and_assert_equal_expected_response(self, url, 200, dpt_test_data2) + GET_OK_and_assert_equal_expected_response(self, url, dpt_test_data2) def test_dataproduct_transform_PATCH(self): dpt_test_data = test_data_creator.DataproductTransform(input_dataproduct_url=self.input_dataproduct_url, output_dataproduct_url=self.output_dataproduct_url) @@ -1222,7 +1222,7 @@ class DataproductTransformTestCase(unittest.TestCase): # POST new item, verify r_dict = POST_and_assert_expected_response(self, BASE_URL + '/dataproduct_transform/', dpt_test_data, 201, dpt_test_data) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, dpt_test_data) + GET_OK_and_assert_equal_expected_response(self, url, dpt_test_data) # make new output_dataproduct_url instance, but reuse related data for speed output_dp_test_data = test_data_creator.Dataproduct(specifications_template_url=self.output_dataproduct_data['specifications_template'], @@ -1237,7 +1237,7 @@ class DataproductTransformTestCase(unittest.TestCase): PATCH_and_assert_expected_response(self, url, test_patch, 200, test_patch) expected_data = dict(dpt_test_data) expected_data.update(test_patch) - GET_and_assert_equal_expected_response(self, url, 200, expected_data) + GET_OK_and_assert_equal_expected_response(self, url, expected_data) def test_dataproduct_transform_DELETE(self): dpt_test_data = test_data_creator.DataproductTransform(input_dataproduct_url=self.input_dataproduct_url, output_dataproduct_url=self.output_dataproduct_url) @@ -1245,7 +1245,7 @@ class DataproductTransformTestCase(unittest.TestCase): # POST new item, verify r_dict = POST_and_assert_expected_response(self, BASE_URL + '/dataproduct_transform/', dpt_test_data, 201, dpt_test_data) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, dpt_test_data) + GET_OK_and_assert_equal_expected_response(self, url, dpt_test_data) # DELETE and check it's gone DELETE_and_assert_gone(self, url) @@ -1260,14 +1260,14 @@ class DataproductTransformTestCase(unittest.TestCase): # POST new item and verify url = POST_and_assert_expected_response(self, BASE_URL + '/dataproduct_transform/', dpt_test_data, 201, dpt_test_data)['url'] - GET_and_assert_equal_expected_response(self, url, 200, dpt_test_data) + GET_OK_and_assert_equal_expected_response(self, url, dpt_test_data) # Try to DELETE dependency, verify that was not successful # Unfortunately we don't get a nice error in json, but a Django debug page on error 500... response = requests.delete(input_dataproduct_url, auth=AUTH) self.assertEqual(500, response.status_code) self.assertTrue("ProtectedError" in str(response.content)) - GET_and_assert_equal_expected_response(self, input_dataproduct_url, 200, input_dp_test_data) + GET_OK_and_assert_equal_expected_response(self, input_dataproduct_url, input_dp_test_data) def test_dataproduct_transform_PROTECT_behavior_on_output_deleted(self): # make new output_dataproduct_url instance, but reuse related data for speed @@ -1279,14 +1279,14 @@ class DataproductTransformTestCase(unittest.TestCase): # POST new item and verify url = POST_and_assert_expected_response(self, BASE_URL + '/dataproduct_transform/', dpt_test_data, 201, dpt_test_data)['url'] - GET_and_assert_equal_expected_response(self, url, 200, dpt_test_data) + GET_OK_and_assert_equal_expected_response(self, url, dpt_test_data) # Try to DELETE dependency, verify that was not successful # Unfortunately we don't get a nice error in json, but a Django debug page on error 500... response = requests.delete(output_dataproduct_url, auth=AUTH) self.assertEqual(500, response.status_code) self.assertTrue("ProtectedError" in str(response.content)) - GET_and_assert_equal_expected_response(self, output_dataproduct_url, 200, output_dp_test_data) + GET_OK_and_assert_equal_expected_response(self, output_dataproduct_url, output_dp_test_data) def test_GET_DataproductTransform_list_view_shows_entry(self): @@ -1303,8 +1303,8 @@ class DataproductTransformTestCase(unittest.TestCase): id1 = models.DataproductTransform.objects.create(**test_data_1).id id2 = models.DataproductTransform.objects.create(**test_data_2).id # assert - GET_and_assert_in_expected_response(self, BASE_URL + '/dataproduct_transform/%s/' % id1, test_data_1) - GET_and_assert_in_expected_response(self, BASE_URL + '/dataproduct_transform/%s/' % id2, test_data_2) + GET_OK_and_assert_equal_expected_response(self, BASE_URL + '/dataproduct_transform/%s/' % id1, test_data_1) + GET_OK_and_assert_equal_expected_response(self, BASE_URL + '/dataproduct_transform/%s/' % id2, test_data_2) class FilesystemTestCase(unittest.TestCase): @@ -1314,7 +1314,7 @@ class FilesystemTestCase(unittest.TestCase): self.assertTrue("Filesystem List" in r.content.decode('utf8')) def test_filesystem_GET_nonexistant_raises_error(self): - GET_and_assert_equal_expected_response(self, BASE_URL + '/filesystem/1234321/', 404, {}) + GET_and_assert_equal_expected_code(self, BASE_URL + '/filesystem/1234321/', 404) def test_filesystem_POST_and_GET(self): fs_test_data = test_data_creator.Filesystem() @@ -1322,7 +1322,7 @@ class FilesystemTestCase(unittest.TestCase): # POST and GET a new item and assert correctness r_dict = POST_and_assert_expected_response(self, BASE_URL + '/filesystem/', fs_test_data, 201, fs_test_data) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, fs_test_data) + GET_OK_and_assert_equal_expected_response(self, url, fs_test_data) def test_filesystem_PUT_invalid_raises_error(self): fs_test_data = test_data_creator.Filesystem() @@ -1337,13 +1337,13 @@ class FilesystemTestCase(unittest.TestCase): r_dict = POST_and_assert_expected_response(self, BASE_URL + '/filesystem/', fs_test_data, 201, fs_test_data) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, fs_test_data) + GET_OK_and_assert_equal_expected_response(self, url, fs_test_data) fs_test_data2 = test_data_creator.Filesystem() # PUT new values, verify PUT_and_assert_expected_response(self, url, fs_test_data2, 200, fs_test_data2) - GET_and_assert_equal_expected_response(self, url, 200, fs_test_data2) + GET_OK_and_assert_equal_expected_response(self, url, fs_test_data2) def test_filesystem_PATCH(self): cluster_url = test_data_creator.post_data_and_get_url(test_data_creator.Cluster(), '/cluster/') @@ -1353,7 +1353,7 @@ class FilesystemTestCase(unittest.TestCase): r_dict = POST_and_assert_expected_response(self, BASE_URL + '/filesystem/', fs_test_data, 201, fs_test_data) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, fs_test_data) + GET_OK_and_assert_equal_expected_response(self, url, fs_test_data) cluster_url2 = test_data_creator.post_data_and_get_url(test_data_creator.Cluster(), '/cluster/') test_patch = {"cluster": cluster_url2, @@ -1363,7 +1363,7 @@ class FilesystemTestCase(unittest.TestCase): PATCH_and_assert_expected_response(self, url, test_patch, 200, test_patch) expected_data = dict(fs_test_data) expected_data.update(test_patch) - GET_and_assert_equal_expected_response(self, url, 200, expected_data) + GET_OK_and_assert_equal_expected_response(self, url, expected_data) def test_filesystem_DELETE(self): fs_test_data = test_data_creator.Filesystem() @@ -1372,7 +1372,7 @@ class FilesystemTestCase(unittest.TestCase): r_dict = POST_and_assert_expected_response(self, BASE_URL + '/filesystem/', fs_test_data, 201, fs_test_data) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, fs_test_data) + GET_OK_and_assert_equal_expected_response(self, url, fs_test_data) # DELETE and check it's gone DELETE_and_assert_gone(self, url) @@ -1383,14 +1383,14 @@ class FilesystemTestCase(unittest.TestCase): # POST new item and verify url = POST_and_assert_expected_response(self, BASE_URL + '/filesystem/', fs_test_data, 201, fs_test_data)['url'] - GET_and_assert_equal_expected_response(self, url, 200, fs_test_data) + GET_OK_and_assert_equal_expected_response(self, url, fs_test_data) # Try to DELETE dependency, verify that was not successful # Unfortunately we don't get a nice error in json, but a Django debug page on error 500... response = requests.delete(fs_test_data['cluster'], auth=AUTH) self.assertEqual(500, response.status_code) self.assertTrue("ProtectedError" in str(response.content)) - GET_and_assert_equal_expected_response(self, fs_test_data['cluster'], 200, {}) + GET_and_assert_equal_expected_code(self, fs_test_data['cluster'], 200) def test_GET_Filesystem_list_view_shows_entry(self): @@ -1407,8 +1407,8 @@ class FilesystemTestCase(unittest.TestCase): id1 = models.Filesystem.objects.create(**test_data_1).id id2 = models.Filesystem.objects.create(**test_data_2).id # assert - GET_and_assert_in_expected_response(self, BASE_URL + '/filesystem/%s/' % id1, test_data_1) - GET_and_assert_in_expected_response(self, BASE_URL + '/filesystem/%s/' % id2, test_data_2) + GET_OK_and_assert_equal_expected_response(self, BASE_URL + '/filesystem/%s/' % id1, test_data_1) + GET_OK_and_assert_equal_expected_response(self, BASE_URL + '/filesystem/%s/' % id2, test_data_2) class ClusterTestCase(unittest.TestCase): @@ -1418,7 +1418,7 @@ class ClusterTestCase(unittest.TestCase): self.assertTrue("Cluster List" in r.content.decode('utf8')) def test_cluster_GET_nonexistant_raises_error(self): - GET_and_assert_equal_expected_response(self, BASE_URL + '/cluster/1234321/', 404, {}) + GET_and_assert_equal_expected_code(self, BASE_URL + '/cluster/1234321/', 404) def test_cluster_POST_and_GET(self): c_test_data = test_data_creator.Cluster() @@ -1426,7 +1426,7 @@ class ClusterTestCase(unittest.TestCase): # POST and GET a new item and assert correctness r_dict = POST_and_assert_expected_response(self, BASE_URL + '/cluster/', c_test_data, 201, c_test_data) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, c_test_data) + GET_OK_and_assert_equal_expected_response(self, url, c_test_data) def test_cluster_PUT_invalid_raises_error(self): c_test_data = test_data_creator.Cluster() @@ -1438,13 +1438,13 @@ class ClusterTestCase(unittest.TestCase): # POST new item, verify r_dict = POST_and_assert_expected_response(self, BASE_URL + '/cluster/', c_test_data, 201, c_test_data) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, c_test_data) + GET_OK_and_assert_equal_expected_response(self, url, c_test_data) c_test_data2 = test_data_creator.Cluster() # PUT new values, verify PUT_and_assert_expected_response(self, url, c_test_data2, 200, c_test_data2) - GET_and_assert_equal_expected_response(self, url, 200, c_test_data2) + GET_OK_and_assert_equal_expected_response(self, url, c_test_data2) def test_cluster_PATCH(self): c_test_data = test_data_creator.Cluster() @@ -1452,7 +1452,7 @@ class ClusterTestCase(unittest.TestCase): # POST new item, verify r_dict = POST_and_assert_expected_response(self, BASE_URL + '/cluster/', c_test_data, 201, c_test_data) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, c_test_data) + GET_OK_and_assert_equal_expected_response(self, url, c_test_data) test_patch = {"location": 'at the other end of the universe'} @@ -1460,7 +1460,7 @@ class ClusterTestCase(unittest.TestCase): PATCH_and_assert_expected_response(self, url, test_patch, 200, test_patch) expected_data = dict(c_test_data) expected_data.update(test_patch) - GET_and_assert_equal_expected_response(self, url, 200, expected_data) + GET_OK_and_assert_equal_expected_response(self, url, expected_data) def test_cluster_DELETE(self): c_test_data = test_data_creator.Cluster() @@ -1468,7 +1468,7 @@ class ClusterTestCase(unittest.TestCase): # POST new item, verify r_dict = POST_and_assert_expected_response(self, BASE_URL + '/cluster/', c_test_data, 201, c_test_data) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, c_test_data) + GET_OK_and_assert_equal_expected_response(self, url, c_test_data) # DELETE and check it's gone DELETE_and_assert_gone(self, url) @@ -1488,8 +1488,8 @@ class ClusterTestCase(unittest.TestCase): id1 = models.Cluster.objects.create(**test_data_1).id id2 = models.Cluster.objects.create(**test_data_2).id # assert - GET_and_assert_in_expected_response(self, BASE_URL + '/cluster/%s/' % id1, test_data_1) - GET_and_assert_in_expected_response(self, BASE_URL + '/cluster/%s/' % id2, test_data_2) + GET_OK_and_assert_equal_expected_response(self, BASE_URL + '/cluster/%s/' % id1, test_data_1) + GET_OK_and_assert_equal_expected_response(self, BASE_URL + '/cluster/%s/' % id2, test_data_2) class DataproductHashTestCase(unittest.TestCase): @@ -1503,7 +1503,7 @@ class DataproductHashTestCase(unittest.TestCase): self.assertTrue("Dataproduct Hash List" in r.content.decode('utf8')) def test_dataproduct_hash_GET_nonexistant_raises_error(self): - GET_and_assert_equal_expected_response(self, BASE_URL + '/dataproduct_hash/1234321/', 404, {}) + GET_and_assert_equal_expected_code(self, BASE_URL + '/dataproduct_hash/1234321/', 404) def test_dataproduct_hash_POST_and_GET(self): dph_test_data = test_data_creator.DataproductHash(dataproduct_url=self.dataproduct_url) @@ -1512,7 +1512,7 @@ class DataproductHashTestCase(unittest.TestCase): r_dict = POST_and_assert_expected_response(self, BASE_URL + '/dataproduct_hash/', dph_test_data, 201, dph_test_data) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, dph_test_data) + GET_OK_and_assert_equal_expected_response(self, url, dph_test_data) def test_dataproduct_hash_PUT_invalid_raises_error(self): dph_test_data = test_data_creator.DataproductHash(dataproduct_url=self.dataproduct_url) @@ -1528,11 +1528,11 @@ class DataproductHashTestCase(unittest.TestCase): r_dict = POST_and_assert_expected_response(self, BASE_URL + '/dataproduct_hash/', dph_test_data, 201, dph_test_data) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, dph_test_data) + GET_OK_and_assert_equal_expected_response(self, url, dph_test_data) # PUT new values, verify PUT_and_assert_expected_response(self, url, dph_test_data2, 200, dph_test_data2) - GET_and_assert_equal_expected_response(self, url, 200, dph_test_data2) + GET_OK_and_assert_equal_expected_response(self, url, dph_test_data2) def test_dataproduct_hash_PATCH(self): dph_test_data = test_data_creator.DataproductHash(dataproduct_url=self.dataproduct_url) @@ -1541,7 +1541,7 @@ class DataproductHashTestCase(unittest.TestCase): r_dict = POST_and_assert_expected_response(self, BASE_URL + '/dataproduct_hash/', dph_test_data, 201, dph_test_data) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, dph_test_data) + GET_OK_and_assert_equal_expected_response(self, url, dph_test_data) test_patch = {"algorithm": BASE_URL + '/algorithm/aes256/', "hash": 'bender-was-here'} @@ -1550,7 +1550,7 @@ class DataproductHashTestCase(unittest.TestCase): PATCH_and_assert_expected_response(self, url, test_patch, 200, test_patch) expected_data = dict(dph_test_data) expected_data.update(test_patch) - GET_and_assert_equal_expected_response(self, url, 200, expected_data) + GET_OK_and_assert_equal_expected_response(self, url, expected_data) def test_dataproduct_hash_DELETE(self): dph_test_data = test_data_creator.DataproductHash(dataproduct_url=self.dataproduct_url) @@ -1559,7 +1559,7 @@ class DataproductHashTestCase(unittest.TestCase): r_dict = POST_and_assert_expected_response(self, BASE_URL + '/dataproduct_hash/', dph_test_data, 201, dph_test_data) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, dph_test_data) + GET_OK_and_assert_equal_expected_response(self, url, dph_test_data) # DELETE and check it's gone DELETE_and_assert_gone(self, url) @@ -1570,14 +1570,14 @@ class DataproductHashTestCase(unittest.TestCase): # POST new item and verify url = POST_and_assert_expected_response(self, BASE_URL + '/dataproduct_hash/', dph_test_data, 201, dph_test_data)['url'] - GET_and_assert_equal_expected_response(self, url, 200, dph_test_data) + GET_OK_and_assert_equal_expected_response(self, url, dph_test_data) # Try to DELETE dependency, verify that was not successful # Unfortunately we don't get a nice error in json, but a Django debug page on error 500... response = requests.delete(dph_test_data['dataproduct'], auth=AUTH) self.assertEqual(500, response.status_code) self.assertTrue("ProtectedError" in str(response.content)) - GET_and_assert_equal_expected_response(self, dph_test_data['dataproduct'], 200, {}) + GET_and_assert_equal_expected_code(self, dph_test_data['dataproduct'], 200) def test_dataproduct_hash_PROTECT_behavior_on_algorithm_deleted(self): dph_test_data = test_data_creator.DataproductHash(dataproduct_url=self.dataproduct_url) @@ -1585,14 +1585,14 @@ class DataproductHashTestCase(unittest.TestCase): # POST new item and verify url = POST_and_assert_expected_response(self, BASE_URL + '/dataproduct_hash/', dph_test_data, 201, dph_test_data)['url'] - GET_and_assert_equal_expected_response(self, url, 200, dph_test_data) + GET_OK_and_assert_equal_expected_response(self, url, dph_test_data) # Try to DELETE dependency, verify that was not successful # Unfortunately we don't get a nice error in json, but a Django debug page on error 500... response = requests.delete(dph_test_data['algorithm'], auth=AUTH) self.assertEqual(500, response.status_code) self.assertTrue("ProtectedError" in str(response.content)) - GET_and_assert_equal_expected_response(self, dph_test_data['algorithm'], 200, {}) + GET_and_assert_equal_expected_code(self, dph_test_data['algorithm'], 200) def test_GET_DataproductHash_list_view_shows_entry(self): @@ -1609,8 +1609,8 @@ class DataproductHashTestCase(unittest.TestCase): id1 = models.DataproductHash.objects.create(**test_data_1).id id2 = models.DataproductHash.objects.create(**test_data_2).id # assert - GET_and_assert_in_expected_response(self, BASE_URL + '/dataproduct_hash/%s/' % id1, test_data_1) - GET_and_assert_in_expected_response(self, BASE_URL + '/dataproduct_hash/%s/' % id2, test_data_2) + GET_OK_and_assert_equal_expected_response(self, BASE_URL + '/dataproduct_hash/%s/' % id1, test_data_1) + GET_OK_and_assert_equal_expected_response(self, BASE_URL + '/dataproduct_hash/%s/' % id2, test_data_2) class DataproductArchiveInfoTestCase(unittest.TestCase): @@ -1624,7 +1624,7 @@ class DataproductArchiveInfoTestCase(unittest.TestCase): self.assertTrue("Dataproduct Archive Info List" in r.content.decode('utf8')) def test_dataproduct_archive_info_GET_nonexistant_raises_error(self): - GET_and_assert_equal_expected_response(self, BASE_URL + '/dataproduct_archive_info/1234321/', 404, {}) + GET_and_assert_equal_expected_code(self, BASE_URL + '/dataproduct_archive_info/1234321/', 404) def test_dataproduct_archive_info_POST_and_GET(self): dpai_test_data = test_data_creator.DataproductArchiveInfo(dataproduct_url=self.dataproduct_url) @@ -1633,7 +1633,7 @@ class DataproductArchiveInfoTestCase(unittest.TestCase): r_dict = POST_and_assert_expected_response(self, BASE_URL + '/dataproduct_archive_info/', dpai_test_data, 201, dpai_test_data) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, dpai_test_data) + GET_OK_and_assert_equal_expected_response(self, url, dpai_test_data) def test_dataproduct_archive_info_PUT_invalid_raises_error(self): dpai_test_data = test_data_creator.DataproductArchiveInfo(dataproduct_url=self.dataproduct_url) @@ -1649,11 +1649,11 @@ class DataproductArchiveInfoTestCase(unittest.TestCase): r_dict = POST_and_assert_expected_response(self, BASE_URL + '/dataproduct_archive_info/', dpai_test_data, 201, dpai_test_data) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, dpai_test_data) + GET_OK_and_assert_equal_expected_response(self, url, dpai_test_data) # PUT new values, verify PUT_and_assert_expected_response(self, url, dpai_test_data2, 200, dpai_test_data2) - GET_and_assert_equal_expected_response(self, url, 200, dpai_test_data2) + GET_OK_and_assert_equal_expected_response(self, url, dpai_test_data2) def test_dataproduct_archive_info_PATCH(self): dpai_test_data = test_data_creator.DataproductArchiveInfo(dataproduct_url=self.dataproduct_url) @@ -1662,7 +1662,7 @@ class DataproductArchiveInfoTestCase(unittest.TestCase): r_dict = POST_and_assert_expected_response(self, BASE_URL + '/dataproduct_archive_info/', dpai_test_data, 201, dpai_test_data) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, dpai_test_data) + GET_OK_and_assert_equal_expected_response(self, url, dpai_test_data) test_patch = {"storage_ticket": "mygoldenticket"} @@ -1670,7 +1670,7 @@ class DataproductArchiveInfoTestCase(unittest.TestCase): PATCH_and_assert_expected_response(self, url, test_patch, 200, test_patch) expected_data = dict(dpai_test_data) expected_data.update(test_patch) - GET_and_assert_equal_expected_response(self, url, 200, expected_data) + GET_OK_and_assert_equal_expected_response(self, url, expected_data) def test_dataproduct_archive_info_DELETE(self): dpai_test_data = test_data_creator.DataproductArchiveInfo(dataproduct_url=self.dataproduct_url) @@ -1679,7 +1679,7 @@ class DataproductArchiveInfoTestCase(unittest.TestCase): r_dict = POST_and_assert_expected_response(self, BASE_URL + '/dataproduct_archive_info/', dpai_test_data, 201, dpai_test_data) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, dpai_test_data) + GET_OK_and_assert_equal_expected_response(self, url, dpai_test_data) # DELETE and check it's gone DELETE_and_assert_gone(self, url) @@ -1690,14 +1690,14 @@ class DataproductArchiveInfoTestCase(unittest.TestCase): # POST new item and verify url = POST_and_assert_expected_response(self, BASE_URL + '/dataproduct_archive_info/', dpai_test_data, 201, dpai_test_data)['url'] - GET_and_assert_equal_expected_response(self, url, 200, dpai_test_data) + GET_OK_and_assert_equal_expected_response(self, url, dpai_test_data) # Try to DELETE dependency, verify that was not successful # Unfortunately we don't get a nice error in json, but a Django debug page on error 500... response = requests.delete(dpai_test_data['dataproduct'], auth=AUTH) self.assertEqual(500, response.status_code) self.assertTrue("ProtectedError" in str(response.content)) - GET_and_assert_equal_expected_response(self, dpai_test_data['dataproduct'], 200, {}) + GET_and_assert_equal_expected_code(self, dpai_test_data['dataproduct'], 200) def test_GET_DataproductArchiveInfo_list_view_shows_entry(self): @@ -1714,8 +1714,8 @@ class DataproductArchiveInfoTestCase(unittest.TestCase): id1 = models.DataproductArchiveInfo.objects.create(**test_data_1).id id2 = models.DataproductArchiveInfo.objects.create(**test_data_2).id # assert - GET_and_assert_in_expected_response(self, BASE_URL + '/dataproduct_archive_info/%s/' % id1, test_data_1) - GET_and_assert_in_expected_response(self, BASE_URL + '/dataproduct_archive_info/%s/' % id2, test_data_2) + GET_OK_and_assert_equal_expected_response(self, BASE_URL + '/dataproduct_archive_info/%s/' % id1, test_data_1) + GET_OK_and_assert_equal_expected_response(self, BASE_URL + '/dataproduct_archive_info/%s/' % id2, test_data_2) class SubtaskQuery(unittest.TestCase): diff --git a/SAS/TMSS/test/t_tmssapp_specification_functional.py b/SAS/TMSS/test/t_tmssapp_specification_functional.py index abb2e9a216f62209dda82ca9115637dd4f243ab7..c8afc36ecaa9523937cf0f379a1b95d9c08009e1 100755 --- a/SAS/TMSS/test/t_tmssapp_specification_functional.py +++ b/SAS/TMSS/test/t_tmssapp_specification_functional.py @@ -60,14 +60,14 @@ class GeneratorTemplateTestCase(unittest.TestCase): self.assertTrue("Generator Template List" in r.content.decode('utf8')) def test_generator_template_GET_nonexistant_raises_error(self): - GET_and_assert_equal_expected_response(self, BASE_URL + '/generator_template/1234321/', 404, {}) + GET_and_assert_equal_expected_code(self, BASE_URL + '/generator_template/1234321/', 404) def test_generator_template_POST_and_GET(self): # POST and GET a new item and assert correctness r_dict = POST_and_assert_expected_response(self, BASE_URL + '/generator_template/', test_data_creator.GeneratorTemplate(), 201, test_data_creator.GeneratorTemplate()) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, test_data_creator.GeneratorTemplate()) + GET_OK_and_assert_equal_expected_response(self, url, test_data_creator.GeneratorTemplate()) def test_generator_template_PUT_invalid_raises_error(self): PUT_and_assert_expected_response(self, BASE_URL + '/generator_template/9876789876/', test_data_creator.GeneratorTemplate(), 404, {}) @@ -77,18 +77,18 @@ class GeneratorTemplateTestCase(unittest.TestCase): # POST new item, verify r_dict = POST_and_assert_expected_response(self, BASE_URL + '/generator_template/', test_data_creator.GeneratorTemplate(), 201, test_data_creator.GeneratorTemplate()) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, test_data_creator.GeneratorTemplate()) + GET_OK_and_assert_equal_expected_response(self, url, test_data_creator.GeneratorTemplate()) # PUT new values, verify PUT_and_assert_expected_response(self, url, test_data_creator.GeneratorTemplate("generatortemplate2"), 200, test_data_creator.GeneratorTemplate("generatortemplate2")) - GET_and_assert_equal_expected_response(self, url, 200, test_data_creator.GeneratorTemplate("generatortemplate2")) + GET_OK_and_assert_equal_expected_response(self, url, test_data_creator.GeneratorTemplate("generatortemplate2")) def test_generator_template_PATCH(self): # POST new item, verify r_dict = POST_and_assert_expected_response(self, BASE_URL + '/generator_template/', test_data_creator.GeneratorTemplate(), 201, test_data_creator.GeneratorTemplate()) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, test_data_creator.GeneratorTemplate()) + GET_OK_and_assert_equal_expected_response(self, url, test_data_creator.GeneratorTemplate()) test_patch = {"version": 'v6.28318530718', "schema": {"mykey": "my better value"}} @@ -97,14 +97,14 @@ class GeneratorTemplateTestCase(unittest.TestCase): PATCH_and_assert_expected_response(self, url, test_patch, 200, test_patch) expected_data = dict(test_data_creator.GeneratorTemplate()) expected_data.update(test_patch) - GET_and_assert_equal_expected_response(self, url, 200, expected_data) + GET_OK_and_assert_equal_expected_response(self, url, expected_data) def test_generator_template_DELETE(self): # POST new item, verify r_dict = POST_and_assert_expected_response(self, BASE_URL + '/generator_template/', test_data_creator.GeneratorTemplate(), 201, test_data_creator.GeneratorTemplate()) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, test_data_creator.GeneratorTemplate()) + GET_OK_and_assert_equal_expected_response(self, url, test_data_creator.GeneratorTemplate()) # DELETE and check it's gone DELETE_and_assert_gone(self, url) @@ -115,8 +115,8 @@ class GeneratorTemplateTestCase(unittest.TestCase): test_data_2 = GeneratorTemplate_test_data("test_generator_template_2") id1 = models.GeneratorTemplate.objects.create(**test_data_1).id id2 = models.GeneratorTemplate.objects.create(**test_data_2).id - GET_and_assert_in_expected_response(self, BASE_URL + '/generator_template/' + str(id1), test_data_1) - GET_and_assert_in_expected_response(self, BASE_URL + '/generator_template/' + str(id2), test_data_2) + GET_OK_and_assert_equal_expected_response(self, BASE_URL + '/generator_template/' + str(id1), test_data_1) + GET_OK_and_assert_equal_expected_response(self, BASE_URL + '/generator_template/' + str(id2), test_data_2) class SchedulingUnitTemplateTestCase(unittest.TestCase): @@ -126,14 +126,14 @@ class SchedulingUnitTemplateTestCase(unittest.TestCase): self.assertTrue("Scheduling Unit Template List" in r.content.decode('utf8')) def test_scheduling_unit_template_GET_nonexistant_raises_error(self): - GET_and_assert_equal_expected_response(self, BASE_URL + '/scheduling_unit_template/1234321/', 404, {}) + GET_and_assert_equal_expected_code(self, BASE_URL + '/scheduling_unit_template/1234321/', 404) def test_scheduling_unit_template_POST_and_GET(self): # POST and GET a new item and assert correctness r_dict = POST_and_assert_expected_response(self, BASE_URL + '/scheduling_unit_template/', test_data_creator.SchedulingUnitTemplate(), 201, test_data_creator.SchedulingUnitTemplate()) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url+'?format=json', 200, test_data_creator.SchedulingUnitTemplate()) + GET_OK_and_assert_equal_expected_response(self, url+'?format=json', test_data_creator.SchedulingUnitTemplate()) def test_scheduling_unit_template_PUT_invalid_raises_error(self): PUT_and_assert_expected_response(self, BASE_URL + '/scheduling_unit_template/9876789876/', test_data_creator.SchedulingUnitTemplate(), 404, {}) @@ -143,18 +143,18 @@ class SchedulingUnitTemplateTestCase(unittest.TestCase): # POST new item, verify r_dict = POST_and_assert_expected_response(self, BASE_URL + '/scheduling_unit_template/', test_data_creator.SchedulingUnitTemplate(), 201, test_data_creator.SchedulingUnitTemplate()) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, test_data_creator.SchedulingUnitTemplate()) + GET_OK_and_assert_equal_expected_response(self, url, test_data_creator.SchedulingUnitTemplate()) # PUT new values, verify PUT_and_assert_expected_response(self, url, test_data_creator.SchedulingUnitTemplate("schedulingunittemplate2"), 200, test_data_creator.SchedulingUnitTemplate("schedulingunittemplate2")) - GET_and_assert_equal_expected_response(self, url, 200, test_data_creator.SchedulingUnitTemplate("schedulingunittemplate2")) + GET_OK_and_assert_equal_expected_response(self, url, test_data_creator.SchedulingUnitTemplate("schedulingunittemplate2")) def test_scheduling_unit_template_PATCH(self): # POST new item, verify r_dict = POST_and_assert_expected_response(self, BASE_URL + '/scheduling_unit_template/', test_data_creator.SchedulingUnitTemplate(), 201, test_data_creator.SchedulingUnitTemplate()) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, test_data_creator.SchedulingUnitTemplate()) + GET_OK_and_assert_equal_expected_response(self, url, test_data_creator.SchedulingUnitTemplate()) test_patch = {"version": 'v6.28318530718', "schema": {"mykey": "my better value"}} @@ -163,14 +163,14 @@ class SchedulingUnitTemplateTestCase(unittest.TestCase): PATCH_and_assert_expected_response(self, url, test_patch, 200, test_patch) expected_data = dict(test_data_creator.SchedulingUnitTemplate()) expected_data.update(test_patch) - GET_and_assert_equal_expected_response(self, url, 200, expected_data) + GET_OK_and_assert_equal_expected_response(self, url, expected_data) def test_scheduling_unit_template_DELETE(self): # POST new item, verify r_dict = POST_and_assert_expected_response(self, BASE_URL + '/scheduling_unit_template/', test_data_creator.SchedulingUnitTemplate(), 201, test_data_creator.SchedulingUnitTemplate()) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, test_data_creator.SchedulingUnitTemplate()) + GET_OK_and_assert_equal_expected_response(self, url, test_data_creator.SchedulingUnitTemplate()) # DELETE and check it's gone DELETE_and_assert_gone(self, url) @@ -181,8 +181,8 @@ class SchedulingUnitTemplateTestCase(unittest.TestCase): test_data_2 = SchedulingUnitTemplate_test_data("scheduling_unit_template_2") id1 = models.SchedulingUnitTemplate.objects.create(**test_data_1).id id2 = models.SchedulingUnitTemplate.objects.create(**test_data_2).id - GET_and_assert_in_expected_response(self, BASE_URL + '/scheduling_unit_template/' + str(id1), test_data_1) - GET_and_assert_in_expected_response(self, BASE_URL + '/scheduling_unit_template/' + str(id2), test_data_2) + GET_OK_and_assert_equal_expected_response(self, BASE_URL + '/scheduling_unit_template/' + str(id1), test_data_1) + GET_OK_and_assert_equal_expected_response(self, BASE_URL + '/scheduling_unit_template/' + str(id2), test_data_2) class TaskTemplateTestCase(unittest.TestCase): @@ -193,14 +193,14 @@ class TaskTemplateTestCase(unittest.TestCase): self.assertTrue("Task Template List" in r.content.decode('utf8')) def test_task_template_GET_nonexistant_raises_error(self): - GET_and_assert_equal_expected_response(self, BASE_URL + '/task_template/1234321/', 404, {}) + GET_and_assert_equal_expected_code(self, BASE_URL + '/task_template/1234321/', 404) def test_task_template_POST_and_GET(self): # POST and GET a new item and assert correctness r_dict = POST_and_assert_expected_response(self, BASE_URL + '/task_template/', test_data_creator.TaskTemplate(), 201, test_data_creator.TaskTemplate()) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url + '?format=json', 200, test_data_creator.TaskTemplate()) + GET_OK_and_assert_equal_expected_response(self, url + '?format=json', test_data_creator.TaskTemplate()) def test_task_template_PUT_invalid_raises_error(self): PUT_and_assert_expected_response(self, BASE_URL + '/task_template/9876789876/', test_data_creator.TaskTemplate(), 404, {}) @@ -210,18 +210,18 @@ class TaskTemplateTestCase(unittest.TestCase): r_dict = POST_and_assert_expected_response(self, BASE_URL + '/task_template/', test_data_creator.TaskTemplate(), 201, test_data_creator.TaskTemplate()) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, test_data_creator.TaskTemplate()) + GET_OK_and_assert_equal_expected_response(self, url, test_data_creator.TaskTemplate()) # PUT new values, verify PUT_and_assert_expected_response(self, url, test_data_creator.TaskTemplate("tasktemplate2"), 200, test_data_creator.TaskTemplate("tasktemplate2")) - GET_and_assert_equal_expected_response(self, url, 200, test_data_creator.TaskTemplate("tasktemplate2")) + GET_OK_and_assert_equal_expected_response(self, url, test_data_creator.TaskTemplate("tasktemplate2")) def test_task_template_PATCH(self): # POST new item, verify r_dict = POST_and_assert_expected_response(self, BASE_URL + '/task_template/', test_data_creator.TaskTemplate(), 201, test_data_creator.TaskTemplate()) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, test_data_creator.TaskTemplate()) + GET_OK_and_assert_equal_expected_response(self, url, test_data_creator.TaskTemplate()) test_patch = {"version": 'v6.28318530718', "schema": {"mykey": "my better value"}, @@ -230,14 +230,14 @@ class TaskTemplateTestCase(unittest.TestCase): PATCH_and_assert_expected_response(self, url, test_patch, 200, test_patch) expected_data = dict(test_data_creator.TaskTemplate()) expected_data.update(test_patch) - GET_and_assert_equal_expected_response(self, url, 200, expected_data) + GET_OK_and_assert_equal_expected_response(self, url, expected_data) def test_task_template_DELETE(self): # POST new item, verify r_dict = POST_and_assert_expected_response(self, BASE_URL + '/task_template/', test_data_creator.TaskTemplate(), 201, test_data_creator.TaskTemplate()) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, test_data_creator.TaskTemplate()) + GET_OK_and_assert_equal_expected_response(self, url, test_data_creator.TaskTemplate()) # DELETE and check it's gone DELETE_and_assert_gone(self, url) @@ -248,8 +248,8 @@ class TaskTemplateTestCase(unittest.TestCase): test_data_2 = TaskTemplate_test_data("task_template_2") id1 = models.TaskTemplate.objects.create(**test_data_1).id id2 = models.TaskTemplate.objects.create(**test_data_2).id - GET_and_assert_in_expected_response(self, BASE_URL + '/task_template/' + str(id1), test_data_1) - GET_and_assert_in_expected_response(self, BASE_URL + '/task_template/' + str(id2), test_data_2) + GET_OK_and_assert_equal_expected_response(self, BASE_URL + '/task_template/' + str(id1), test_data_1) + GET_OK_and_assert_equal_expected_response(self, BASE_URL + '/task_template/' + str(id2), test_data_2) class WorkRelationSelectionTemplateTestCase(unittest.TestCase): @@ -259,14 +259,14 @@ class WorkRelationSelectionTemplateTestCase(unittest.TestCase): self.assertTrue("Work Relation Selection Template List" in r.content.decode('utf8')) def test_work_relation_selection_template_GET_nonexistant_raises_error(self): - GET_and_assert_equal_expected_response(self, BASE_URL + '/work_relation_selection_template/1234321/', 404, {}) + GET_and_assert_equal_expected_code(self, BASE_URL + '/work_relation_selection_template/1234321/', 404) def test_work_relation_selection_template_POST_and_GET(self): # POST and GET a new item and assert correctness r_dict = POST_and_assert_expected_response(self, BASE_URL + '/work_relation_selection_template/', test_data_creator.WorkRelationSelectionTemplate(), 201, test_data_creator.WorkRelationSelectionTemplate()) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url+'?format=json', 200, test_data_creator.WorkRelationSelectionTemplate()) + GET_OK_and_assert_equal_expected_response(self, url+'?format=json', test_data_creator.WorkRelationSelectionTemplate()) def test_work_relation_selection_template_PUT_invalid_raises_error(self): PUT_and_assert_expected_response(self, BASE_URL + '/work_relation_selection_template/9876789876/', test_data_creator.WorkRelationSelectionTemplate(), 404, {}) @@ -276,18 +276,18 @@ class WorkRelationSelectionTemplateTestCase(unittest.TestCase): # POST new item, verify r_dict = POST_and_assert_expected_response(self, BASE_URL + '/work_relation_selection_template/', test_data_creator.WorkRelationSelectionTemplate(), 201, test_data_creator.WorkRelationSelectionTemplate()) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, test_data_creator.WorkRelationSelectionTemplate()) + GET_OK_and_assert_equal_expected_response(self, url, test_data_creator.WorkRelationSelectionTemplate()) # PUT new values, verify PUT_and_assert_expected_response(self, url, test_data_creator.WorkRelationSelectionTemplate("workrelationselectiontemplate2"), 200, test_data_creator.WorkRelationSelectionTemplate("workrelationselectiontemplate2")) - GET_and_assert_equal_expected_response(self, url, 200, test_data_creator.WorkRelationSelectionTemplate("workrelationselectiontemplate2")) + GET_OK_and_assert_equal_expected_response(self, url, test_data_creator.WorkRelationSelectionTemplate("workrelationselectiontemplate2")) def test_work_relation_selection_template_PATCH(self): # POST new item, verify r_dict = POST_and_assert_expected_response(self, BASE_URL + '/work_relation_selection_template/', test_data_creator.WorkRelationSelectionTemplate(), 201, test_data_creator.WorkRelationSelectionTemplate()) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, test_data_creator.WorkRelationSelectionTemplate()) + GET_OK_and_assert_equal_expected_response(self, url, test_data_creator.WorkRelationSelectionTemplate()) test_patch = {"version": 'v6.28318530718', "schema": {"mykey": "my better value"}, @@ -297,14 +297,14 @@ class WorkRelationSelectionTemplateTestCase(unittest.TestCase): PATCH_and_assert_expected_response(self, url, test_patch, 200, test_patch) expected_data = dict(test_data_creator.WorkRelationSelectionTemplate()) expected_data.update(test_patch) - GET_and_assert_equal_expected_response(self, url, 200, expected_data) + GET_OK_and_assert_equal_expected_response(self, url, expected_data) def test_work_relation_selection_template_DELETE(self): # POST new item, verify r_dict = POST_and_assert_expected_response(self, BASE_URL + '/work_relation_selection_template/', test_data_creator.WorkRelationSelectionTemplate(), 201, test_data_creator.WorkRelationSelectionTemplate()) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, test_data_creator.WorkRelationSelectionTemplate()) + GET_OK_and_assert_equal_expected_response(self, url, test_data_creator.WorkRelationSelectionTemplate()) # DELETE and check it's gone DELETE_and_assert_gone(self, url) @@ -315,8 +315,8 @@ class WorkRelationSelectionTemplateTestCase(unittest.TestCase): test_data_2 = WorkRelationSelectionTemplate_test_data("work_relation_selection_template_2") id1 = models.WorkRelationSelectionTemplate.objects.create(**test_data_1).id id2 = models.WorkRelationSelectionTemplate.objects.create(**test_data_2).id - GET_and_assert_in_expected_response(self, BASE_URL + '/work_relation_selection_template/' + str(id1), test_data_1) - GET_and_assert_in_expected_response(self, BASE_URL + '/work_relation_selection_template/' + str(id2), test_data_2) + GET_OK_and_assert_equal_expected_response(self, BASE_URL + '/work_relation_selection_template/' + str(id1), test_data_1) + GET_OK_and_assert_equal_expected_response(self, BASE_URL + '/work_relation_selection_template/' + str(id2), test_data_2) class TaskConnectorsTestCase(unittest.TestCase): @@ -331,14 +331,14 @@ class TaskConnectorsTestCase(unittest.TestCase): self.assertTrue("Task Connectors List" in r.content.decode('utf8')) def test_task_connectors_GET_nonexistant_raises_error(self): - GET_and_assert_equal_expected_response(self, BASE_URL + '/task_connectors/1234321/', 404, {}) + GET_and_assert_equal_expected_code(self, BASE_URL + '/task_connectors/1234321/', 404) def test_task_connectors_POST_and_GET(self): tc_test_data = test_data_creator.TaskConnectors(input_of_url=self.input_of_url, output_of_url=self.output_of_url) # POST and GET a new item and assert correctness r_dict = POST_and_assert_expected_response(self, BASE_URL + '/task_connectors/', tc_test_data, 201, tc_test_data) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, tc_test_data) + GET_OK_and_assert_equal_expected_response(self, url, tc_test_data) def test_task_connectors_POST_invalid_role_raises_error(self): @@ -401,11 +401,11 @@ class TaskConnectorsTestCase(unittest.TestCase): # POST new item, verify r_dict = POST_and_assert_expected_response(self, BASE_URL + '/task_connectors/', tc_test_data1, 201, tc_test_data1) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, tc_test_data1) + GET_OK_and_assert_equal_expected_response(self, url, tc_test_data1) # PUT new values, verify PUT_and_assert_expected_response(self, url, tc_test_data2, 200, tc_test_data2) - GET_and_assert_equal_expected_response(self, url, 200, tc_test_data2) + GET_OK_and_assert_equal_expected_response(self, url, tc_test_data2) def test_task_connectors_PATCH(self): tc_test_data = test_data_creator.TaskConnectors(input_of_url=self.input_of_url, output_of_url=self.output_of_url) @@ -413,7 +413,7 @@ class TaskConnectorsTestCase(unittest.TestCase): # POST new item, verify r_dict = POST_and_assert_expected_response(self, BASE_URL + '/task_connectors/', tc_test_data, 201, tc_test_data) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, tc_test_data) + GET_OK_and_assert_equal_expected_response(self, url, tc_test_data) test_patch = {"role": BASE_URL + '/role/calibrator/', "dataformats": [BASE_URL + '/dataformat/Beamformed/', @@ -423,7 +423,7 @@ class TaskConnectorsTestCase(unittest.TestCase): PATCH_and_assert_expected_response(self, url, test_patch, 200, test_patch) expected_data = dict(tc_test_data) expected_data.update(test_patch) - GET_and_assert_equal_expected_response(self, url, 200, expected_data) + GET_OK_and_assert_equal_expected_response(self, url, expected_data) def test_task_connectors_DELETE(self): tc_test_data = test_data_creator.TaskConnectors(input_of_url=self.input_of_url, output_of_url=self.output_of_url) @@ -431,7 +431,7 @@ class TaskConnectorsTestCase(unittest.TestCase): # POST new item, verify r_dict = POST_and_assert_expected_response(self, BASE_URL + '/task_connectors/', tc_test_data, 201, tc_test_data) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, tc_test_data) + GET_OK_and_assert_equal_expected_response(self, url, tc_test_data) # DELETE and check it's gone DELETE_and_assert_gone(self, url) @@ -442,11 +442,11 @@ class TaskConnectorsTestCase(unittest.TestCase): # POST new item url = POST_and_assert_expected_response(self, BASE_URL + '/task_connectors/', tc_test_data, 201, tc_test_data)['url'] # verify - GET_and_assert_equal_expected_response(self, url, 200, tc_test_data) + GET_OK_and_assert_equal_expected_response(self, url, tc_test_data) # DELETE dependency DELETE_and_assert_gone(self, input_of_url) # assert - GET_and_assert_equal_expected_response(self, url, 404, {}) + GET_and_assert_equal_expected_code(self, url, 404) def test_task_relation_blueprint_CASCADE_behavior_on_outputs_template_deleted(self): output_of_url = test_data_creator.post_data_and_get_url(test_data_creator.TaskTemplate(), '/task_template/') @@ -454,11 +454,11 @@ class TaskConnectorsTestCase(unittest.TestCase): # POST new item url = POST_and_assert_expected_response(self, BASE_URL + '/task_connectors/', tc_test_data, 201, tc_test_data)['url'] # verify - GET_and_assert_equal_expected_response(self, url, 200, tc_test_data) + GET_OK_and_assert_equal_expected_response(self, url, tc_test_data) # DELETE dependency DELETE_and_assert_gone(self, output_of_url) # assert - GET_and_assert_equal_expected_response(self, url, 404, {}) + GET_and_assert_equal_expected_code(self, url, 404) def test_GET_task_connectors_view_returns_correct_entry(self): @@ -466,8 +466,8 @@ class TaskConnectorsTestCase(unittest.TestCase): test_data_2 = TaskConnectors_test_data() id1 = models.TaskConnectors.objects.create(**test_data_1).id id2 = models.TaskConnectors.objects.create(**test_data_2).id - GET_and_assert_in_expected_response(self, BASE_URL + '/task_connectors/' + str(id1), test_data_1) - GET_and_assert_in_expected_response(self, BASE_URL + '/task_connectors/' + str(id2), test_data_2) + GET_OK_and_assert_equal_expected_response(self, BASE_URL + '/task_connectors/' + str(id1), test_data_1) + GET_OK_and_assert_equal_expected_response(self, BASE_URL + '/task_connectors/' + str(id2), test_data_2) class DefaultTemplates(unittest.TestCase): @@ -527,7 +527,7 @@ class DefaultTemplates(unittest.TestCase): response = requests.delete(template_url, auth=AUTH) self.assertEqual(500, response.status_code) self.assertTrue("ProtectedError" in str(response.content)) - GET_and_assert_equal_expected_response(self, template_url, 200, test_data_creator.GeneratorTemplate()) + GET_OK_and_assert_equal_expected_response(self, template_url, test_data_creator.GeneratorTemplate()) def test_default_scheduling_unit_template_PROTECT_behavior_on_template_deleted(self): @@ -545,7 +545,7 @@ class DefaultTemplates(unittest.TestCase): response = requests.delete(template_url, auth=AUTH) self.assertEqual(500, response.status_code) self.assertTrue("ProtectedError" in str(response.content)) - GET_and_assert_equal_expected_response(self, template_url, 200, test_data_creator.SchedulingUnitTemplate()) + GET_OK_and_assert_equal_expected_response(self, template_url, test_data_creator.SchedulingUnitTemplate()) def test_default_task_template_PROTECT_behavior_on_template_deleted(self): @@ -563,7 +563,7 @@ class DefaultTemplates(unittest.TestCase): response = requests.delete(template_url, auth=AUTH) self.assertEqual(500, response.status_code) self.assertTrue("ProtectedError" in str(response.content)) - GET_and_assert_equal_expected_response(self, template_url, 200, test_data_creator.TaskTemplate()) + GET_OK_and_assert_equal_expected_response(self, template_url, test_data_creator.TaskTemplate()) def test_default_work_relation_selection_template_PROTECT_behavior_on_template_deleted(self): @@ -581,7 +581,7 @@ class DefaultTemplates(unittest.TestCase): response = requests.delete(template_url, auth=AUTH) self.assertEqual(500, response.status_code) self.assertTrue("ProtectedError" in str(response.content)) - GET_and_assert_equal_expected_response(self, template_url, 200, test_data_creator.WorkRelationSelectionTemplate()) + GET_OK_and_assert_equal_expected_response(self, template_url, test_data_creator.WorkRelationSelectionTemplate()) class CycleTestCase(unittest.TestCase): @@ -591,7 +591,7 @@ class CycleTestCase(unittest.TestCase): self.assertTrue("Cycle List" in r.content.decode('utf8')) def test_cycle_GET_nonexistant_raises_error(self): - GET_and_assert_equal_expected_response(self, BASE_URL + '/cycle/1234321/', 404, {}) + GET_and_assert_equal_expected_code(self, BASE_URL + '/cycle/1234321/', 404) def test_cycle_POST_and_GET(self): @@ -599,7 +599,7 @@ class CycleTestCase(unittest.TestCase): cycle_test_data = test_data_creator.Cycle() r_dict = POST_and_assert_expected_response(self, BASE_URL + '/cycle/', cycle_test_data, 201, cycle_test_data) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, cycle_test_data) + GET_OK_and_assert_equal_expected_response(self, url, cycle_test_data) def test_cycle_PUT_invalid_raises_error(self): PUT_and_assert_expected_response(self, BASE_URL + '/cycle/9876789876/', test_data_creator.Cycle(), 404, {}) @@ -610,20 +610,20 @@ class CycleTestCase(unittest.TestCase): # POST new item, verify r_dict = POST_and_assert_expected_response(self, BASE_URL + '/cycle/', cycle_test_data, 201, cycle_test_data) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, cycle_test_data) + GET_OK_and_assert_equal_expected_response(self, url, cycle_test_data) # PUT new values, verify test_data = dict(test_data_creator.Cycle("other description")) test_data['name'] = cycle_test_data['name'] # since name is PK, need to keep that unchanged PUT_and_assert_expected_response(self, url, test_data, 200, test_data) - GET_and_assert_equal_expected_response(self, url, 200, test_data) + GET_OK_and_assert_equal_expected_response(self, url, test_data) def test_cycle_PATCH(self): cycle_test_data = test_data_creator.Cycle() # POST new item, verify r_dict = POST_and_assert_expected_response(self, BASE_URL + '/cycle/', cycle_test_data, 201, cycle_test_data) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, cycle_test_data) + GET_OK_and_assert_equal_expected_response(self, url, cycle_test_data) test_patch = {"start": datetime(year=2015, month=10, day=21).isoformat()} @@ -631,14 +631,14 @@ class CycleTestCase(unittest.TestCase): PATCH_and_assert_expected_response(self, url, test_patch, 200, test_patch) expected_data = dict(cycle_test_data) expected_data.update(test_patch) - GET_and_assert_equal_expected_response(self, url, 200, expected_data) + GET_OK_and_assert_equal_expected_response(self, url, expected_data) def test_cycle_DELETE(self): cycle_test_data = test_data_creator.Cycle() # POST new item, verify r_dict = POST_and_assert_expected_response(self, BASE_URL + '/cycle/', cycle_test_data, 201, cycle_test_data) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, cycle_test_data) + GET_OK_and_assert_equal_expected_response(self, url, cycle_test_data) # DELETE and check it's gone DELETE_and_assert_gone(self, url) @@ -655,8 +655,8 @@ class CycleTestCase(unittest.TestCase): test_data_2 = Cycle_test_data() id1 = models.Cycle.objects.create(**test_data_1).name # name is pk id2 = models.Cycle.objects.create(**test_data_2).name # name is pk - GET_and_assert_in_expected_response(self, BASE_URL + '/cycle/' + str(id1), test_data_1) - GET_and_assert_in_expected_response(self, BASE_URL + '/cycle/' + str(id2), test_data_2) + GET_OK_and_assert_equal_expected_response(self, BASE_URL + '/cycle/' + str(id1), test_data_1) + GET_OK_and_assert_equal_expected_response(self, BASE_URL + '/cycle/' + str(id2), test_data_2) def test_cycle_contains_list_of_releated_projects(self): @@ -671,7 +671,7 @@ class CycleTestCase(unittest.TestCase): project2 = models.Project.objects.create(**project_test_data_2) project2.cycle = cycle project2.save() - response_data = GET_and_assert_in_expected_response(self, BASE_URL + '/cycle/' + cycle.name, cycle_test_data_1) + response_data = GET_OK_and_assert_equal_expected_response(self, BASE_URL + '/cycle/' + cycle.name, cycle_test_data_1) assertUrlList(self, response_data['projects'], [project1, project2]) @@ -682,7 +682,7 @@ class ProjectTestCase(unittest.TestCase): self.assertTrue("Project List" in r.content.decode('utf8')) def test_project_GET_nonexistant_raises_error(self): - GET_and_assert_equal_expected_response(self, BASE_URL + '/project/1234321/', 404, {}) + GET_and_assert_equal_expected_code(self, BASE_URL + '/project/1234321/', 404) def test_project_POST_and_GET(self): project_test_data = test_data_creator.Project() @@ -690,7 +690,7 @@ class ProjectTestCase(unittest.TestCase): # POST and GET a new item and assert correctness r_dict = POST_and_assert_expected_response(self, BASE_URL + '/project/', project_test_data, 201, project_test_data) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, project_test_data) + GET_OK_and_assert_equal_expected_response(self, url, project_test_data) def test_project_PUT_invalid_raises_error(self): PUT_and_assert_expected_response(self, BASE_URL + '/project/9876789876/', test_data_creator.Project(), 404, {}) @@ -701,13 +701,13 @@ class ProjectTestCase(unittest.TestCase): # POST new item, verify r_dict = POST_and_assert_expected_response(self, BASE_URL + '/project/', project_test_data, 201, project_test_data) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, project_test_data) + GET_OK_and_assert_equal_expected_response(self, url, project_test_data) # PUT new values, verify test_data = dict(test_data_creator.Project("other description")) test_data['name'] = project_test_data['name'] # since name is PK, need to keep that unchanged PUT_and_assert_expected_response(self, url, test_data, 200, test_data) - GET_and_assert_equal_expected_response(self, url, 200, test_data) + GET_OK_and_assert_equal_expected_response(self, url, test_data) def test_project_PATCH(self): project_test_data = test_data_creator.Project() @@ -715,7 +715,7 @@ class ProjectTestCase(unittest.TestCase): # POST new item, verify r_dict = POST_and_assert_expected_response(self, BASE_URL + '/project/', project_test_data, 201, project_test_data) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, project_test_data) + GET_OK_and_assert_equal_expected_response(self, url, project_test_data) test_patch = {"priority": 500, "tags": ["SUPERIMPORTANT"]} @@ -724,7 +724,7 @@ class ProjectTestCase(unittest.TestCase): PATCH_and_assert_expected_response(self, url, test_patch, 200, test_patch) expected_data = dict(project_test_data) expected_data.update(test_patch) - GET_and_assert_equal_expected_response(self, url, 200, expected_data) + GET_OK_and_assert_equal_expected_response(self, url, expected_data) def test_project_DELETE(self): project_test_data = test_data_creator.Project() @@ -732,7 +732,7 @@ class ProjectTestCase(unittest.TestCase): # POST new item, verify r_dict = POST_and_assert_expected_response(self, BASE_URL + '/project/', project_test_data, 201, project_test_data) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, project_test_data) + GET_OK_and_assert_equal_expected_response(self, url, project_test_data) # DELETE and check it's gone DELETE_and_assert_gone(self, url) @@ -747,7 +747,7 @@ class ProjectTestCase(unittest.TestCase): url = POST_and_assert_expected_response(self, BASE_URL + '/project/', test_data, 201, test_data)['url'] # verify - GET_and_assert_equal_expected_response(self, url, 200, test_data) + GET_OK_and_assert_equal_expected_response(self, url, test_data) # add project reference to cycle test data (we make Django add that to the cycle in serializer) cycle_test_data['projects'] = [url] # add the @@ -757,7 +757,7 @@ class ProjectTestCase(unittest.TestCase): response = requests.delete(cycle_url, auth=AUTH) self.assertEqual(500, response.status_code) self.assertTrue("ProtectedError" in str(response.content)) - GET_and_assert_equal_expected_response(self, cycle_url, 200, cycle_test_data) + GET_OK_and_assert_equal_expected_response(self, cycle_url, cycle_test_data) def test_GET_project_list_shows_entry(self): @@ -772,8 +772,8 @@ class ProjectTestCase(unittest.TestCase): test_data_2 = Project_test_data() id1 = models.Project.objects.create(**test_data_1).name # name is pk id2 = models.Project.objects.create(**test_data_2).name - GET_and_assert_in_expected_response(self, BASE_URL + '/project/' + str(id1), test_data_1) - GET_and_assert_in_expected_response(self, BASE_URL + '/project/' + str(id2), test_data_2) + GET_OK_and_assert_equal_expected_response(self, BASE_URL + '/project/' + str(id1), test_data_1) + GET_OK_and_assert_equal_expected_response(self, BASE_URL + '/project/' + str(id2), test_data_2) def test_nested_projects_are_filtered_according_to_cycle(self): @@ -788,7 +788,7 @@ class ProjectTestCase(unittest.TestCase): # assert the returned list contains related items, A list of length 1 is retrieved GET_and_assert_in_expected_response_result_list(self, BASE_URL + '/cycle/%s/project/' % cycle_2.name, test_data_2, 1) # assert an existing related item is returned, name is pk - GET_and_assert_in_expected_response(self, BASE_URL + '/cycle/%s/project/%s' % (cycle_2.name, project_2.name), test_data_2) + GET_OK_and_assert_equal_expected_response(self, BASE_URL + '/cycle/%s/project/%s' % (cycle_2.name, project_2.name), test_data_2) # assert an existing unrelated item is not returned, name is pk GET_and_assert_equal_expected_code(self, BASE_URL + '/cycle/%s/project/%s' % (cycle_2.name, project_1.name), 404) @@ -800,7 +800,7 @@ class SchedulingSetTestCase(unittest.TestCase): self.assertTrue("Scheduling Set List" in r.content.decode('utf8')) def test_scheduling_set_GET_nonexistant_raises_error(self): - GET_and_assert_equal_expected_response(self, BASE_URL + '/scheduling_set/1234321/', 404, {}) + GET_and_assert_equal_expected_code(self, BASE_URL + '/scheduling_set/1234321/', 404) def test_scheduling_set_POST_and_GET(self): schedulingset_test_data = test_data_creator.SchedulingSet() @@ -808,7 +808,7 @@ class SchedulingSetTestCase(unittest.TestCase): # POST and GET a new item and assert correctness r_dict = POST_and_assert_expected_response(self, BASE_URL + '/scheduling_set/', schedulingset_test_data, 201, schedulingset_test_data) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, schedulingset_test_data) + GET_OK_and_assert_equal_expected_response(self, url, schedulingset_test_data) def test_scheduling_set_PUT_invalid_raises_error(self): schedulingset_test_data = test_data_creator.SchedulingSet() @@ -821,12 +821,12 @@ class SchedulingSetTestCase(unittest.TestCase): # POST new item, verify r_dict = POST_and_assert_expected_response(self, BASE_URL + '/scheduling_set/', schedulingset_test_data, 201, schedulingset_test_data) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, schedulingset_test_data) + GET_OK_and_assert_equal_expected_response(self, url, schedulingset_test_data) schedulingset_test_data2 = test_data_creator.SchedulingSet("schedulingset2", project_url=project_url) # PUT new values, verify PUT_and_assert_expected_response(self, url, schedulingset_test_data2, 200, schedulingset_test_data2) - GET_and_assert_equal_expected_response(self, url, 200, schedulingset_test_data2) + GET_OK_and_assert_equal_expected_response(self, url, schedulingset_test_data2) def test_scheduling_set_PATCH(self): schedulingset_test_data = test_data_creator.SchedulingSet() @@ -834,7 +834,7 @@ class SchedulingSetTestCase(unittest.TestCase): # POST new item, verify r_dict = POST_and_assert_expected_response(self, BASE_URL + '/scheduling_set/', schedulingset_test_data, 201, schedulingset_test_data) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, schedulingset_test_data) + GET_OK_and_assert_equal_expected_response(self, url, schedulingset_test_data) test_patch = {"description": "This is a new and improved description", "generator_doc": "{'para': 'meter'}"} @@ -843,7 +843,7 @@ class SchedulingSetTestCase(unittest.TestCase): PATCH_and_assert_expected_response(self, url, test_patch, 200, test_patch) expected_data = dict(schedulingset_test_data) expected_data.update(test_patch) - GET_and_assert_equal_expected_response(self, url, 200, expected_data) + GET_OK_and_assert_equal_expected_response(self, url, expected_data) def test_scheduling_set_DELETE(self): schedulingset_test_data = test_data_creator.SchedulingSet() @@ -851,25 +851,25 @@ class SchedulingSetTestCase(unittest.TestCase): # POST new item, verify r_dict = POST_and_assert_expected_response(self, BASE_URL + '/scheduling_set/', schedulingset_test_data, 201, schedulingset_test_data) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, schedulingset_test_data) + GET_OK_and_assert_equal_expected_response(self, url, schedulingset_test_data) # DELETE and check it's gone DELETE_and_assert_gone(self, url) def test_scheduling_set_PROTECT_behavior_on_project_deleted(self): project_url = test_data_creator.post_data_and_get_url(test_data_creator.Project(), '/project/') - project_test_data = GET_and_assert_equal_expected_response(self, project_url, 200, {}) + project_test_data = GET_and_assert_equal_expected_code(self, project_url, 200) schedulingset_test_data = test_data_creator.SchedulingSet(project_url=project_url) # POST new item url = POST_and_assert_expected_response(self, BASE_URL + '/scheduling_set/', schedulingset_test_data, 201, schedulingset_test_data)['url'] # verify - GET_and_assert_equal_expected_response(self, url, 200, schedulingset_test_data) + GET_OK_and_assert_equal_expected_response(self, url, schedulingset_test_data) # Try to DELETE dependency, verify that was not successful # Unfortunately we don't get a nice error in json, but a Django debug page on error 500... response = requests.delete(project_url, auth=AUTH) self.assertEqual(500, response.status_code) self.assertTrue("ProtectedError" in str(response.content)) - GET_and_assert_equal_expected_response(self, project_url, 200, project_test_data) + GET_OK_and_assert_equal_expected_response(self, project_url, project_test_data) def test_scheduling_set_SET_NULL_behavior_on_generator_template_deleted(self): generator_template_url = test_data_creator.post_data_and_get_url(test_data_creator.GeneratorTemplate(), '/generator_template/') @@ -878,12 +878,12 @@ class SchedulingSetTestCase(unittest.TestCase): test_data = dict(schedulingset_test_data) url = POST_and_assert_expected_response(self, BASE_URL + '/scheduling_set/', test_data, 201, test_data)['url'] # verify - GET_and_assert_equal_expected_response(self, url, 200, test_data) + GET_OK_and_assert_equal_expected_response(self, url, test_data) # DELETE dependency DELETE_and_assert_gone(self, generator_template_url) # assert test_data['generator_template'] = None - GET_and_assert_equal_expected_response(self, url, 200, test_data) + GET_OK_and_assert_equal_expected_response(self, url, test_data) def test_GET_SchedulingSet_list_shows_entry(self): @@ -898,8 +898,8 @@ class SchedulingSetTestCase(unittest.TestCase): test_data_2 = SchedulingSet_test_data() id1 = models.SchedulingSet.objects.create(**test_data_1).id id2 = models.SchedulingSet.objects.create(**test_data_2).id - GET_and_assert_in_expected_response(self, BASE_URL + '/scheduling_set/' + str(id1), test_data_1) - GET_and_assert_in_expected_response(self, BASE_URL + '/scheduling_set/' + str(id2), test_data_2) + GET_OK_and_assert_equal_expected_response(self, BASE_URL + '/scheduling_set/' + str(id1), test_data_1) + GET_OK_and_assert_equal_expected_response(self, BASE_URL + '/scheduling_set/' + str(id2), test_data_2) def test_SchedulingSet_contains_list_of_releated_SchedulingUnitDraft(self): @@ -911,7 +911,7 @@ class SchedulingSetTestCase(unittest.TestCase): scheduling_unit_draft_2 = models.SchedulingUnitDraft.objects.create(**SchedulingUnitDraft_test_data("scheduler draft one")) scheduling_unit_draft_2.scheduling_set = scheduling_set scheduling_unit_draft_2.save() - response_data = GET_and_assert_in_expected_response(self, BASE_URL + '/scheduling_set/%d' % scheduling_set.id, test_data_1) + response_data = GET_OK_and_assert_equal_expected_response(self, BASE_URL + '/scheduling_set/%d' % scheduling_set.id, test_data_1) assertUrlList(self, response_data['scheduling_unit_drafts'], [scheduling_unit_draft_1, scheduling_unit_draft_2]) @@ -927,7 +927,7 @@ class SchedulingUnitDraftTestCase(unittest.TestCase): self.assertTrue("Scheduling Unit Draft List" in r.content.decode('utf8')) def test_scheduling_unit_draft_GET_nonexistant_raises_error(self): - GET_and_assert_equal_expected_response(self, BASE_URL + '/scheduling_unit_draft/1234321/', 404, {}) + GET_and_assert_equal_expected_code(self, BASE_URL + '/scheduling_unit_draft/1234321/', 404) def test_scheduling_unit_draft_POST_and_GET(self): schedulingunitdraft_test_data = test_data_creator.SchedulingUnitDraft(scheduling_set_url=self.scheduling_set_url, template_url=self.template_url) @@ -935,7 +935,7 @@ class SchedulingUnitDraftTestCase(unittest.TestCase): # POST and GET a new item and assert correctness r_dict = POST_and_assert_expected_response(self, BASE_URL + '/scheduling_unit_draft/', schedulingunitdraft_test_data, 201, schedulingunitdraft_test_data) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, schedulingunitdraft_test_data) + GET_OK_and_assert_equal_expected_response(self, url, schedulingunitdraft_test_data) def test_scheduling_unit_draft_PUT_invalid_raises_error(self): schedulingunitdraft_test_data = test_data_creator.SchedulingUnitDraft(scheduling_set_url=self.scheduling_set_url, template_url=self.template_url) @@ -947,13 +947,13 @@ class SchedulingUnitDraftTestCase(unittest.TestCase): # POST new item, verify r_dict = POST_and_assert_expected_response(self, BASE_URL + '/scheduling_unit_draft/', schedulingunitdraft_test_data, 201, schedulingunitdraft_test_data) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, schedulingunitdraft_test_data) + GET_OK_and_assert_equal_expected_response(self, url, schedulingunitdraft_test_data) schedulingunitdraft_test_data2 = test_data_creator.SchedulingUnitDraft("my_scheduling_unit_draft2", scheduling_set_url=self.scheduling_set_url, template_url=self.template_url) # PUT new values, verify PUT_and_assert_expected_response(self, url, schedulingunitdraft_test_data2, 200, schedulingunitdraft_test_data2) - GET_and_assert_equal_expected_response(self, url, 200, schedulingunitdraft_test_data2) + GET_OK_and_assert_equal_expected_response(self, url, schedulingunitdraft_test_data2) def test_scheduling_unit_draft_PATCH(self): schedulingunitdraft_test_data = test_data_creator.SchedulingUnitDraft(scheduling_set_url=self.scheduling_set_url, template_url=self.template_url) @@ -961,7 +961,7 @@ class SchedulingUnitDraftTestCase(unittest.TestCase): # POST new item, verify r_dict = POST_and_assert_expected_response(self, BASE_URL + '/scheduling_unit_draft/', schedulingunitdraft_test_data, 201, schedulingunitdraft_test_data) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, schedulingunitdraft_test_data) + GET_OK_and_assert_equal_expected_response(self, url, schedulingunitdraft_test_data) test_patch = {"description": "This is a new and improved description", "requirements_doc": "{'para': 'meter'}"} @@ -970,7 +970,7 @@ class SchedulingUnitDraftTestCase(unittest.TestCase): PATCH_and_assert_expected_response(self, url, test_patch, 200, test_patch) expected_data = dict(schedulingunitdraft_test_data) expected_data.update(test_patch) - GET_and_assert_equal_expected_response(self, url, 200, expected_data) + GET_OK_and_assert_equal_expected_response(self, url, expected_data) def test_scheduling_unit_draft_DELETE(self): schedulingunitdraft_test_data = test_data_creator.SchedulingUnitDraft(scheduling_set_url=self.scheduling_set_url, template_url=self.template_url) @@ -978,7 +978,7 @@ class SchedulingUnitDraftTestCase(unittest.TestCase): # POST new item, verify r_dict = POST_and_assert_expected_response(self, BASE_URL + '/scheduling_unit_draft/', schedulingunitdraft_test_data, 201, schedulingunitdraft_test_data) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, schedulingunitdraft_test_data) + GET_OK_and_assert_equal_expected_response(self, url, schedulingunitdraft_test_data) # DELETE and check it's gone DELETE_and_assert_gone(self, url) @@ -989,11 +989,11 @@ class SchedulingUnitDraftTestCase(unittest.TestCase): # POST new item url = POST_and_assert_expected_response(self, BASE_URL + '/scheduling_unit_draft/', schedulingunitdraft_test_data, 201, schedulingunitdraft_test_data)['url'] # verify - GET_and_assert_equal_expected_response(self, url, 200, schedulingunitdraft_test_data) + GET_OK_and_assert_equal_expected_response(self, url, schedulingunitdraft_test_data) # DELETE dependency DELETE_and_assert_gone(self, template_url) # assert - GET_and_assert_equal_expected_response(self, url, 404, {}) + GET_and_assert_equal_expected_code(self, url, 404) def test_scheduling_unit_draft_CASCADE_behavior_on_scheduling_set_deleted(self): scheduling_set_url = test_data_creator.post_data_and_get_url(test_data_creator.SchedulingSet(), '/scheduling_set/') @@ -1001,11 +1001,11 @@ class SchedulingUnitDraftTestCase(unittest.TestCase): # POST new item url = POST_and_assert_expected_response(self, BASE_URL + '/scheduling_unit_draft/', schedulingunitdraft_test_data, 201, schedulingunitdraft_test_data)['url'] # verify - GET_and_assert_equal_expected_response(self, url, 200, schedulingunitdraft_test_data) + GET_OK_and_assert_equal_expected_response(self, url, schedulingunitdraft_test_data) # DELETE dependency DELETE_and_assert_gone(self, scheduling_set_url) # assert - GET_and_assert_equal_expected_response(self, url, 404, {}) + GET_and_assert_equal_expected_code(self, url, 404) def test_scheduling_unit_draft_SET_NULL_behavior_on_copies_deleted(self): schedulingunitdraft_test_data = test_data_creator.SchedulingUnitDraft(scheduling_set_url=self.scheduling_set_url, template_url=self.template_url) @@ -1016,12 +1016,12 @@ class SchedulingUnitDraftTestCase(unittest.TestCase): test_data['copies'] = copy_url url = POST_and_assert_expected_response(self, BASE_URL + '/scheduling_unit_draft/', test_data, 201, test_data)['url'] # verify - GET_and_assert_equal_expected_response(self, url, 200, test_data) + GET_OK_and_assert_equal_expected_response(self, url, test_data) # DELETE dependency DELETE_and_assert_gone(self, copy_url) # assert test_data['copies'] = None - GET_and_assert_equal_expected_response(self, url, 200, test_data) + GET_OK_and_assert_equal_expected_response(self, url, test_data) def test_GET_SchedulingUnitDraft_list_view_shows_entry(self): @@ -1036,8 +1036,8 @@ class SchedulingUnitDraftTestCase(unittest.TestCase): test_data_2 = SchedulingUnitDraft_test_data("scheduler unit draft one two") id1 = models.SchedulingUnitDraft.objects.create(**test_data_1).id id2 = models.SchedulingUnitDraft.objects.create(**test_data_2).id - GET_and_assert_in_expected_response(self, BASE_URL + '/scheduling_unit_draft/%s/' % id1, test_data_1) - GET_and_assert_in_expected_response(self, BASE_URL + '/scheduling_unit_draft/%s/' % id2, test_data_2) + GET_OK_and_assert_equal_expected_response(self, BASE_URL + '/scheduling_unit_draft/%s/' % id1, test_data_1) + GET_OK_and_assert_equal_expected_response(self, BASE_URL + '/scheduling_unit_draft/%s/' % id2, test_data_2) def test_nested_SchedulingUnitDraft_are_filtered_according_to_SchedulingSet(self): # setup @@ -1058,7 +1058,7 @@ class SchedulingUnitDraftTestCase(unittest.TestCase): GET_and_assert_in_expected_response_result_list(self, BASE_URL + '/scheduling_set/%s/scheduling_unit_draft/' % scheduling_set_2.id, test_data_2, 1) # assert an existing related item is returned - GET_and_assert_in_expected_response(self, BASE_URL + '/scheduling_set/%s/scheduling_unit_draft/%s/' % + GET_OK_and_assert_equal_expected_response(self, BASE_URL + '/scheduling_set/%s/scheduling_unit_draft/%s/' % (scheduling_set_2.id, scheduling_unit_draft_2.id), test_data_2) # assert an existing unrelated item is not returned GET_and_assert_equal_expected_code(self, BASE_URL + '/scheduling_set/%s/scheduling_unit_draft/%s/' % @@ -1078,7 +1078,7 @@ class SchedulingUnitDraftTestCase(unittest.TestCase): scheduling_unit_blueprint_2.draft = scheduling_unit_draft scheduling_unit_blueprint_2.save() # assert - response_data = GET_and_assert_in_expected_response(self, BASE_URL + '/scheduling_unit_draft/%s/' % scheduling_unit_draft.id, test_data_1) + response_data = GET_OK_and_assert_equal_expected_response(self, BASE_URL + '/scheduling_unit_draft/%s/' % scheduling_unit_draft.id, test_data_1) assertUrlList(self, response_data['related_scheduling_unit_blueprint'], [scheduling_unit_blueprint_1, scheduling_unit_blueprint_2]) def test_SchedulingUnitDraft_contains_list_of_related_TaskDraft(self): @@ -1095,7 +1095,7 @@ class SchedulingUnitDraftTestCase(unittest.TestCase): task_draft_2.scheduling_unit_draft = scheduling_unit_draft task_draft_2.save() # assert - response_data = GET_and_assert_in_expected_response(self, BASE_URL + '/scheduling_unit_draft/%s/' % + response_data = GET_OK_and_assert_equal_expected_response(self, BASE_URL + '/scheduling_unit_draft/%s/' % scheduling_unit_draft.id, test_data_1) assertUrlList(self, response_data['task_drafts'], [task_draft_1, task_draft_2]) @@ -1112,7 +1112,7 @@ class TaskDraftTestCase(unittest.TestCase): self.assertTrue("Task Draft List" in r.content.decode('utf8')) def test_task_draft_GET_nonexistant_raises_error(self): - GET_and_assert_equal_expected_response(self, BASE_URL + '/task_draft/1234321/', 404, {}) + GET_and_assert_equal_expected_code(self, BASE_URL + '/task_draft/1234321/', 404) def test_task_draft_POST_and_GET(self): taskdraft_test_data = test_data_creator.TaskDraft(scheduling_unit_draft_url=self.scheduling_unit_draft_url, template_url=self.template_url) @@ -1120,7 +1120,7 @@ class TaskDraftTestCase(unittest.TestCase): # POST and GET a new item and assert correctness r_dict = POST_and_assert_expected_response(self, BASE_URL + '/task_draft/', taskdraft_test_data, 201, taskdraft_test_data) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, taskdraft_test_data) + GET_OK_and_assert_equal_expected_response(self, url, taskdraft_test_data) def test_task_draft_PUT_invalid_raises_error(self): taskdraft_test_data = test_data_creator.TaskDraft(scheduling_unit_draft_url=self.scheduling_unit_draft_url, template_url=self.template_url) @@ -1133,11 +1133,11 @@ class TaskDraftTestCase(unittest.TestCase): # POST new item, verify r_dict = POST_and_assert_expected_response(self, BASE_URL + '/task_draft/', taskdraft_test_data1, 201, taskdraft_test_data1) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, taskdraft_test_data1) + GET_OK_and_assert_equal_expected_response(self, url, taskdraft_test_data1) # PUT new values, verify PUT_and_assert_expected_response(self, url, taskdraft_test_data2, 200, taskdraft_test_data2) - GET_and_assert_equal_expected_response(self, url, 200, taskdraft_test_data2) + GET_OK_and_assert_equal_expected_response(self, url, taskdraft_test_data2) def test_task_draft_PATCH(self): taskdraft_test_data = test_data_creator.TaskDraft(scheduling_unit_draft_url=self.scheduling_unit_draft_url, template_url=self.template_url) @@ -1145,7 +1145,7 @@ class TaskDraftTestCase(unittest.TestCase): # POST new item, verify r_dict = POST_and_assert_expected_response(self, BASE_URL + '/task_draft/', taskdraft_test_data, 201, taskdraft_test_data) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, taskdraft_test_data) + GET_OK_and_assert_equal_expected_response(self, url, taskdraft_test_data) test_patch = {"description": "This is a new and improved description", "specifications_doc": "{'para': 'meter'}"} @@ -1154,7 +1154,7 @@ class TaskDraftTestCase(unittest.TestCase): PATCH_and_assert_expected_response(self, url, test_patch, 200, test_patch) expected_data = dict(taskdraft_test_data) expected_data.update(test_patch) - GET_and_assert_equal_expected_response(self, url, 200, expected_data) + GET_OK_and_assert_equal_expected_response(self, url, expected_data) def test_task_draft_DELETE(self): taskdraft_test_data = test_data_creator.TaskDraft(scheduling_unit_draft_url=self.scheduling_unit_draft_url, template_url=self.template_url) @@ -1162,7 +1162,7 @@ class TaskDraftTestCase(unittest.TestCase): # POST new item, verify r_dict = POST_and_assert_expected_response(self, BASE_URL + '/task_draft/', taskdraft_test_data, 201, taskdraft_test_data) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, taskdraft_test_data) + GET_OK_and_assert_equal_expected_response(self, url, taskdraft_test_data) # DELETE and check it's gone DELETE_and_assert_gone(self, url) @@ -1175,13 +1175,13 @@ class TaskDraftTestCase(unittest.TestCase): url = POST_and_assert_expected_response(self, BASE_URL + '/task_draft/', taskdraft_test_data, 201, taskdraft_test_data)['url'] # verify - GET_and_assert_equal_expected_response(self, url, 200, taskdraft_test_data) + GET_OK_and_assert_equal_expected_response(self, url, taskdraft_test_data) # DELETE dependency DELETE_and_assert_gone(self, template_url) # assert - GET_and_assert_equal_expected_response(self, url, 404, {}) + GET_and_assert_equal_expected_code(self, url, 404) def test_task_draft_CASCADE_behavior_on_scheduling_unit_draft_deleted(self): scheduling_unit_draft_url = test_data_creator.post_data_and_get_url(test_data_creator.SchedulingUnitDraft(), '/scheduling_unit_draft/') @@ -1191,13 +1191,13 @@ class TaskDraftTestCase(unittest.TestCase): url = POST_and_assert_expected_response(self, BASE_URL + '/task_draft/', taskdraft_test_data, 201, taskdraft_test_data)['url'] # verify - GET_and_assert_equal_expected_response(self, url, 200, taskdraft_test_data) + GET_OK_and_assert_equal_expected_response(self, url, taskdraft_test_data) # DELETE dependency DELETE_and_assert_gone(self, scheduling_unit_draft_url) # assert - GET_and_assert_equal_expected_response(self, url, 404, {}) + GET_and_assert_equal_expected_code(self, url, 404) def test_task_draft_SET_NULL_behavior_on_copies_deleted(self): taskdraft_test_data1 = test_data_creator.TaskDraft(name="the one", scheduling_unit_draft_url=self.scheduling_unit_draft_url, template_url=self.template_url) @@ -1210,14 +1210,14 @@ class TaskDraftTestCase(unittest.TestCase): url = POST_and_assert_expected_response(self, BASE_URL + '/task_draft/', test_data, 201, test_data)['url'] # verify - GET_and_assert_equal_expected_response(self, url, 200, test_data) + GET_OK_and_assert_equal_expected_response(self, url, test_data) # DELETE dependency DELETE_and_assert_gone(self, copy_url) # assert test_data['copies'] = None - GET_and_assert_equal_expected_response(self, url, 200, test_data) + GET_OK_and_assert_equal_expected_response(self, url, test_data) def test_GET_TaskDraft_list_view_shows_entry(self): @@ -1234,8 +1234,8 @@ class TaskDraftTestCase(unittest.TestCase): id1 = models.TaskDraft.objects.create(**test_data_1).id id2 = models.TaskDraft.objects.create(**test_data_2).id # assert - GET_and_assert_in_expected_response(self, BASE_URL + '/task_draft/%s/' % id1, test_data_1) - GET_and_assert_in_expected_response(self, BASE_URL + '/task_draft/%s/' % id2, test_data_2) + GET_OK_and_assert_equal_expected_response(self, BASE_URL + '/task_draft/%s/' % id1, test_data_1) + GET_OK_and_assert_equal_expected_response(self, BASE_URL + '/task_draft/%s/' % id2, test_data_2) def test_nested_TaskDraft_are_filtered_according_to_SchedulingUnitDraft(self): @@ -1255,7 +1255,7 @@ class TaskDraftTestCase(unittest.TestCase): # assert the returned list contains related items, A list of length 1 is retrieved GET_and_assert_in_expected_response_result_list(self, BASE_URL + '/scheduling_unit_draft/%s/task_draft/' % scheduling_unit_draft_2.id, test_data_2, 1) # assert an existing related item is returned - GET_and_assert_in_expected_response(self, BASE_URL + '/scheduling_unit_draft/%s/task_draft/%s/' % (scheduling_unit_draft_2.id, task_draft_2.id), test_data_2) + GET_OK_and_assert_equal_expected_response(self, BASE_URL + '/scheduling_unit_draft/%s/task_draft/%s/' % (scheduling_unit_draft_2.id, task_draft_2.id), test_data_2) # assert an existing unrelated item is not returned GET_and_assert_equal_expected_code(self, BASE_URL + '/scheduling_unit_draft/%s/task_draft/%s/' % (scheduling_unit_draft_2.id, task_draft_1.id), 404) @@ -1273,7 +1273,7 @@ class TaskDraftTestCase(unittest.TestCase): task_blueprint_2.draft = task_draft task_blueprint_2.save() # assert - response_data = GET_and_assert_in_expected_response(self, BASE_URL + '/task_draft/%s/' % task_draft.id, test_data_1) + response_data = GET_OK_and_assert_equal_expected_response(self, BASE_URL + '/task_draft/%s/' % task_draft.id, test_data_1) assertUrlList(self, response_data['related_task_blueprint'], [task_blueprint_1, task_blueprint_2]) def test_TaskDraft_contains_lists_of_related_TaskRelationDraft(self): @@ -1290,7 +1290,7 @@ class TaskDraftTestCase(unittest.TestCase): task_relation_draft_2.consumer = task_draft task_relation_draft_2.save() # assert - response_data = GET_and_assert_in_expected_response(self, BASE_URL + '/task_draft/%s/' % task_draft.id, test_data_1) + response_data = GET_OK_and_assert_equal_expected_response(self, BASE_URL + '/task_draft/%s/' % task_draft.id, test_data_1) assertUrlList(self, response_data['produced_by'], [task_relation_draft_1]) assertUrlList(self, response_data['consumed_by'], [task_relation_draft_2]) @@ -1310,7 +1310,7 @@ class TaskRelationDraftTestCase(unittest.TestCase): self.assertTrue("Task Relation Draft List" in r.content.decode('utf8')) def test_task_relation_draft_GET_nonexistant_raises_error(self): - GET_and_assert_equal_expected_response(self, BASE_URL + '/task_relation_draft/1234321/', 404, {}) + GET_and_assert_equal_expected_code(self, BASE_URL + '/task_relation_draft/1234321/', 404) def test_task_relation_draft_POST_and_GET(self): trd_test_data = test_data_creator.TaskRelationDraft(producer_url=self.producer_url, consumer_url=self.consumer_url, template_url=self.template_url, input_url=self.input_url, output_url=self.output_url) @@ -1318,7 +1318,7 @@ class TaskRelationDraftTestCase(unittest.TestCase): # POST and GET a new item and assert correctness r_dict = POST_and_assert_expected_response(self, BASE_URL + '/task_relation_draft/', trd_test_data, 201, trd_test_data) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, trd_test_data) + GET_OK_and_assert_equal_expected_response(self, url, trd_test_data) def test_task_relation_draft_PUT_invalid_raises_error(self): trd_test_data = test_data_creator.TaskRelationDraft(producer_url=self.producer_url, consumer_url=self.consumer_url, template_url=self.template_url, input_url=self.input_url, output_url=self.output_url) @@ -1331,11 +1331,11 @@ class TaskRelationDraftTestCase(unittest.TestCase): # POST new item, verify r_dict = POST_and_assert_expected_response(self, BASE_URL + '/task_relation_draft/', trd_test_data1, 201, trd_test_data1) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, trd_test_data1) + GET_OK_and_assert_equal_expected_response(self, url, trd_test_data1) # PUT new values, verify PUT_and_assert_expected_response(self, url, trd_test_data2, 200, trd_test_data2) - GET_and_assert_equal_expected_response(self, url, 200, trd_test_data2) + GET_OK_and_assert_equal_expected_response(self, url, trd_test_data2) def test_task_relation_draft_PATCH(self): trd_test_data = test_data_creator.TaskRelationDraft(producer_url=self.producer_url, consumer_url=self.consumer_url, template_url=self.template_url, input_url=self.input_url, output_url=self.output_url) @@ -1343,7 +1343,7 @@ class TaskRelationDraftTestCase(unittest.TestCase): # POST new item, verify r_dict = POST_and_assert_expected_response(self, BASE_URL + '/task_relation_draft/', trd_test_data, 201, trd_test_data) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, trd_test_data) + GET_OK_and_assert_equal_expected_response(self, url, trd_test_data) test_patch = {"selection_doc": "{'para': 'meter'}"} @@ -1351,7 +1351,7 @@ class TaskRelationDraftTestCase(unittest.TestCase): PATCH_and_assert_expected_response(self, url, test_patch, 200, test_patch) expected_data = dict(trd_test_data) expected_data.update(test_patch) - GET_and_assert_equal_expected_response(self, url, 200, expected_data) + GET_OK_and_assert_equal_expected_response(self, url, expected_data) def test_task_relation_draft_DELETE(self): trd_test_data = test_data_creator.TaskRelationDraft(producer_url=self.producer_url, consumer_url=self.consumer_url, template_url=self.template_url, input_url=self.input_url, output_url=self.output_url) @@ -1359,7 +1359,7 @@ class TaskRelationDraftTestCase(unittest.TestCase): # POST new item, verify r_dict = POST_and_assert_expected_response(self, BASE_URL + '/task_relation_draft/', trd_test_data, 201, trd_test_data) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, trd_test_data) + GET_OK_and_assert_equal_expected_response(self, url, trd_test_data) # DELETE and check it's gone DELETE_and_assert_gone(self, url) @@ -1372,13 +1372,13 @@ class TaskRelationDraftTestCase(unittest.TestCase): url = POST_and_assert_expected_response(self, BASE_URL + '/task_relation_draft/', trd_test_data, 201, trd_test_data)['url'] # verify - GET_and_assert_equal_expected_response(self, url, 200, trd_test_data) + GET_OK_and_assert_equal_expected_response(self, url, trd_test_data) # DELETE dependency DELETE_and_assert_gone(self, template_url) # assert - GET_and_assert_equal_expected_response(self, url, 404, {}) + GET_and_assert_equal_expected_code(self, url, 404) def test_task_relation_draft_CASCADE_behavior_on_producer_deleted(self): producer_url = test_data_creator.post_data_and_get_url(test_data_creator.TaskDraft(), '/task_draft/') @@ -1389,13 +1389,13 @@ class TaskRelationDraftTestCase(unittest.TestCase): trd_test_data, 201, trd_test_data)['url'] # verify - GET_and_assert_equal_expected_response(self, url, 200, trd_test_data) + GET_OK_and_assert_equal_expected_response(self, url, trd_test_data) # DELETE dependency DELETE_and_assert_gone(self, producer_url) # assert - GET_and_assert_equal_expected_response(self, url, 404, {}) + GET_and_assert_equal_expected_code(self, url, 404) def test_task_relation_draft_CASCADE_behavior_on_consumer_deleted(self): consumer_url = test_data_creator.post_data_and_get_url(test_data_creator.TaskDraft(), '/task_draft/') @@ -1406,13 +1406,13 @@ class TaskRelationDraftTestCase(unittest.TestCase): trd_test_data, 201, trd_test_data)['url'] # verify - GET_and_assert_equal_expected_response(self, url, 200, trd_test_data) + GET_OK_and_assert_equal_expected_response(self, url, trd_test_data) # DELETE dependency DELETE_and_assert_gone(self, consumer_url) # assert - GET_and_assert_equal_expected_response(self, url, 404, {}) + GET_and_assert_equal_expected_code(self, url, 404) def test_task_relation_draft_CASCADE_behavior_on_input_deleted(self): input_url = test_data_creator.post_data_and_get_url(test_data_creator.TaskConnectors(), '/task_connectors/') @@ -1423,13 +1423,13 @@ class TaskRelationDraftTestCase(unittest.TestCase): trd_test_data, 201, trd_test_data)['url'] # verify - GET_and_assert_equal_expected_response(self, url, 200, trd_test_data) + GET_OK_and_assert_equal_expected_response(self, url, trd_test_data) # DELETE dependency DELETE_and_assert_gone(self, input_url) # assert - GET_and_assert_equal_expected_response(self, url, 404, {}) + GET_and_assert_equal_expected_code(self, url, 404) def test_task_relation_draft_CASCADE_behavior_on_output_deleted(self): output_url = test_data_creator.post_data_and_get_url(test_data_creator.TaskConnectors(), '/task_connectors/') @@ -1440,13 +1440,13 @@ class TaskRelationDraftTestCase(unittest.TestCase): trd_test_data, 201, trd_test_data)['url'] # verify - GET_and_assert_equal_expected_response(self, url, 200, trd_test_data) + GET_OK_and_assert_equal_expected_response(self, url, trd_test_data) # DELETE dependency DELETE_and_assert_gone(self, output_url) # assert - GET_and_assert_equal_expected_response(self, url, 404, {}) + GET_and_assert_equal_expected_code(self, url, 404) def test_GET_TaskRelationDraft_list_view_shows_entry(self): @@ -1462,8 +1462,8 @@ class TaskRelationDraftTestCase(unittest.TestCase): test_data_2 = TaskRelationDraft_test_data() id1 = models.TaskRelationDraft.objects.create(**test_data_1).id id2 = models.TaskRelationDraft.objects.create(**test_data_2).id - GET_and_assert_in_expected_response(self, BASE_URL + '/task_relation_draft/%s/' % id1, test_data_1) - GET_and_assert_in_expected_response(self, BASE_URL + '/task_relation_draft/%s/' % id2, test_data_2) + GET_OK_and_assert_equal_expected_response(self, BASE_URL + '/task_relation_draft/%s/' % id1, test_data_1) + GET_OK_and_assert_equal_expected_response(self, BASE_URL + '/task_relation_draft/%s/' % id2, test_data_2) def test_nested_TaskRelationDraft_are_filtered_according_to_TaskDraft(self): @@ -1484,9 +1484,9 @@ class TaskRelationDraftTestCase(unittest.TestCase): # assert the returned list contains related items, A list of length 1 is retrieved GET_and_assert_in_expected_response_result_list(self, BASE_URL + '/task_draft/%s/task_relation_draft/' % task_draft_2.id, test_data_2, 1) # assert an existing related producer is returned - GET_and_assert_in_expected_response(self, BASE_URL + '/task_draft/%s/task_relation_draft/%s/' % (task_draft_1.id, task_relation_draft_1.id), test_data_1) + GET_OK_and_assert_equal_expected_response(self, BASE_URL + '/task_draft/%s/task_relation_draft/%s/' % (task_draft_1.id, task_relation_draft_1.id), test_data_1) # assert an existing related consumer is returned - GET_and_assert_in_expected_response(self, BASE_URL + '/task_draft/%s/task_relation_draft/%s/' % (task_draft_2.id, task_relation_draft_2.id), test_data_2) + GET_OK_and_assert_equal_expected_response(self, BASE_URL + '/task_draft/%s/task_relation_draft/%s/' % (task_draft_2.id, task_relation_draft_2.id), test_data_2) # assert an existing unrelated item is not returned GET_and_assert_equal_expected_code(self, BASE_URL + '/task_draft/%s/task_relation_draft/%s/' % (task_draft_2.id, task_relation_draft_1.id), 404) @@ -1503,7 +1503,7 @@ class SchedulingUnitBlueprintTestCase(unittest.TestCase): self.assertTrue("Scheduling Unit Blueprint List" in r.content.decode('utf8')) def test_scheduling_unit_blueprint_GET_nonexistant_raises_error(self): - GET_and_assert_equal_expected_response(self, BASE_URL + '/scheduling_unit_blueprint/1234321/', 404, {}) + GET_and_assert_equal_expected_code(self, BASE_URL + '/scheduling_unit_blueprint/1234321/', 404) def test_scheduling_unit_blueprint_POST_and_GET(self): sub_test_data = test_data_creator.SchedulingUnitBlueprint(scheduling_unit_draft_url=self.scheduling_unit_draft_url, template_url=self.template_url) @@ -1511,7 +1511,7 @@ class SchedulingUnitBlueprintTestCase(unittest.TestCase): # POST and GET a new item and assert correctness r_dict = POST_and_assert_expected_response(self, BASE_URL + '/scheduling_unit_blueprint/', sub_test_data, 201, sub_test_data) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, sub_test_data) + GET_OK_and_assert_equal_expected_response(self, url, sub_test_data) def test_scheduling_unit_blueprint_PUT_invalid_raises_error(self): sub_test_data = test_data_creator.SchedulingUnitBlueprint(scheduling_unit_draft_url=self.scheduling_unit_draft_url, template_url=self.template_url) @@ -1524,11 +1524,11 @@ class SchedulingUnitBlueprintTestCase(unittest.TestCase): # POST new item, verify r_dict = POST_and_assert_expected_response(self, BASE_URL + '/scheduling_unit_blueprint/', sub_test_data1, 201, sub_test_data1) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, sub_test_data1) + GET_OK_and_assert_equal_expected_response(self, url, sub_test_data1) # PUT new values, verify PUT_and_assert_expected_response(self, url, sub_test_data2, 200, sub_test_data2) - GET_and_assert_equal_expected_response(self, url, 200, sub_test_data2) + GET_OK_and_assert_equal_expected_response(self, url, sub_test_data2) def test_scheduling_unit_blueprint_PATCH(self): sub_test_data = test_data_creator.SchedulingUnitBlueprint(scheduling_unit_draft_url=self.scheduling_unit_draft_url, template_url=self.template_url) @@ -1536,7 +1536,7 @@ class SchedulingUnitBlueprintTestCase(unittest.TestCase): # POST new item, verify r_dict = POST_and_assert_expected_response(self, BASE_URL + '/scheduling_unit_blueprint/', sub_test_data, 201, sub_test_data) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, sub_test_data) + GET_OK_and_assert_equal_expected_response(self, url, sub_test_data) test_patch = {"description": "This is an updated description", "do_cancel": True} @@ -1545,7 +1545,7 @@ class SchedulingUnitBlueprintTestCase(unittest.TestCase): PATCH_and_assert_expected_response(self, url, test_patch, 200, test_patch) expected_data = dict(sub_test_data) expected_data.update(test_patch) - GET_and_assert_equal_expected_response(self, url, 200, expected_data) + GET_OK_and_assert_equal_expected_response(self, url, expected_data) def test_scheduling_unit_blueprint_DELETE(self): sub_test_data = test_data_creator.SchedulingUnitBlueprint(scheduling_unit_draft_url=self.scheduling_unit_draft_url, template_url=self.template_url) @@ -1553,7 +1553,7 @@ class SchedulingUnitBlueprintTestCase(unittest.TestCase): # POST new item, verify r_dict = POST_and_assert_expected_response(self, BASE_URL + '/scheduling_unit_blueprint/', sub_test_data, 201, sub_test_data) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, sub_test_data) + GET_OK_and_assert_equal_expected_response(self, url, sub_test_data) # DELETE and check it's gone DELETE_and_assert_gone(self, url) @@ -1566,13 +1566,13 @@ class SchedulingUnitBlueprintTestCase(unittest.TestCase): url = POST_and_assert_expected_response(self, BASE_URL + '/scheduling_unit_blueprint/', sub_test_data, 201, sub_test_data)['url'] # verify - GET_and_assert_equal_expected_response(self, url, 200, sub_test_data) + GET_OK_and_assert_equal_expected_response(self, url, sub_test_data) # DELETE dependency DELETE_and_assert_gone(self, template_url) # assert - GET_and_assert_equal_expected_response(self, url, 404, {}) + GET_and_assert_equal_expected_code(self, url, 404) def test_scheduling_unit_blueprint_CASCADE_behavior_on_scheduling_unit_draft_deleted(self): scheduling_unit_draft_url = test_data_creator.post_data_and_get_url(test_data_creator.SchedulingUnitDraft(), '/scheduling_unit_draft/') @@ -1582,13 +1582,13 @@ class SchedulingUnitBlueprintTestCase(unittest.TestCase): url = POST_and_assert_expected_response(self, BASE_URL + '/scheduling_unit_blueprint/', sub_test_data, 201, sub_test_data)['url'] # verify - GET_and_assert_equal_expected_response(self, url, 200, sub_test_data) + GET_OK_and_assert_equal_expected_response(self, url, sub_test_data) # DELETE dependency DELETE_and_assert_gone(self, scheduling_unit_draft_url) # assert - GET_and_assert_equal_expected_response(self, url, 404, {}) + GET_and_assert_equal_expected_code(self, url, 404) def test_GET_SchedulingUnitBlueprint_list_view_shows_entry(self): @@ -1605,8 +1605,8 @@ class SchedulingUnitBlueprintTestCase(unittest.TestCase): id1 = models.SchedulingUnitBlueprint.objects.create(**test_data_1).id id2 = models.SchedulingUnitBlueprint.objects.create(**test_data_2).id # assert - GET_and_assert_in_expected_response(self, BASE_URL + '/scheduling_unit_blueprint/%s/' % id1, test_data_1) - GET_and_assert_in_expected_response(self, BASE_URL + '/scheduling_unit_blueprint/%s/' % id2, test_data_2) + GET_OK_and_assert_equal_expected_response(self, BASE_URL + '/scheduling_unit_blueprint/%s/' % id1, test_data_1) + GET_OK_and_assert_equal_expected_response(self, BASE_URL + '/scheduling_unit_blueprint/%s/' % id2, test_data_2) def test_nested_SchedulingUnitBlueprint_are_filtered_according_to_SchedulingUnitDraft(self): @@ -1627,7 +1627,7 @@ class SchedulingUnitBlueprintTestCase(unittest.TestCase): # assert the returned list contains related items, A list of length 1 is retrieved GET_and_assert_in_expected_response_result_list(self, BASE_URL + '/scheduling_unit_draft/%s/scheduling_unit_blueprint/' % scheduling_unit_draft_2.id, test_data_2, 1) # assert an existing related item is returned - GET_and_assert_in_expected_response(self, BASE_URL + '/scheduling_unit_draft/%s/scheduling_unit_blueprint/%s/' % (scheduling_unit_draft_2.id, scheduling_unit_blueprint_2.id), test_data_2) + GET_OK_and_assert_equal_expected_response(self, BASE_URL + '/scheduling_unit_draft/%s/scheduling_unit_blueprint/%s/' % (scheduling_unit_draft_2.id, scheduling_unit_blueprint_2.id), test_data_2) # assert an existing unrelated item is not returned GET_and_assert_equal_expected_code(self, BASE_URL + '/scheduling_unit_draft/%s/scheduling_unit_blueprint/%s/' % (scheduling_unit_draft_2.id, scheduling_unit_blueprint_1.id), 404) @@ -1645,7 +1645,7 @@ class TaskBlueprintTestCase(unittest.TestCase): self.assertTrue("Task Blueprint List" in r.content.decode('utf8')) def test_task_blueprint_GET_nonexistant_raises_error(self): - GET_and_assert_equal_expected_response(self, BASE_URL + '/task_blueprint/1234321/', 404, {}) + GET_and_assert_equal_expected_code(self, BASE_URL + '/task_blueprint/1234321/', 404) def test_task_blueprint_POST_and_GET(self): tb_test_data = test_data_creator.TaskBlueprint(draft_url=self.draft_url, template_url=self.template_url, scheduling_unit_blueprint_url=self.scheduling_unit_blueprint_url) @@ -1653,7 +1653,7 @@ class TaskBlueprintTestCase(unittest.TestCase): # POST and GET a new item and assert correctness r_dict = POST_and_assert_expected_response(self, BASE_URL + '/task_blueprint/', tb_test_data, 201, tb_test_data) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, tb_test_data) + GET_OK_and_assert_equal_expected_response(self, url, tb_test_data) def test_task_blueprint_PUT_invalid_raises_error(self): tb_test_data = test_data_creator.TaskBlueprint(draft_url=self.draft_url, template_url=self.template_url, scheduling_unit_blueprint_url=self.scheduling_unit_blueprint_url) @@ -1666,11 +1666,11 @@ class TaskBlueprintTestCase(unittest.TestCase): # POST new item, verify r_dict = POST_and_assert_expected_response(self, BASE_URL + '/task_blueprint/', tb_test_data1, 201, tb_test_data1) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, tb_test_data1) + GET_OK_and_assert_equal_expected_response(self, url, tb_test_data1) # PUT new values, verify PUT_and_assert_expected_response(self, url, tb_test_data2, 200, tb_test_data2) - GET_and_assert_equal_expected_response(self, url, 200, tb_test_data2) + GET_OK_and_assert_equal_expected_response(self, url, tb_test_data2) def test_task_blueprint_PATCH(self): tb_test_data = test_data_creator.TaskBlueprint(draft_url=self.draft_url, template_url=self.template_url, scheduling_unit_blueprint_url=self.scheduling_unit_blueprint_url) @@ -1678,7 +1678,7 @@ class TaskBlueprintTestCase(unittest.TestCase): # POST new item, verify r_dict = POST_and_assert_expected_response(self, BASE_URL + '/task_blueprint/', tb_test_data, 201, tb_test_data) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, tb_test_data) + GET_OK_and_assert_equal_expected_response(self, url, tb_test_data) test_patch = {"description": "This is an updated description", "do_cancel": True} @@ -1687,7 +1687,7 @@ class TaskBlueprintTestCase(unittest.TestCase): PATCH_and_assert_expected_response(self, url, test_patch, 200, test_patch) expected_data = dict(tb_test_data) expected_data.update(test_patch) - GET_and_assert_equal_expected_response(self, url, 200, expected_data) + GET_OK_and_assert_equal_expected_response(self, url, expected_data) def test_task_blueprint_DELETE(self): tb_test_data = test_data_creator.TaskBlueprint(draft_url=self.draft_url, template_url=self.template_url, scheduling_unit_blueprint_url=self.scheduling_unit_blueprint_url) @@ -1695,7 +1695,7 @@ class TaskBlueprintTestCase(unittest.TestCase): # POST new item, verify r_dict = POST_and_assert_expected_response(self, BASE_URL + '/task_blueprint/', tb_test_data, 201, tb_test_data) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, tb_test_data) + GET_OK_and_assert_equal_expected_response(self, url, tb_test_data) # DELETE and check it's gone DELETE_and_assert_gone(self, url) @@ -1741,13 +1741,13 @@ class TaskBlueprintTestCase(unittest.TestCase): url = POST_and_assert_expected_response(self, BASE_URL + '/task_blueprint/', tb_test_data, 201, tb_test_data)['url'] # verify - GET_and_assert_equal_expected_response(self, url, 200, tb_test_data) + GET_OK_and_assert_equal_expected_response(self, url, tb_test_data) # DELETE dependency DELETE_and_assert_gone(self, template_url) # assert - GET_and_assert_equal_expected_response(self, url, 404, {}) + GET_and_assert_equal_expected_code(self, url, 404) def test_task_blueprint_CASCADE_behavior_on_task_draft_deleted(self): draft_url = test_data_creator.post_data_and_get_url(test_data_creator.TaskDraft(), '/task_draft/') @@ -1757,13 +1757,13 @@ class TaskBlueprintTestCase(unittest.TestCase): url = POST_and_assert_expected_response(self, BASE_URL + '/task_blueprint/', tb_test_data, 201, tb_test_data)['url'] # verify - GET_and_assert_equal_expected_response(self, url, 200, tb_test_data) + GET_OK_and_assert_equal_expected_response(self, url, tb_test_data) # DELETE dependency DELETE_and_assert_gone(self, draft_url) # assert - GET_and_assert_equal_expected_response(self, url, 404, {}) + GET_and_assert_equal_expected_code(self, url, 404) def test_task_blueprint_CASCADE_behavior_on_scheduling_unit_blueprint_deleted(self): scheduling_unit_blueprint_url = test_data_creator.post_data_and_get_url(test_data_creator.SchedulingUnitBlueprint(), '/scheduling_unit_blueprint/') @@ -1773,13 +1773,13 @@ class TaskBlueprintTestCase(unittest.TestCase): url = POST_and_assert_expected_response(self, BASE_URL + '/task_blueprint/', tb_test_data, 201, tb_test_data)['url'] # verify - GET_and_assert_equal_expected_response(self, url, 200, tb_test_data) + GET_OK_and_assert_equal_expected_response(self, url, tb_test_data) # DELETE dependency DELETE_and_assert_gone(self, scheduling_unit_blueprint_url) # assert - GET_and_assert_equal_expected_response(self, url, 404, {}) + GET_and_assert_equal_expected_code(self, url, 404) def test_GET_TaskBlueprint_list_view_shows_entry(self): @@ -1796,8 +1796,8 @@ class TaskBlueprintTestCase(unittest.TestCase): id1 = models.TaskBlueprint.objects.create(**test_data_1).id id2 = models.TaskBlueprint.objects.create(**test_data_2).id # assert - GET_and_assert_in_expected_response(self, BASE_URL + '/task_blueprint/%s/' % id1, test_data_1) - GET_and_assert_in_expected_response(self, BASE_URL + '/task_blueprint/%s/' % id2, test_data_2) + GET_OK_and_assert_equal_expected_response(self, BASE_URL + '/task_blueprint/%s/' % id1, test_data_1) + GET_OK_and_assert_equal_expected_response(self, BASE_URL + '/task_blueprint/%s/' % id2, test_data_2) def test_nested_TaskBlueprint_are_filtered_according_to_TaskDraft(self): @@ -1818,7 +1818,7 @@ class TaskBlueprintTestCase(unittest.TestCase): # assert the returned list contains related items, A list of length 1 is retrieved GET_and_assert_in_expected_response_result_list(self, BASE_URL + '/task_draft/%s/task_blueprint/' % task_draft_2.id, test_data_2, 1) # assert an existing related item is returned - GET_and_assert_in_expected_response(self, BASE_URL + '/task_draft/%s/task_blueprint/%s/' % (task_draft_2.id, task_blueprint_2.id), test_data_2) + GET_OK_and_assert_equal_expected_response(self, BASE_URL + '/task_draft/%s/task_blueprint/%s/' % (task_draft_2.id, task_blueprint_2.id), test_data_2) # assert an existing unrelated item is not returned GET_and_assert_equal_expected_code(self, BASE_URL + '/task_draft/%s/task_blueprint/%s/' % (task_draft_2.id, task_blueprint_1.id), 404) @@ -1877,7 +1877,7 @@ class TaskRelationBlueprintTestCase(unittest.TestCase): self.assertTrue("Task Relation Blueprint List" in r.content.decode('utf8')) def test_task_relation_blueprint_GET_nonexistant_raises_error(self): - GET_and_assert_equal_expected_response(self, BASE_URL + '/task_relation_blueprint/1234321/', 404, {}) + GET_and_assert_equal_expected_code(self, BASE_URL + '/task_relation_blueprint/1234321/', 404) def test_task_relation_blueprint_POST_and_GET(self): trb_test_data = test_data_creator.TaskRelationBlueprint(draft_url=self.draft_url, template_url=self.template_url, input_url=self.input_url, output_url=self.output_url, consumer_url=self.consumer_url, producer_url=self.producer_url) @@ -1885,7 +1885,7 @@ class TaskRelationBlueprintTestCase(unittest.TestCase): # POST and GET a new item and assert correctness r_dict = POST_and_assert_expected_response(self, BASE_URL + '/task_relation_blueprint/', trb_test_data, 201, trb_test_data) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, trb_test_data) + GET_OK_and_assert_equal_expected_response(self, url, trb_test_data) def test_task_relation_blueprint_PUT_invalid_raises_error(self): trb_test_data = test_data_creator.TaskRelationBlueprint(draft_url=self.draft_url, template_url=self.template_url, input_url=self.input_url, output_url=self.output_url, consumer_url=self.consumer_url, producer_url=self.producer_url) @@ -1898,11 +1898,11 @@ class TaskRelationBlueprintTestCase(unittest.TestCase): # POST new item, verify r_dict = POST_and_assert_expected_response(self, BASE_URL + '/task_relation_blueprint/', trb_test_data1, 201, trb_test_data1) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, trb_test_data1) + GET_OK_and_assert_equal_expected_response(self, url, trb_test_data1) # PUT new values, verify PUT_and_assert_expected_response(self, url, trb_test_data2, 200, trb_test_data2) - GET_and_assert_equal_expected_response(self, url, 200, trb_test_data2) + GET_OK_and_assert_equal_expected_response(self, url, trb_test_data2) def test_task_relation_blueprint_PATCH(self): trb_test_data = test_data_creator.TaskRelationBlueprint(draft_url=self.draft_url, template_url=self.template_url, input_url=self.input_url, output_url=self.output_url, consumer_url=self.consumer_url, producer_url=self.producer_url) @@ -1910,7 +1910,7 @@ class TaskRelationBlueprintTestCase(unittest.TestCase): # POST new item, verify r_dict = POST_and_assert_expected_response(self, BASE_URL + '/task_relation_blueprint/', trb_test_data, 201, trb_test_data) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, trb_test_data) + GET_OK_and_assert_equal_expected_response(self, url, trb_test_data) test_patch = {"selection_doc": "{'new': 'doc'}"} @@ -1918,7 +1918,7 @@ class TaskRelationBlueprintTestCase(unittest.TestCase): PATCH_and_assert_expected_response(self, url, test_patch, 200, test_patch) expected_data = dict(trb_test_data) expected_data.update(test_patch) - GET_and_assert_equal_expected_response(self, url, 200, expected_data) + GET_OK_and_assert_equal_expected_response(self, url, expected_data) def test_task_relation_blueprint_DELETE(self): trb_test_data = test_data_creator.TaskRelationBlueprint(draft_url=self.draft_url, template_url=self.template_url, input_url=self.input_url, output_url=self.output_url, consumer_url=self.consumer_url, producer_url=self.producer_url) @@ -1926,7 +1926,7 @@ class TaskRelationBlueprintTestCase(unittest.TestCase): # POST new item, verify r_dict = POST_and_assert_expected_response(self, BASE_URL + '/task_relation_blueprint/', trb_test_data, 201, trb_test_data) url = r_dict['url'] - GET_and_assert_equal_expected_response(self, url, 200, trb_test_data) + GET_OK_and_assert_equal_expected_response(self, url, trb_test_data) # DELETE and check it's gone DELETE_and_assert_gone(self, url) @@ -2005,13 +2005,13 @@ class TaskRelationBlueprintTestCase(unittest.TestCase): url = POST_and_assert_expected_response(self, BASE_URL + '/task_relation_blueprint/', trb_test_data, 201, trb_test_data)['url'] # verify - GET_and_assert_equal_expected_response(self, url, 200, trb_test_data) + GET_OK_and_assert_equal_expected_response(self, url, trb_test_data) # DELETE dependency DELETE_and_assert_gone(self, template_url) # assert - GET_and_assert_equal_expected_response(self, url, 404, {}) + GET_and_assert_equal_expected_code(self, url, 404) def test_task_relation_blueprint_CASCADE_behavior_on_producer_deleted(self): producer_url = test_data_creator.post_data_and_get_url(test_data_creator.TaskBlueprint(), '/task_blueprint/') @@ -2022,13 +2022,13 @@ class TaskRelationBlueprintTestCase(unittest.TestCase): trb_test_data, 201, trb_test_data)['url'] # verify - GET_and_assert_equal_expected_response(self, url, 200, trb_test_data) + GET_OK_and_assert_equal_expected_response(self, url, trb_test_data) # DELETE dependency DELETE_and_assert_gone(self, producer_url) # assert - GET_and_assert_equal_expected_response(self, url, 404, {}) + GET_and_assert_equal_expected_code(self, url, 404) def test_task_relation_blueprint_CASCADE_behavior_on_consumer_deleted(self): consumer_url = test_data_creator.post_data_and_get_url(test_data_creator.TaskBlueprint(), '/task_blueprint/') @@ -2039,13 +2039,13 @@ class TaskRelationBlueprintTestCase(unittest.TestCase): trb_test_data, 201, trb_test_data)['url'] # verify - GET_and_assert_equal_expected_response(self, url, 200, trb_test_data) + GET_OK_and_assert_equal_expected_response(self, url, trb_test_data) # DELETE dependency DELETE_and_assert_gone(self, consumer_url) # assert - GET_and_assert_equal_expected_response(self, url, 404, {}) + GET_and_assert_equal_expected_code(self, url, 404) def test_task_relation_blueprint_CASCADE_behavior_on_input_deleted(self): input_url = test_data_creator.post_data_and_get_url(test_data_creator.TaskConnectors(), '/task_connectors/') @@ -2056,13 +2056,13 @@ class TaskRelationBlueprintTestCase(unittest.TestCase): trb_test_data, 201, trb_test_data)['url'] # verify - GET_and_assert_equal_expected_response(self, url, 200, trb_test_data) + GET_OK_and_assert_equal_expected_response(self, url, trb_test_data) # DELETE dependency DELETE_and_assert_gone(self, input_url) # assert - GET_and_assert_equal_expected_response(self, url, 404, {}) + GET_and_assert_equal_expected_code(self, url, 404) def test_task_relation_blueprint_CASCADE_behavior_on_output_deleted(self): output_url = test_data_creator.post_data_and_get_url(test_data_creator.TaskConnectors(), '/task_connectors/') @@ -2073,13 +2073,13 @@ class TaskRelationBlueprintTestCase(unittest.TestCase): trb_test_data, 201, trb_test_data)['url'] # verify - GET_and_assert_equal_expected_response(self, url, 200, trb_test_data) + GET_OK_and_assert_equal_expected_response(self, url, trb_test_data) # DELETE dependency DELETE_and_assert_gone(self, output_url) # assert - GET_and_assert_equal_expected_response(self, url, 404, {}) + GET_and_assert_equal_expected_code(self, url, 404) def test_GET_TaskRelationBlueprint_list_view_shows_entry(self): @@ -2096,8 +2096,8 @@ class TaskRelationBlueprintTestCase(unittest.TestCase): id1 = models.TaskRelationBlueprint.objects.create(**test_data_1).id id2 = models.TaskRelationBlueprint.objects.create(**test_data_2).id # assert - GET_and_assert_in_expected_response(self, BASE_URL + '/task_relation_blueprint/%s/' % id1, test_data_1) - GET_and_assert_in_expected_response(self, BASE_URL + '/task_relation_blueprint/%s/' % id2, test_data_2) + GET_OK_and_assert_equal_expected_response(self, BASE_URL + '/task_relation_blueprint/%s/' % id1, test_data_1) + GET_OK_and_assert_equal_expected_response(self, BASE_URL + '/task_relation_blueprint/%s/' % id2, test_data_2) def test_nested_TaskRelationBlueprint_are_filtered_according_to_TaskRelationDraft(self): @@ -2118,7 +2118,7 @@ class TaskRelationBlueprintTestCase(unittest.TestCase): # assert the returned list contains related items, A list of length 1 is retrieved GET_and_assert_in_expected_response_result_list(self, BASE_URL + '/task_relation_draft/%s/task_relation_blueprint/' % task_relation_draft_2.id, test_data_2, 1) # assert an existing related item is returned - GET_and_assert_in_expected_response(self, BASE_URL + '/task_relation_draft/%s/task_relation_blueprint/%s/' % (task_relation_draft_2.id, task_relation_blueprint_2.id), test_data_2) + GET_OK_and_assert_equal_expected_response(self, BASE_URL + '/task_relation_draft/%s/task_relation_blueprint/%s/' % (task_relation_draft_2.id, task_relation_blueprint_2.id), test_data_2) # assert an existing unrelated item is not returned GET_and_assert_equal_expected_code(self, BASE_URL + '/task_relation_draft/%s/task_relation_blueprint/%s/' % (task_relation_draft_2.id, task_relation_blueprint_1.id), 404) @@ -2142,7 +2142,7 @@ class TaskRelationBlueprintTestCase(unittest.TestCase): # assert the returned list contains related consumer GET_and_assert_in_expected_response_result_list(self, BASE_URL + '/task_blueprint/%s/task_relation_blueprint/' % task_blueprint_2.id, test_data_2, 1) # assert an existing related item is returned - GET_and_assert_in_expected_response(self, BASE_URL + '/task_blueprint/%s/task_relation_blueprint/%s/' % (task_blueprint_2.id, task_relation_blueprint_2.id), test_data_2) + GET_OK_and_assert_equal_expected_response(self, BASE_URL + '/task_blueprint/%s/task_relation_blueprint/%s/' % (task_blueprint_2.id, task_relation_blueprint_2.id), test_data_2) # assert an existing unrelated item is not returned GET_and_assert_equal_expected_code(self, BASE_URL + '/task_blueprint/%s/task_relation_blueprint/%s/' % (task_blueprint_2.id, task_relation_blueprint_1.id), 404) diff --git a/SAS/TMSS/test/tmss_test_environment_unittest_setup.py b/SAS/TMSS/test/tmss_test_environment_unittest_setup.py index 5fe5bbe88f480899bc1a22379b674165f394e54a..61837dd9375ba3ce3bf68e11e059df2cd8931c33 100644 --- a/SAS/TMSS/test/tmss_test_environment_unittest_setup.py +++ b/SAS/TMSS/test/tmss_test_environment_unittest_setup.py @@ -120,22 +120,10 @@ def GET_and_assert_equal_expected_code(test_instance, url, expected_code): return r_dict -def GET_and_assert_in_expected_response(test_instance, url, expected_content): - """ - GET from url and assert the expected code is returned and the expected content is in the response content - Because of the objects can not be compared with some objects check the keys only - """ - r_dict = _call_API_and_assert_expected_response(test_instance, url, 'GET', {}, 200, None) - for key in expected_content.keys(): - test_instance.assertIn(key, r_dict.keys()) - assertDataWithUrls(test_instance, r_dict, expected_content) - return r_dict - - def GET_and_assert_in_expected_response_result_list(test_instance, url, expected_content, expected_nbr_results): """ GET from url and assert the expected code is returned and the expected content is in the response content - Use this when multiple results are returned + Use this check when multiple results (list) are returned """ r_dict = _call_API_and_assert_expected_response(test_instance, url, 'GET', {}, 200, None) if expected_nbr_results > 50: @@ -160,11 +148,13 @@ def GET_and_assert_in_expected_response_result_list(test_instance, url, expected return r_dict -def GET_and_assert_equal_expected_response(test_instance, url, expected_code, expected_content): +def GET_OK_and_assert_equal_expected_response(test_instance, url, expected_content): """ GET from url and assert the expected code is returned and the expected content is equal the response content + assertDataWithUrls is already checked in _call_API_and_assert_expected_response """ - r_dict = _call_API_and_assert_expected_response(test_instance, url, 'GET', {}, expected_code, expected_content) + r_dict = _call_API_and_assert_expected_response(test_instance, url, 'GET', {}, 200, expected_content) + # assertDataWithUrls(test_instance, r_dict, expected_content) return r_dict