'Verify non-GET requests require a CSRF token be attached to the request.'

def test_session_auth_post_requires_csrf_token(self):

    user = UserFactory(password=self.password, is_staff=True)
    client = Client(enforce_csrf_checks=True)
    self.assertTrue(client.login(username=user.username, password=self.password))
    data = {u'course_key': u'a/b/c', u'enabled': True}
    response = client.post(self.path, data=json.dumps(data), content_type=JSON)
    self.assertEqual(response.status_code, 403)
    self.assertIn(u'CSRF', response.content)
    response = client.get(u'/')
    csrf_token = response.cookies[settings.CSRF_COOKIE_NAME].value
    self.assertGreater(len(csrf_token), 0)
    response = client.post(self.path, data=json.dumps(data), content_type=JSON, HTTP_X_CSRFTOKEN=csrf_token)
    self.assertEqual(response.status_code, 201)
