Commit ae55cd75 by Don Mitchell

One more unit test for json not containing expected fields.

parent 9413364e
...@@ -63,10 +63,18 @@ class CourseUpdateTest(CourseTestCase): ...@@ -63,10 +63,18 @@ class CourseUpdateTest(CourseTestCase):
payload = json.loads(resp.content) payload = json.loads(resp.content)
self.assertTrue(len(payload) == 2) self.assertTrue(len(payload) == 2)
# can't test non-json paylod b/c expect_json throws error
# try json w/o required fields
self.assertContains(
self.client.post(url, json.dumps({'garbage': 1}),
"application/json"),
'Failed to save', status_code=400)
# now try to update a non-existent update # now try to update a non-existent update
url = reverse('course_info_json', kwargs={'org': self.course_location.org, url = reverse('course_info_json',
'course': self.course_location.course, kwargs={'org': self.course_location.org,
'provided_id': '9'}) 'course': self.course_location.course,
'provided_id': '9'})
content = 'blah blah' content = 'blah blah'
payload = {'content': content, payload = {'content': content,
'date': 'January 21, 2013'} 'date': 'January 21, 2013'}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment