-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SPC-130 SPC-131 Search users by ID (#50)
* SPC-130 Add users to main nav * SPC-131 Search users by ID * SPC-131 Test chain user_list action * SPC-131 Fix tests
- Loading branch information
1 parent
d5b88dc
commit b0b41c6
Showing
4 changed files
with
54 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import pytest | ||
import ckan.tests.factories as factories | ||
from ckan.tests.helpers import call_action | ||
|
||
|
||
@pytest.mark.ckan_config('ckan.plugins', "spectrum") | ||
@pytest.mark.usefixtures('clean_db', 'with_plugins') | ||
class TestListUsers(): | ||
|
||
def test_empty_query(self): | ||
users = [factories.User(name=f"{i}01dec4a-6cc9-49cd-91ea-cc0e09ba620d") for i in range(3)] | ||
response = call_action( | ||
'user_list', | ||
q='' | ||
) | ||
user_ids_created = {u['id'] for u in users} | ||
user_ids_found = {u['id'] for u in response} | ||
assert user_ids_created == user_ids_found | ||
|
||
def test_search_by_id(self): | ||
users = [factories.User(name=f"{i}01dec4a-6cc9-49cd-91ea-cc0e09ba620d") for i in range(3)] | ||
response = call_action( | ||
'user_list', | ||
q=users[1]['id'] | ||
) | ||
user_ids_found = [u['id'] for u in response] | ||
assert user_ids_found == [users[1]['id']] | ||
|
||
def test_search_by_non_id(self): | ||
users = [factories.User(name=f"{i}01dec4a-6cc9-49cd-91ea-cc0e09ba620d") for i in range(3)] | ||
response = call_action( | ||
'user_list', | ||
q=users[2]['name'] | ||
) | ||
user_ids_found = [u['id'] for u in response] | ||
assert user_ids_found == [users[2]['id']] |