def test_get_part_wrong_group_and_job_id(self): """ Negative test - Confirm we cannot get a part which does not belong to us via its group """ response = compute.get_part( environment.ATHERA_API_TEST_BASE_URL, environment.ATHERA_API_TEST_GROUP_ID, environment.ATHERA_API_TEST_TOKEN, environment.ATHERA_API_TEST_OTHER_JOB_ID, environment.ATHERA_API_TEST_OTHER_PART_ID, ) self.assertEqual(response.status_code, codes.not_found)
def test_get_part_random_id(self): """ Negative test - Confirm we respond correctly to a non-existent job id and part id """ response = compute.get_part( environment.ATHERA_API_TEST_BASE_URL, environment.ATHERA_API_TEST_GROUP_ID, environment.ATHERA_API_TEST_TOKEN, str(uuid.uuid4()), str(uuid.uuid4()), ) self.assertEqual(response.status_code, codes.not_found)
def test_get_part(self): """ Positive test """ response = compute.get_part( environment.ATHERA_API_TEST_BASE_URL, environment.ATHERA_API_TEST_GROUP_ID, environment.ATHERA_API_TEST_TOKEN, environment.ATHERA_API_TEST_JOB_ID, environment.ATHERA_API_TEST_PART_ID, ) self.assertEqual(response.status_code, codes.ok) part_data = response.json() self.assertIn("id", part_data) self.assertEqual(environment.ATHERA_API_TEST_PART_ID, part_data['id'])