def test_change_password(): copyfile(DB_ORIGIN, DB_FILE) pdb = PassDB(DB_FILE) user = pdb["naota"] user.set_password("hogefuga") pdb["naota"] = user pdb.close() db = tdb.open(DB_FILE) assert unpack_user(db["USER_naota\x00"]).nt_pw == \ nthash("hogefuga").decode("hex") db.close()
def __iter__(self): for x in self.db: if x.startswith("USER_"): yield unpack_user(self.db[x])
def __getitem__(self, name): return unpack_user(self.db[userkey(name)])
def pytest_funcarg__user_bin(): return unpack_user(blob)