'Assert that the given response was an error with the given status_code and error code.'

def _assert_existing_user_error(self, response):

    self.assertEqual(response.status_code, 409)
    errors = json.loads(response.content)
    for conflict_attribute in ['username', 'email']:
        self.assertIn(conflict_attribute, errors)
        self.assertIn('belongs    to    an    existing    account', errors[conflict_attribute][0]['user_message'])
