Пример #1
0
    def testApproverInputShowsAutocompletion(self):
        self.CreateUser("sanchezrick")

        # add decoy user, to assure that autocompletion results are based on the
        # query
        self.CreateUser("aaa")

        client_id = self.SetupClient(0)
        self.Open("/#/clients/%s/host-info" % client_id)

        # We do not have an approval, so we need to request one.
        self.Click("css=button[name=requestApproval]")

        input_selector = "css=grr-approver-input input"

        self.Type(input_selector, "sanchez")

        self.WaitUntil(self.IsElementPresent,
                       "css=[uib-typeahead-popup]:contains(sanchezrick)")

        self.GetElement(input_selector).send_keys(keys.Keys.ENTER)

        self.WaitUntilEqual("sanchezrick, ", self.GetValue,
                            input_selector + ":text")

        self.Type("css=grr-request-approval-dialog input[name=acl_reason]",
                  "Test")
        self.Click(
            "css=grr-request-approval-dialog button[name=Proceed]:not([disabled])"
        )

        # "Request Approval" dialog should go away
        self.WaitUntilNot(self.IsVisible, "css=.modal-open")

        handler = user_plugin.ApiListClientApprovalsHandler()
        args = user_plugin.ApiListClientApprovalsArgs(client_id=client_id)
        res = handler.Handle(args=args,
                             context=api_call_context.ApiCallContext(
                                 self.test_username))
        self.assertLen(res.items, 1)
        self.assertLen(res.items[0].notified_users, 1)
        self.assertEqual(res.items[0].notified_users[0], "sanchezrick")
 def ListClientApprovals(self, args, context=None):
     return api_user.ApiListClientApprovalsHandler()
Пример #3
0
 def setUp(self):
   super(ApiListClientApprovalsHandlerTest, self).setUp()
   self.handler = user_plugin.ApiListClientApprovalsHandler()
   self.client_ids = self.SetupClients(self.CLIENT_COUNT)
Пример #4
0
 def ListClientApprovals(self, requestor=None):
     requestor = requestor or self.token.username
     handler = api_user.ApiListClientApprovalsHandler()
     return handler.Handle(
         api_user.ApiListClientApprovalsArgs(),
         token=access_control.ACLToken(username=requestor)).items
Пример #5
0
 def ListClientApprovals(self, requestor=None):
     requestor = requestor or self.token.username
     handler = api_user.ApiListClientApprovalsHandler()
     return handler.Handle(
         api_user.ApiListClientApprovalsArgs(),
         context=api_call_context.ApiCallContext(username=requestor)).items