Skip to content
Snippets Groups Projects
Commit 4c304f1d authored by David Baumgold's avatar David Baumgold
Browse files

Add unit test for failure case

parent 6c313339
No related merge requests found
......@@ -41,7 +41,6 @@ class TextbookTestCase(CourseTestCase):
{"tab_title": "Hi, mom!"},
{"tab_title": "Textbook 2"},
]
# import nose; nose.tools.set_trace()
resp = self.client.post(
self.url,
data=json.dumps(textbooks),
......@@ -57,6 +56,18 @@ class TextbookTestCase(CourseTestCase):
course = store.get_item(self.course.location)
self.assertEqual(course.pdf_textbooks, textbooks)
def test_view_index_xhr_post_invalid(self):
resp = self.client.post(
self.url,
data="invalid",
content_type="application/json",
HTTP_ACCEPT="application/json",
HTTP_X_REQUESTED_WITH='XMLHttpRequest'
)
self.assertEqual(resp.status_code, 400)
obj = json.loads(resp.content)
self.assertIn("error", obj)
class TextbookValidationTestCase(TestCase):
def test_happy_path(self):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment