'Test invalid json handling.'

def test_invalid_json(self):

    invalid_json = "{u'name':    'Test    Name',    []}"
    response = self.client.post(self._url(), data=invalid_json, content_type='application/json', HTTP_ACCEPT='application/json', HTTP_X_REQUESTED_WITH='XMLHttpRequest')
    self.assertEqual(response.status_code, 400)
    self.assertNotIn('Location', response)
    content = json.loads(response.content)
    self.assertIn('error', content)
