Skip to content
27 changes: 27 additions & 0 deletions tests/all/integration/api/helpers/test_auth.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
from app import current_app as app
from tests.all.integration.auth_helper import create_user
from tests.all.integration.utils import OpenEventTestCase
from app.api.helpers import auth
from tests.all.integration.setup_database import Setup
from app.models import db
from app.models.user import User

import unittest


class TestAuthentication(OpenEventTestCase):
def setUp(self):
self.app = Setup.create_app()

def test_load_user(self):
"""Method to test the registered user details"""

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


if __name__ == '__main__':
unittest.main()