def test_rename(self): de = DirectoryEntry(self.file, 0) with self.assertRaises(ValueError): de.rename("This name is too long, like, so long, is does not fit in 42 chars") test_name = "JFR rocks" de.rename(test_name) self.assertEqual(test_name, de.filename) self.assertEqual(len(test_name), de.namesize)
def test_pack(self): de = DirectoryEntry(self.file, 0) self.assertEqual(self.file, de.pack()) test_name = "JFR rocks" de.rename(test_name) self.filename = test_name self.namesize = len(test_name) self.file = self.pack() self.assertEqual(self.file, de.pack()) de.atr.READONLY = True de.atr.HIDDEN = False de.atr.DIRECTORY = True de.atr.DELETED = True de = DirectoryEntry(de.pack(), 0) self.assertTrue(de.atr.READONLY) self.assertFalse(de.atr.HIDDEN) self.assertTrue(de.atr.DIRECTORY) self.assertTrue(de.atr.DELETED)