assert_json_error_contains: Support passing a status code.

Previously this test helper function hardcoded 400.
This commit is contained in:
Tim Abbott
2016-04-21 12:37:31 -07:00
parent 3cde06ea33
commit 9da73b22d3

View File

@@ -327,8 +327,8 @@ class AuthedTestCase(TestCase):
return self.assertTrue(actual_count <= count,
"len(%s) == %s, > %s" % (queries, actual_count, count))
def assert_json_error_contains(self, result, msg_substring):
self.assertIn(msg_substring, self.get_json_error(result))
def assert_json_error_contains(self, result, msg_substring, status_code=400):
self.assertIn(msg_substring, self.get_json_error(result, status_code=status_code))
def fixture_data(self, type, action, file_type='json'):
return open(os.path.join(os.path.dirname(__file__),