'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((u'name="myfile"' in six.text_type(form)))
    self.assertTrue((u'myfile-clear' not in six.text_type(form)))
    form = DocumentForm(files={u'myfile': SimpleUploadedFile(u'something.txt', 'content')})
    self.assertTrue(form.is_valid())
    doc = form.save(commit=False)
    self.assertEqual(doc.myfile.name, u'something.txt')
    form = DocumentForm(instance=doc)
    self.assertTrue((u'myfile-clear' in six.text_type(form)))
    form = DocumentForm(instance=doc, data={u'myfile-clear': u'true'})
    doc = form.save(commit=False)
    self.assertEqual(bool(doc.myfile), False)
