def test_get_tests_from_run_id(self): run_a = api.create_run() run_b = api.create_run() test_a = api.create_test('fake_test') test_b = api.create_test('fake_test2') api.create_test_run(test_a.id, run_a.id, 'fail', start_time=datetime.datetime( 1914, 6, 28, 10, 45, 0)) api.create_test_run(test_a.id, run_b.id, 'fail', start_time=datetime.datetime.utcnow()) api.create_test_run(test_b.id, run_a.id, 'success', start_time=datetime.datetime( 1914, 6, 28, 10, 45, 0)) result = api.get_tests_from_run_id(run_a.id) self.assertEqual(2, len(result)) self.assertIn(test_a.id, [x.id for x in result]) self.assertIn(test_a.test_id, [x.test_id for x in result]) self.assertIn(test_b.id, [x.id for x in result]) self.assertIn(test_b.test_id, [x.test_id for x in result])
def test_get_tests_from_run_id(self): run_a = api.create_run() run_b = api.create_run() test_a = api.create_test('fake_test') test_b = api.create_test('fake_test2') api.create_test_run(test_a.id, run_a.id, 'fail', start_time=datetime.datetime(1914, 6, 28, 10, 45, 0)) api.create_test_run(test_a.id, run_b.id, 'fail', start_time=datetime.datetime.utcnow()) api.create_test_run(test_b.id, run_a.id, 'success', start_time=datetime.datetime(1914, 6, 28, 10, 45, 0)) result = api.get_tests_from_run_id(run_a.id) self.assertEqual(2, len(result)) self.assertIn(test_a.id, [x.id for x in result]) self.assertIn(test_a.test_id, [x.test_id for x in result]) self.assertIn(test_b.id, [x.id for x in result]) self.assertIn(test_b.test_id, [x.test_id for x in result])
def get_tests_from_run(run_id): run_id = parse.unquote(run_id) with session_scope() as session: db_tests = api.get_tests_from_run_id(run_id, session) tests = [test.to_dict() for test in db_tests] return jsonify({'tests': tests})
def get_tests_from_run(run_id): session = get_session() db_tests = api.get_tests_from_run_id(run_id, session) tests = [test.to_dict() for test in db_tests] return jsonify({'tests': tests})