'Tests the behavior of patch when a read-only field is attempted to be edited.'

@ddt.unpack
def test_patch_account_noneditable(self):

    client = self.login_client('client', 'user')
    def verify_error_response(field_name, data):
        '\n                                                Internal    helper    to    check    the    error    messages    returned\n                                                '
        self.assertEqual('This    field    is    not    editable    via    this    API', data['field_errors'][field_name]['developer_message'])
        self.assertEqual("The    '{0}'    field    cannot    be    edited.".format(field_name), data['field_errors'][field_name]['user_message'])
    for field_name in ['username', 'date_joined', 'is_active', 'profile_image', 'requires_parental_consent']:
        response = self.send_patch(client, {field_name: 'will_error', 'gender': 'o'}, expected_status=400)
        verify_error_response(field_name, response.data)
    response = self.send_get(client)
    self.assertEqual('m', response.data['gender'])
    response = self.send_patch(client, {'username': 'will_error', 'date_joined': 'xx'}, expected_status=400)
    self.assertEqual(2, len(response.data['field_errors']))
    verify_error_response('username', response.data)
    verify_error_response('date_joined', response.data)
