def tearDown(self):
        with auth.database_session() as session:
            user = session.query(
                self.user.__class__).filter_by(username=self.username).first()
            if user is not None:
                session.delete(user)

        TestAuth.tearDown(self)
    def test_user_query_no_user_found(self, mock_verify):
        with auth.database_session() as session:
            user = session.query(
                self.user.__class__).filter_by(username=self.username).first()
            session.delete(user)

        self.assertFalse(auth.verify_password(self.username, self.password))

        self.assertFalse(mock_verify.called)
    def tearDown(self):
        with auth.database_session() as session:
            user = session.query(self.user.__class__).filter_by(
                username=self.username
            ).first()
            if user is not None:
                session.delete(user)

        TestAuth.tearDown(self)
    def test_user_query_no_user_found(self, mock_verify):
        with auth.database_session() as session:
            user = session.query(self.user.__class__).filter_by(
                username=self.username
            ).first()
            session.delete(user)

        self.assertFalse(auth.verify_password(
            self.username, self.password))

        self.assertFalse(mock_verify.called)
    def setUp(self):
        TestAuth.setUp(self)

        self.user = User(self.username, self.password, self.email)

        auth.g = mock.MagicMock()

        with auth.database_session() as session:
            session.add(self.user)

        self.user = self.user.__class__(self.username, self.password,
                                        self.email)
    def setUp(self):
        TestAuth.setUp(self)
        self.user = User(self.username, self.password, self.email)
        self.token_string = str(uuid1())

        self.token = Token(self.token_string, owner=self.user)

        with auth.database_session() as session:
            session.add(self.user)
            session.add(self.token)

        auth.g = mock.MagicMock()
    def setUp(self):
        TestAuth.setUp(self)
        self.user = User(self.username, self.password, self.email)
        self.token_string = str(uuid1())

        self.token = Token(self.token_string, owner=self.user)

        with auth.database_session() as session:
            session.add(self.user)
            session.add(self.token)

        auth.g = mock.MagicMock()
    def setUp(self):
        TestAuth.setUp(self)

        self.user = User(self.username, self.password, self.email)

        auth.g = mock.MagicMock()

        with auth.database_session() as session:
            session.add(self.user)

        self.user = self.user.__class__(
            self.username, self.password, self.email
        )