title: Testing Django Models with FileField
body: <p>I'm trying to make the transition to testing with Django.  This is the particular model in question for testing:</p>
  
  <pre><code>class Media(models.Model):
      file = models.FileField(upload_to='upload',)
      thumbnail = models.ImageField(upload_to='upload', blank=True,)
  
      # ...
  </code></pre>
  
  <p>PART 1:  How do I deal with these FileFields? (Particularly in the sense that I need to generate fake entries to test bits of code)</p>
  
  <p>PART 2:  Below is the testing code I've begun to write.  Am I doing this correctly or should I be using a form of "mocking"?</p>
  
  <pre><code>from django.test import TestCase
  from django.test.client import Client
  
  from django.contrib.auth.models import User
  from mediamanager.models import Media
  
  class MediaManagerTestCase(TestCase):
  
      def setUp(self):
          self.fake_user = User.objects.create(username='fakeuser', is_staff=false)   
          self.fake_staff = User.objects.create(username='fakestaff', is_staff=true)    
          self.fake_admin = User.objects.create(username='fakeadmin', is_superuser=true)
  
          self.fake_media_image = Media.objects.create()  # Hmmm...
          self.fake_media_video = Media.objects.create()  # How do i do this...
  
      def testMediaCanEdit(self):
          perm = self.fake_media_image.can_edit(self.fake_user)
          self.assertEquals(perm, false)
  </code></pre>