Skip to content

Commit

Permalink
[#2125] Fix group and organization tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mwahlroos committed Dec 11, 2014
1 parent 6d031f6 commit 33ebbd4
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
6 changes: 3 additions & 3 deletions ckan/lib/create_test_data.py
Expand Up @@ -493,9 +493,9 @@ def create(cls, auth_profile="", package_type=None):
type=auth_profile or 'group')

# organization
test_org = model.Group(name=u'test_org',
title=u'Test org',
description=u'This is a simple test organization',
test_org = model.Group(name=u'simple_dummy_org',
title=u'Simple dummy organization',
description=u'This is a simple dummy organization',
type='organization')

for obj in [david, roger, test_org]:
Expand Down
6 changes: 3 additions & 3 deletions ckan/tests/functional/api/test_util.py
Expand Up @@ -122,14 +122,14 @@ def test_organization_autocomplete(self):
response = self.app.get(
url=url,
params={
'q': u'test_or'
'q': u'Simple dummy org'
},
status=200,
)
results = json.loads(response.body)
assert_equal(len(results), 1)
assert_equal(results[0]['name'], 'test_org')
assert_equal(results[0]['title'], 'Test org')
assert_equal(results[0]['name'], 'simple_dummy_org')
assert_equal(results[0]['title'], 'Simple dummy organization')
assert_equal(response.header('Content-Type'), 'application/json;charset=utf-8')

def test_markdown(self):
Expand Down
2 changes: 1 addition & 1 deletion ckan/tests/logic/test_action.py
Expand Up @@ -397,7 +397,7 @@ def test_05_user_show_edits(self):
assert 'timestamp' in edit
assert_equal(edit['state'], 'active')
assert_equal(edit['approved_timestamp'], None)
assert_equal(set(edit['groups']), set(( 'roger', 'david', 'test_org')))
assert_equal(set(edit['groups']), set(( 'roger', 'david', 'simple_dummy_org')))
assert_equal(edit['state'], 'active')
assert edit['message'].startswith('Creating test data.')
assert_equal(set(edit['packages']), set(('warandpeace', 'annakarenina')))
Expand Down
8 changes: 8 additions & 0 deletions ckan/tests/models/test_group.py
Expand Up @@ -53,6 +53,14 @@ def test_2_add_packages(self):
assert grp in anna.get_groups()

def test_3_search(self):
model.repo.new_revision()
model.Session.add(model.Group(name=u'test_org',
title=u'Test org',
type=u'organization'
))
model.repo.commit_and_remove()


assert_equal(self._search_results('random'), set([]))
assert_equal(self._search_results('david'), set(['david']))
assert_equal(self._search_results('roger'), set(['roger']))
Expand Down

0 comments on commit 33ebbd4

Please sign in to comment.