def test_GetChangedMeta(self): target_root = '/tmp/work/__TEST__' target_dummy = os.path.join(target_root, 'a.dummy') self.__MakeDummy(target_dummy, 1024) self.assertTrue(hasattr(Directory, 'GetChangedMeta')) self.assertTrue(hasattr(Directory, 'GetCreated')) print(Directory.GetChangedMeta(target_dummy)) print(Directory.GetCreated(target_dummy)) Directory.Delete(target_root)
def test_Accessed_Get_Set(self): target_root = '/tmp/work/__TEST__' target_dummy = os.path.join(target_root, 'a.dummy') self.__MakeDummy(target_dummy, 1024) self.assertTrue(tuple == type(Directory.GetAccessed(target_dummy))) self.assertTrue(2 == len(Directory.GetAccessed(target_dummy))) self.assertTrue(float == type(Directory.GetAccessed(target_dummy)[0])) self.assertTrue(datetime.datetime == type(Directory.GetAccessed(target_dummy)[1])) dt1 = datetime.datetime.strptime('1999/12/31 23:59:59', '%Y/%m/%d %H:%M:%S') dt2 = datetime.datetime.strptime('2345/01/02 12:34:56', '%Y/%m/%d %H:%M:%S') epoch, dt = Directory.GetAccessed(target_dummy) self.assertTrue(dt1 != dt) self.assertTrue(dt2 != dt) Directory.SetAccessed(target_dummy, dt1) self.assertTrue(int(time.mktime(dt1.timetuple())) == Directory.GetAccessed(target_dummy)[0]) self.assertTrue(dt1 == Directory.GetAccessed(target_dummy)[1]) self.assertTrue(dt1 != Directory.GetModified(target_dummy)[1]) self.assertTrue(dt1 != Directory.GetChangedMeta(target_dummy)[1]) Directory.Delete(target_root)