'Integration happy-path test that a model FileField can actually be set
and cleared via a ModelForm.'

def test_full_clear(self):

    form = DocumentForm()
    self.assertTrue(('name="myfile"' in unicode(form)))
    self.assertTrue(('myfile-clear' not in unicode(form)))
    form = DocumentForm(files={'myfile': SimpleUploadedFile('something.txt', 'content')})
    self.assertTrue(form.is_valid())
    doc = form.save(commit=False)
    self.assertEqual(doc.myfile.name, 'something.txt')
    form = DocumentForm(instance=doc)
    self.assertTrue(('myfile-clear' in unicode(form)))
    form = DocumentForm(instance=doc, data={'myfile-clear': 'true'})
    doc = form.save(commit=False)
    self.assertEqual(bool(doc.myfile), False)
