-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from keitaroinc/test2
Tests
- Loading branch information
Showing
4 changed files
with
34 additions
and
3 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import pytest | ||
import ckan.model as model | ||
import ckan.tests.factories as factories | ||
from ckanext.keycloak import helpers as h | ||
|
||
|
||
def test_generate_password(): | ||
password = h.generate_password() | ||
assert len(password) >= 8 | ||
assert type(password) is str | ||
|
||
|
||
@pytest.mark.usefixtures(u'clean_db', u'clean_index') | ||
def test_activate_user_if_deleted(): | ||
user = factories.User() | ||
user = model.User.get(user[u'name']) | ||
user.delete() | ||
h.activate_user_if_deleted(user) | ||
assert not user.is_deleted() | ||
|
||
|
||
@pytest.mark.usefixtures(u'clean_db') | ||
def test_ensure_unique_user_name_existing_user(): | ||
|
||
user = factories.User( | ||
name='existing-user', | ||
email=u'[email protected]' | ||
) | ||
|
||
user_name = h.ensure_unique_username_from_email(user['email']) | ||
|
||
assert user_name != user['email'].split('@')[0] | ||
assert user_name.startswith(user['email'].split('@')[0]) |
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 |
---|---|---|
@@ -1,3 +1,2 @@ | ||
python-keycloak==2.6.1 | ||
python-keycloak-client | ||
|