In a python unit test (actually Django), what is the correct assert
statement that will tell me if my test result contains a string of my choosing?
self.assertContainsTheString(result, {"car" : ["toyota","honda"]})
I want to make sure that my result
contains at least the json object (or string) that I specified as the second argument above
{"car" : ["toyota","honda"]}
self.assertContains(result, "abcd")
You can modify it to work with json.
Use self.assertContains
only for HttpResponse
objects. For other objects, use self.assertIn
.