예제 #1
0
파일: flow_test.py 프로젝트: viszsec/grr
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.")
예제 #2
0
    def TestMethod(self, username: Text, db: abstract_db.Database):
      db.WriteGRRUser(username)

      user = db.ReadGRRUser(username)
      self.assertEqual(user.username, username)
예제 #3
0
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)
예제 #4
0
    def TestMethod(db: abstract_db.Database):
      self.assertEqual(db.CountGRRUsers(), 0)

      db.WriteGRRUser("foo")
      self.assertEqual(db.CountGRRUsers(), 1)