-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Ian Ross
committed
Aug 30, 2016
1 parent
7ddd5b5
commit e0bdd93
Showing
5 changed files
with
46 additions
and
34 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -334,7 +334,7 @@ def test_to_represenation(self): | |
|
||
assert serializer.data['username'] == user.username | ||
assert serializer.data['email'] == user.email | ||
assert serializer.data['role'] == 'User' | ||
assert serializer.data['admin'] is False | ||
|
||
def test_list_to_representation(self): | ||
users = UserFactory.create_batch(2) | ||
|
@@ -349,16 +349,17 @@ def test_list_to_representation(self): | |
|
||
assert len(serializer.data) == 3 | ||
|
||
print(serializer.data) | ||
for u in serializer.data: | ||
if u['username'] is org_admin.username: | ||
assert u['role'] == 'Admin' | ||
if u['username'] == org_admin.username: | ||
assert u['admin'] is True | ||
else: | ||
assert u['role'] == 'User' | ||
assert u['admin'] is False | ||
|
||
def test_set_roles_with_username(self): | ||
user = UserFactory.create() | ||
org = OrganizationFactory.create() | ||
data = {'username': user.username, 'role': 'Admin'} | ||
data = {'username': user.username, 'admin': True} | ||
serializer = serializers.OrganizationUserSerializer( | ||
data=data, | ||
context={ | ||
|
@@ -377,7 +378,7 @@ def test_set_roles_with_username(self): | |
def test_set_roles_with_email(self): | ||
user = UserFactory.create() | ||
org = OrganizationFactory.create() | ||
data = {'username': user.email, 'role': 'Admin'} | ||
data = {'username': user.email, 'admin': True} | ||
serializer = serializers.OrganizationUserSerializer( | ||
data=data, | ||
context={ | ||
|
@@ -395,7 +396,7 @@ def test_set_roles_with_email(self): | |
|
||
def test_set_roles_for_user_that_does_not_exist(self): | ||
org = OrganizationFactory.create() | ||
data = {'username': 'some-user', 'role': 'Admin'} | ||
data = {'username': 'some-user', 'admin': True} | ||
serializer = serializers.OrganizationUserSerializer( | ||
data=data, context={'organization': org} | ||
) | ||
|
@@ -410,7 +411,7 @@ def test_set_roles_for_duplicate_username(self): | |
org = OrganizationFactory.create() | ||
user1 = UserFactory.create(email='[email protected]') | ||
UserFactory.create(email='[email protected]') | ||
data = {'username': user1.email, 'role': 'Admin'} | ||
data = {'username': user1.email, 'admin': 'true'} | ||
serializer = serializers.OrganizationUserSerializer( | ||
data=data, context={'organization': org} | ||
) | ||
|
@@ -427,7 +428,7 @@ def test_update_roles_for_user(self): | |
org = OrganizationFactory.create(add_users=[user]) | ||
serializer = serializers.OrganizationUserSerializer( | ||
user, | ||
data={'role': 'Admin'}, | ||
data={'admin': 'True'}, | ||
partial=True, | ||
context={'organization': org} | ||
) | ||
|
@@ -466,7 +467,7 @@ def test_list_to_representation(self): | |
assert len(serializer.data) == 3 | ||
|
||
for u in serializer.data: | ||
if u['username'] is prj_admin.username: | ||
if u['username'] == prj_admin.username: | ||
assert u['role'] == 'PM' | ||
else: | ||
assert u['role'] == 'PU' | ||
|
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