Skip to content

Commit

Permalink
[#714] Fix an intermittently failing test
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Sean Hammond committed Apr 16, 2013
1 parent 53c0bf2 commit 1a994e3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ckan/tests/logic/test_action.py
Expand Up @@ -1272,15 +1272,15 @@ 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')
res = json.loads(res.body)
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({
Expand Down

0 comments on commit 1a994e3

Please sign in to comment.