Edit: 10-05-2014:
An alternative method is to repeat messages in the context of the response. Using the Django test client, response message elements can be parsed using:
for message in response.context['messages']:
Returns each Django Message object, then you can query the attributes for your tests. This is a cleaner alternative to the original option.
Original solution:
For archiving purposes, the original working solution was to interrogate cookies in response files. This is less clean than the new solution.
self.assertTrue('Account verified' in response.cookies['messages'].value)
in unittest. This seems like a rather ugly solution, but since there will be no other โVerified accountโ or other simultaneous message, then it will be acceptable.
jvc26 source share