'Helper function that checks that the response object
has a body with the provided field errors'

def expect_error_fields(self, expected_field_errors, resp_obj):

    self.assertEqual(resp_obj.status_code, status.HTTP_400_BAD_REQUEST)
    self.assertIn('field_errors', resp_obj.data)
    resp_dict_error = {}
    for (field_name, error_dict) in resp_obj.data['field_errors'].iteritems():
        resp_dict_error[field_name] = error_dict.get('error_code', '')
    self.assertEqual(expected_field_errors, resp_dict_error)
