def testRendersRequestedHuntAppoval(self): with implementation.GRRHunt.StartHunt( hunt_name=standard.SampleHunt.__name__, token=self.token) as hunt: pass self.RequestHuntApproval(hunt.urn.Basename(), reason=self.token.reason, approver="approver", requestor=self.token.username) args = user_plugin.ApiListHuntApprovalsArgs() result = self.handler.Handle(args, token=self.token) self.assertEqual(len(result.items), 1)
def testRendersRequestedHuntAppoval(self): with hunts.GRRHunt.StartHunt(hunt_name=standard.SampleHunt.__name__, token=self.token) as hunt: pass flow.GRRFlow.StartFlow(flow_name="RequestHuntApprovalFlow", reason=self.token.reason, subject_urn=hunt.urn, approver="approver", token=self.token) args = user_plugin.ApiListHuntApprovalsArgs() result = self.handler.Handle(args, token=self.token) self.assertEqual(len(result.items), 1)
def testRendersRequestedHuntAppoval(self): with implementation.GRRHunt.StartHunt( hunt_name=standard.SampleHunt.__name__, token=self.token) as hunt: pass aff4_security.HuntApprovalRequestor(reason=self.token.reason, subject_urn=hunt.urn, approver="approver", token=self.token).Request() args = user_plugin.ApiListHuntApprovalsArgs() result = self.handler.Handle(args, token=self.token) self.assertEqual(len(result.items), 1)
def ListHuntApprovals(self, requestor=None): requestor = requestor or self.token.username handler = api_user.ApiListHuntApprovalsHandler() return handler.Handle( api_user.ApiListHuntApprovalsArgs(), token=access_control.ACLToken(username=requestor)).items