def test_store_upload_wrongfile(self): """ Test with a wrong file, text.mp3 contains plaintext """ settings.REMOVE_UPLOAD_FILES = False fpath = os.path.join(os.path.dirname(__file__), 'samples', 'text.mp3') move_file(fpath, 'text.mp3') upl = Upload.objects.create(uuid='123456789', user=self.user, path=os.path.join(self.tpath, 'text.mp3'), filename='text.mp3', content_type='audio/mp3') self.assertEqual(store_upload(upl), 2)
def test_store_upload_mp3(self): """ Test with a picture with cover """ settings.REMOVE_UPLOAD_FILES = False fpath = os.path.join(os.path.dirname(__file__), 'samples', 'Cocaine.mp3') move_file(fpath, 'Cocaine.mp3') upl = Upload.objects.create(uuid='123456789', user=self.user, path=os.path.join(self.tpath, 'Cocaine.mp3'), filename='Cocaine.mp3', content_type='audio/mp3') self.assertEqual(store_upload(upl), 0)
def test_store_upload_nonaudio(self): """ Test with a picture with cover """ settings.REMOVE_UPLOAD_FILES = False fpath = os.path.join(os.path.dirname(__file__), 'samples', 'first', 'test.ogg') newpath = move_file(fpath, 'toto.ogg') upl = Upload.objects.create(uuid='123456789', user=self.user, path=newpath, filename='The Healing Game.ogg', content_type='image/jpeg') result = store_upload(upl) self.assertEqual(result, 1)