Reputation: 1723
I am new to Flask and have recently started working on a project. After I've fixed some issues related to dialogs and views the client asked to write unittests to verify the resolutions. I've gone through some already written tests but they mostly just check the status code of http response, like this:
def test_home_page(self):
rv = self.client.get('/home')
self.assertEqual(rv._status_code, 200, rv._status_code)
Lets say my application has some hyper-links and on clicking these links, different dialog boxes open (e.g. on clicking Forgot Password link, reset password dialog-box). Can we write a test to check if it's opening properly or not?
Similarly on entering different inputs (like leaving the email adress blank, entering invalid / non-existing / valid+existing email addresses) different flash messages appear. How can we write a test to verify that the appropriate flash message is displayed? I guess we've to check this in sessions?
Looking for help.
Thanks a lot.
Upvotes: 1
Views: 392