def test_get_random_filename_without_owner(self): reload(models) instance = models.FileHistory() filename = 'test_file.xls' today = date.today().strftime("%Y/%m/%d") rand_filename = models.get_random_filename(instance, filename) expected_name = 'upload_history/anonymous/%s/fake_uuid4.xls' % today self.assertEqual(rand_filename, expected_name)
def test_get_random_filename_without_owner(self): try: reload(models) except RuntimeError: return True instance = models.FileHistory() filename = 'test_file.xls' today = date.today().strftime("%Y/%m/%d") rand_filename = models.get_random_filename(instance, filename) expected_name = 'upload_history/anonymous/{0!s}/fake_uuid4.xls'.format(today) self.assertEqual(rand_filename, expected_name)