def test_media_storage(self): tmp_storage = MediaStorage() tmp_storage.save(self.test_string) name = tmp_storage.name tmp_storage = MediaStorage(name=name) self.assertEqual(self.test_string, tmp_storage.read()) self.assertTrue(default_storage.exists(tmp_storage.get_full_path())) tmp_storage.remove() self.assertFalse(default_storage.exists(tmp_storage.get_full_path()))
def test_media_storage_read_mode(self): # issue 416 - MediaStorage does not respect the read_mode parameter. test_string = self.test_string.replace(b'\n', b'\r') tmp_storage = MediaStorage() tmp_storage.save(test_string) name = tmp_storage.name tmp_storage = MediaStorage(name=name) self.assertEqual(self.test_string.decode(), tmp_storage.read(read_mode='r'))