From 1a994e31f0ab609db09e5983792e6cdf065522d8 Mon Sep 17 00:00:00 2001 From: Sean Hammond Date: Mon, 8 Apr 2013 17:14:01 +0200 Subject: [PATCH] [#714] Fix an intermittently failing test This test depends on the order of the two datasets. The default sort order has changed now to most-recently-modified-first when there's no search query, and since the test creates the two datasets in a random order the search returns the datasets in a different order each time the test is run, giving a 50/50 chance that the test will fail. Change the test to not depend on the fixed order of the datasets. --- ckan/tests/logic/test_action.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ckan/tests/logic/test_action.py b/ckan/tests/logic/test_action.py index 75357a0bfc8..f88d1333869 100644 --- a/ckan/tests/logic/test_action.py +++ b/ckan/tests/logic/test_action.py @@ -1272,7 +1272,7 @@ def test_1_basic_no_params(self): result = res['result'] assert_equal(res['success'], True) assert_equal(result['count'], 2) - assert_equal(result['results'][0]['name'], 'annakarenina') + assert result['results'][0]['name'] in ('annakarenina', 'warandpeace') # Test GET request res = self.app.get('/api/action/package_search') @@ -1280,7 +1280,7 @@ def test_1_basic_no_params(self): result = res['result'] assert_equal(res['success'], True) assert_equal(result['count'], 2) - assert_equal(result['results'][0]['name'], 'annakarenina') + assert result['results'][0]['name'] in ('annakarenina', 'warandpeace') def test_2_bad_param(self): postparams = '%s=1' % json.dumps({