def populate_users_data(self): with app.app_context(): user1 = User() user1.email = "*****@*****.**" user1.password = "******" user1.fname = "harry" user1.lname = "porter" user2 = User() user2.email = "*****@*****.**" user2.password = "******" user2.fname = "don" user2.lname = "john" db.session.add(user1) db.session.add(user2) db.session.commit()
def test_create_user(self): with app.app_context(): user = User() user.email = "*****@*****.**" user.password = "******" db.session.add(user) db.session.commit() # this works assert user in db.session response = self.app.get("/api/user") # this raises an AssertionError assert user in db.session