def test_get_tests_uncaught_http_error(self): http_error_code = 401 test_tasks = TaskTests(TASKS_TESTS, http_error_code=http_error_code) evg_api = Mock() evg_api.tests_by_task = test_tasks._tests_by_task with self.assertRaises(requests.exceptions.HTTPError) as err: burn_in.get_tests_from_tasks(evg_api, BUILD4_TASKS) self.assertEqual(1, test_tasks.http_errors) self.assertEqual(http_error_code, err.response.status_code)
def test_get_tests(self): test_tasks = TaskTests(TASKS_TESTS) evg_api = Mock() evg_api.tests_by_task = test_tasks._tests_by_task tests = burn_in.get_tests_from_tasks(evg_api, BUILD_TASKS_WITH_BURN_IN_LIST) self.assertEqual(5, len(tests)) for test in tests: self.assertIn(test, ["test1.js", "test2.js"])
def test_get_tests_missing_task(self): test_tasks = TaskTests(TASKS_TESTS) evg_api = Mock() evg_api.tests_by_task = test_tasks._tests_by_task tests = burn_in.get_tests_from_tasks(evg_api, BUILD2_TASKS) self.assertEqual(0, len(tests))
def test_get_tests_no_tasks(self): test_tasks = TaskTests(TASKS_TESTS) evg_api = Mock() evg_api.tests_by_task = test_tasks._tests_by_task tests = burn_in.get_tests_from_tasks(evg_api, []) self.assertEqual(0, len(tests))