def test_adding_media(self):
        image = MediaUpload(caption="", media=self.test_file, creator=self.user)
        image.save()
        self.cleanup_files.append(image.media.name)

        self.g.add_media(image)
        
        self.assertTrue(image in self.g.media.all())
 def test_remove_media(self):
     im = MediaUpload(caption="", media=self.test_file, creator=self.user)
     im.save()
     self.cleanup_files.append(im.media.name)
     
     self.g.add_media(im)
     self.assertTrue(im in self.g.media.all())
     
     self.g.remove_media(im)
     self.assertTrue(im not in self.g.media.all())
 def test_adding_multiple_media(self):
     im1 = MediaUpload(caption="", media=self.test_file, creator=self.user)
     im1.save()
     im2 = MediaUpload(caption="", media=self.test_file, creator=self.user)
     im2.save()
     im3 = MediaUpload(caption="", media=self.test_file, creator=self.user)
     im3.save()
     self.cleanup_files.extend([im.media.name for im in [im1, im2, im3]])
     
     self.g.add_media(im1)
     self.g.add_media(im2)
     self.g.add_media(im3)
     
     all_media = self.g.media.all()
     
     self.assertTrue(im1 in all_media)
     self.assertTrue(im2 in all_media)
     self.assertTrue(im3 in all_media)