Skip to content

Commit 638f757

Browse files
mrsaicharan1abhinavk96
authored andcommitted
Added test for authentication (#5517)
* Added package in local installation docs * Added test for authentication * Added docstring for auth test * Unused modules of auth test removed * Changed module import style * test exception handled * User import * Whitespace commit
1 parent a937775 commit 638f757

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
from app import current_app as app
2+
from tests.all.integration.auth_helper import create_user
3+
from tests.all.integration.utils import OpenEventTestCase
4+
from app.api.helpers import auth
5+
from tests.all.integration.setup_database import Setup
6+
from app.models import db
7+
from app.models.user import User
8+
9+
import unittest
10+
11+
12+
class TestAuthentication(OpenEventTestCase):
13+
def setUp(self):
14+
self.app = Setup.create_app()
15+
16+
def test_load_user(self):
17+
"""Method to test the registered user details"""
18+
19+
with app.test_request_context():
20+
auth_manager = auth.AuthManager()
21+
auth_manager.init_login(app)
22+
user = create_user(email='[email protected]', password='password')
23+
self.assertEqual(user, db.session.query(User).get(user.id))
24+
25+
26+
if __name__ == '__main__':
27+
unittest.main()

0 commit comments

Comments
 (0)