def test_logout(self): u = UserModel(name="Test User", email="*****@*****.**", password="******") db.session.add(u) db.session.commit() with client.session_transaction() as sess: sess["user_id"] = int(u.get_id()) sess["_fresh"] = True response = client.get("/logout", follow_redirects=True) self.assertTrue(b"Farm Fresh Produce", response.data)
def test_submit_feedback(self): u = UserModel(name="Test User", email="*****@*****.**", password="******") db.session.add(u) db.session.commit() with client.session_transaction() as sess: sess["user_id"] = int(u.get_id()) sess["_fresh"] = True response = client.get("/feedback") self.assertTrue(b"Test User, your feedback is appreciated!", response.data) feedback = self.feedback(5, True, True, False, False, "Test Comment", 1) self.assertTrue(b"Thanks for your feedback, Test User.", response.data)
def test_provide_multiple_feedback_in_one_session(self): u = UserModel(name="Test User", email="*****@*****.**", password="******") db.session.add(u) db.session.commit() with client.session_transaction() as sess: sess["user_id"] = int(u.get_id()) sess["_fresh"] = True client.get("/feedback") self.feedback(5, True, True, False, False, "Test Comment", 1) client.get("/") response = client.get("/feedback") self.assertTrue( b"Thanks, Test User! We have recorded your recent feedback.", response.data)