'When fields are excluded the value of the field should not be set to a
default value if updated by tastypie.'

def test_patch_detail_with_missing_related_fields(self):

    resource = NoteWithUpdatableUserResource()
    note = Note.objects.create(author_id=1)
    user = User.objects.get(pk=1)
    self.assertEqual(user.password, 'this_is_not_a_valid_password_string')
    request = MockRequest()
    request.GET = {'format': 'json'}
    request.method = 'PATCH'
    request.path = ('/v1/noteswithupdatableuser/%(pk)s/' % {'pk': note.pk})
    data = {'author': {'id': 1, 'username': 'johndoe', 'email': 'john@doetown.com'}}
    request.set_body(json.dumps(data))
    resp = resource.patch_detail(request, pk=note.pk)
    self.assertEqual(resp.status_code, 202)
    user2 = User.objects.get(pk=1)
    self.assertEqual(user2.email, 'john@doetown.com')
    self.assertEqual(user2.password, 'this_is_not_a_valid_password_string')
