Exemplo n.º 1
0
    def setUp(self):
        super(ApiModifyHuntHandlerTest, self).setUp()

        self.handler = hunt_plugin.ApiModifyHuntHandler()

        self.hunt_id = self.CreateHunt(description="the hunt")

        self.args = hunt_plugin.ApiModifyHuntArgs(hunt_id=self.hunt_id)
Exemplo n.º 2
0
    def Run(self):
        # Check client_limit update.
        with test_lib.FakeTime(42):
            hunt = self.CreateHunt(description="the hunt")

        # Create replace dictionary.
        replace = {hunt.urn.Basename(): "H:123456"}

        with test_lib.FakeTime(43):
            self.Check("ModifyHunt",
                       args=hunt_plugin.ApiModifyHuntArgs(
                           hunt_id=hunt.urn.Basename(), client_limit=142),
                       replace=replace)
            self.Check("ModifyHunt",
                       args=hunt_plugin.ApiModifyHuntArgs(
                           hunt_id=hunt.urn.Basename(), state="STOPPED"),
                       replace=replace)
Exemplo n.º 3
0
    def Run(self):
        # Check client_limit update.
        with test_lib.FakeTime(42):
            if data_store.RelationalDBEnabled():
                hunt_id = self.CreateHunt(description="the hunt")
            else:
                hunt_obj = self.CreateHunt(description="the hunt")
                hunt_id = hunt_obj.urn.Basename()

        # Create replace dictionary.
        replace = {hunt_id: "H:123456"}

        with test_lib.FakeTime(43):
            self.Check("ModifyHunt",
                       args=hunt_plugin.ApiModifyHuntArgs(hunt_id=hunt_id,
                                                          client_limit=142),
                       replace=replace)
            self.Check("ModifyHunt",
                       args=hunt_plugin.ApiModifyHuntArgs(hunt_id=hunt_id,
                                                          state="STOPPED"),
                       replace=replace)
Exemplo n.º 4
0
    def setUp(self):
        super(ApiModifyHuntHandlerTest, self).setUp()

        self.handler = hunt_plugin.ApiModifyHuntHandler()

        if data_store.RelationalDBEnabled():
            self.hunt_id = self.CreateHunt(description="the hunt")
        else:
            self.hunt_obj = self.CreateHunt(description="the hunt")
            self.hunt_urn = self.hunt_obj.urn
            self.hunt_id = self.hunt_urn.Basename()

        self.args = hunt_plugin.ApiModifyHuntArgs(hunt_id=self.hunt_id)
    def testModifyHuntIsAccessChecked(self):
        args = api_hunt.ApiModifyHuntArgs(hunt_id="H:123456")

        self.CheckMethodIsAccessChecked(self.router.ModifyHunt,
                                        "CheckHuntAccess",
                                        args=args)