def _CreateToken(db: abstract_db.Database) -> access_control.ACLToken: username = "".join(random.choice("abcdef") for _ in range(8)) db.WriteGRRUser(username) return access_control.ACLToken(username=username, reason="Lorem ipsum.")
def TestMethod(self, username: Text, db: abstract_db.Database): db.WriteGRRUser(username) user = db.ReadGRRUser(username) self.assertEqual(user.username, username)
def _CreateContext( db: abstract_db.Database) -> api_call_context.ApiCallContext: username = "".join(random.choice("abcdef") for _ in range(8)) db.WriteGRRUser(username) return api_call_context.ApiCallContext(username)
def TestMethod(db: abstract_db.Database): self.assertEqual(db.CountGRRUsers(), 0) db.WriteGRRUser("foo") self.assertEqual(db.CountGRRUsers(), 1)