def __init__(self, raw_event): # TODO : clean up this idiotic hack # we should use keyword constructors instead of this behaviour checking # bs to initialize BaseEvent if hasattr(raw_event,"pathname"): self._raw_event = raw_event self.path = os.path.normpath(raw_event.pathname) else: self.path = raw_event self.owner = owners.get_owner(self.path) self._pack_hook = lambda: None # no op
def test_get_owner(self): owners.reset_owners() self.assertTrue(owners.add_file_owner(self.f, 123)) self.assertEqual(owners.get_owner(self.f), 123, "file is owned") self.assertEqual(owners.get_owner("random_stuff.txt"), -1, "file is not owned")