Skip to content

Commit

Permalink
tests: fix more tests for 0.8 code removal
Browse files Browse the repository at this point in the history
  • Loading branch information
ergo committed Feb 18, 2018
1 parent 3008439 commit 9566ba4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
3 changes: 2 additions & 1 deletion ziggurat_foundations/tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
User, Group, UserGroup, GroupPermission, UserPermission,
UserResourcePermission, GroupResourcePermission, Resource,
ExternalIdentity, TestResource, TestResourceB)
from ziggurat_foundations.models.services.user import UserService


def check_one_in_other(first, second):
Expand All @@ -18,7 +19,7 @@ def check_one_in_other(first, second):
def add_user(db_session, user_name='username', email='email',
perms=['root', 'alter_users']):
user = User(user_name=user_name, email=email, status=0)
user.set_password('password')
UserService.set_password(user, 'password')
for perm in perms:
u_perm = UserPermission(perm_name=perm)
user.user_permissions.append(u_perm)
Expand Down
6 changes: 3 additions & 3 deletions ziggurat_foundations/tests/test_permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,17 +395,17 @@ def test_resource_users_limited_group_ownage(self, db_session):

def test_users_for_perms(self, db_session):
user = User(user_name='aaa', email='aaa', status=0)
user.set_password('password')
UserService.set_password(user, 'password')
aaa_perm = UserPermission(perm_name='aaa')
bbb_perm = UserPermission(perm_name='bbb')
bbb2_perm = UserPermission(perm_name='bbb')
user.user_permissions.append(aaa_perm)
user.user_permissions.append(bbb_perm)
user2 = User(user_name='bbb', email='bbb', status=0)
user2.set_password('password')
UserService.set_password(user2, 'password')
user2.user_permissions.append(bbb2_perm)
user3 = User(user_name='ccc', email='ccc', status=0)
user3.set_password('password')
UserService.set_password(user3, 'password')
group = add_group(db_session, )
group.users.append(user3)
db_session.add(user)
Expand Down
4 changes: 2 additions & 2 deletions ziggurat_foundations/tests/test_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ def test_user_repr(self, db_session):

def test_check_password_correct(self, db_session):
user = add_user(db_session)
assert user.check_password('password') is True
assert UserService.check_password(user, 'password') is True

def test_check_password_wrong(self, db_session):
user = add_user(db_session)
assert user.check_password('wrong_password') is False
assert UserService.check_password(user, 'wrong_password') is False

def test_by_user_name_existing(self, db_session):
created_user = add_user(db_session)
Expand Down

0 comments on commit 9566ba4

Please sign in to comment.