'Check that you can\'t save invalid JSON'

def test_view_index_xhr_put_invalid(self):

    resp = self.client.put(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)
