def setUp(self):
        self.app = Setup.create_app()
        with self.app.test_request_context():
            user = UserFactory()
            save_to_db(user)

            event = EventFactoryBasic()
            event.user_id = user.id
            save_to_db(event)

            # Authenticate User
            self.auth = {'Authorization': "JWT " + create_access_token(user.id, fresh=True)}
    def setUp(self):
        self.app = Setup.create_app()
        with app.test_request_context():
            user = UserFactory()
            db.session.add(user)
            db.session.commit()

            event = EventFactoryBasic()
            event.user_id = user.id
            db.session.add(event)
            db.session.commit()

            # Authenticate User
            self.auth = {'Authorization': "JWT " + str(_default_jwt_encode_handler(user), 'utf-8')}
    def setUp(self):
        self.app = Setup.create_app()
        with app.test_request_context():
            user = UserFactory()
            save_to_db(user)

            event = EventFactoryBasic()
            event.user_id = user.id
            save_to_db(event)

            # Authenticate User
            self.auth = {
                'Authorization':
                "JWT " + str(_default_jwt_encode_handler(user), 'utf-8')
            }
Beispiel #4
0
    def test_get_identity(self):
        with app.test_request_context():
            user = UserFactory()
            db.session.add(user)
            db.session.commit()

            event = EventFactoryBasic()
            event.user_id = user.id
            db.session.add(event)
            db.session.commit()

            # Authenticate User
            self.auth = {'Authorization': "JWT " + _default_jwt_encode_handler(user)}

        with app.test_request_context(headers=self.auth):
            self.assertEquals(get_identity().id, user.id)
Beispiel #5
0
    def setUp(self):
        self.app = Setup.create_app()
        with app.test_request_context():
            user = UserFactory()
            db.session.add(user)
            db.session.commit()

            event = EventFactoryBasic()
            event.user_id = user.id
            db.session.add(event)
            db.session.commit()

            # Authenticate User
            self.auth = {
                'Authorization': "JWT " + _default_jwt_encode_handler(user)
            }
    def test_get_identity(self):
        """Method to test identity of authenticated user"""

        with self.app.test_request_context():
            user = UserFactory()
            save_to_db(user)

            event = EventFactoryBasic()
            event.user_id = user.id
            save_to_db(event)

            # Authenticate User
            self.auth = {'Authorization': "JWT " + create_access_token(user.id, fresh=True)}

        with self.app.test_request_context(headers=self.auth):
            self.assertEquals(get_identity().id, user.id)
Beispiel #7
0
    def test_get_identity(self):
        """Method to test identity of authenticated user"""

        with app.test_request_context():
            user = UserFactory()
            save_to_db(user)

            event = EventFactoryBasic()
            event.user_id = user.id
            save_to_db(event)

            # Authenticate User
            self.auth = {
                'Authorization':
                "JWT " + str(_default_jwt_encode_handler(user), 'utf-8')
            }

        with app.test_request_context(headers=self.auth):
            self.assertEquals(get_identity().id, user.id)