From 0607040fddce2946c9d6a689a2de856e12dd0587 Mon Sep 17 00:00:00 2001 From: Lukas Holecek Date: May 11 2018 08:20:23 +0000 Subject: Fix testing correct NVR and omit testing ID Fixes following test run: TEST=true python -m pytest -k test_make_a_decision_with_verbose_flag The problem is that database is not dropped after test case is executed so even the ID counters are not reset. Normal test execution worked since it expected some data added by previous test case. It could be good idea to randomize test case execution order. --- diff --git a/functional-tests/test_api_v1.py b/functional-tests/test_api_v1.py index a512dd6..29f10b9 100644 --- a/functional-tests/test_api_v1.py +++ b/functional-tests/test_api_v1.py @@ -222,12 +222,12 @@ def test_make_a_decision_with_verbose_flag(requests_session, greenwave_server, t res_data = r.json() expected_result = { u'data': { - u'item': [u'glibc-1.0-2.el7'], + u'item': [nvr], u'type': [u'koji_build'] }, u'groups': [], - u'href': u'http://localhost:5001/api/v2.0/results/72', - u'id': 72, + #u'href': u'http://localhost:5001/api/v2.0/results/1', + #u'id': 1, u'note': None, u'outcome': u'PASSED', u'ref_url': None, @@ -240,8 +240,10 @@ def test_make_a_decision_with_verbose_flag(requests_session, greenwave_server, t } assert len(res_data['results']) == len(all_rpmdiff_testcase_names) - del res_data['results'][-1]['submit_time'] - assert res_data['results'][-1] == expected_result + item = res_data['results'][-1] + for key in ('href', 'id', 'submit_time',): + del item[key] + assert item == expected_result expected_waivers = [] assert res_data['waivers'] == expected_waivers