Skip to content

Commit

Permalink
modified test_auth to pytest
Browse files Browse the repository at this point in the history
  • Loading branch information
me-diru committed Feb 11, 2020
1 parent 76a5942 commit 35d50fa
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tests/all/integration/api/helpers/test_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def test_load_user(self):

with self.app.test_request_context():
user = create_user(email='[email protected]', password='password')
self.assertEqual(user, db.session.query(User).get(user.id))
assert user == db.session.query(User).get(user.id)

def test_verified_user(self):
"""Method to test if user is verified"""
Expand All @@ -24,7 +24,7 @@ def test_verified_user(self):
user = create_user(email='[email protected]', password='password')
user.is_verified = False
login_user(user)
self.assertEqual(AuthManager.is_verified_user(), False)
assert AuthManager.is_verified_user() == False

def test_is_accessible(self):
"""Method to test if user is accessible(authenticated)"""
Expand All @@ -33,7 +33,7 @@ def test_is_accessible(self):
user = create_user(email='[email protected]', password='password')
login_user(user)
logout_user()
self.assertEqual(AuthManager.is_accessible(), False)
assert AuthManager.is_accessible() == False

def test_check_auth_admin(self):
"""Method to test proper authentication & admin rights for a user"""
Expand All @@ -42,12 +42,12 @@ def test_check_auth_admin(self):
user = create_user(email='[email protected]', password='password')
user.is_admin = True
status = AuthManager.check_auth_admin('[email protected]', 'password')
self.assertEqual(True, status)
assert True == status

user = create_user(email='[email protected]', password='password')
user.is_admin = False
status = AuthManager.check_auth_admin('[email protected]', 'password')
self.assertEqual(False, status)
assert False == status


if __name__ == '__main__':
Expand Down

0 comments on commit 35d50fa

Please sign in to comment.