Esempio n. 1
0
    def test_delete_user(self):
        with self.app.app_context():
            user = User.delete("user1")

            self.assertIsNotNone(user)
            self.assertIsNotNone(user.id)
            self.assertEqual(user.username, "user1")

            try:
                db.session.commit()
            except SQLAlchemyError:
                db.session.rollback()
                self.fail("failed to commit transaction")

            self.assertEqual(db.session.query(User).count(), 0)
Esempio n. 2
0
    def run(self, username):
        User.delete(username)

        db.session.commit()