Beispiel #1
0
    def Run(self):
        with test_lib.FakeTime(42):
            hunt_id = self.CreateHunt(description="the hunt")

        self.Check("DeleteHunt",
                   args=hunt_plugin.ApiDeleteHuntArgs(hunt_id=hunt_id),
                   replace={hunt_id: "H:123456"})
Beispiel #2
0
    def setUp(self):
        super(ApiDeleteHuntHandlerTest, self).setUp()

        self.handler = hunt_plugin.ApiDeleteHuntHandler()

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

        self.args = hunt_plugin.ApiDeleteHuntArgs(hunt_id=self.hunt_id)
    def testDeleteHuntIsAccessCheckedIfUserIsNotCreator(self):
        hunt_id = self.CreateHunt(creator=self.context.username)
        args = api_hunt.ApiDeleteHuntArgs(hunt_id=hunt_id)

        self.CheckMethodIsAccessChecked(
            self.router.DeleteHunt,
            "CheckHuntAccess",
            args=args,
            context=api_call_context.ApiCallContext("foo"))
Beispiel #4
0
    def testDeleteHuntIsAccessCheckedIfUserIsNotCreator(self):
        hunt = self.CreateHunt()
        args = api_hunt.ApiDeleteHuntArgs(hunt_id=hunt.urn.Basename())

        self.CheckMethodIsAccessChecked(
            self.router.DeleteHunt,
            "CheckHuntAccess",
            args=args,
            token=access_control.ACLToken(username="******"))
    def Run(self):
        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()

        self.Check("DeleteHunt",
                   args=hunt_plugin.ApiDeleteHuntArgs(hunt_id=hunt_id),
                   replace={hunt_id: "H:123456"})
Beispiel #6
0
    def setUp(self):
        super(ApiDeleteHuntHandlerTest, self).setUp()

        self.handler = hunt_plugin.ApiDeleteHuntHandler()

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

        self.args = hunt_plugin.ApiDeleteHuntArgs(hunt_id=self.hunt_id)
Beispiel #7
0
 def testRaisesIfHuntNotFound(self):
     with self.assertRaises(hunt_plugin.HuntNotFoundError):
         self.handler.Handle(
             hunt_plugin.ApiDeleteHuntArgs(hunt_id="H:123456"),
             token=self.token)
    def testDeleteHuntIsNotAccessCheckedIfUserIsCreator(self):
        hunt_id = self.CreateHunt(creator=self.context.username)
        args = api_hunt.ApiDeleteHuntArgs(hunt_id=hunt_id)

        self.CheckMethodIsNotAccessChecked(self.router.DeleteHunt, args=args)
 def testDeleteHuntRaisesIfHuntNotFound(self):
     args = api_hunt.ApiDeleteHuntArgs(hunt_id="H:123456")
     with self.assertRaises(api_call_handler_base.ResourceNotFoundError):
         self.router.DeleteHunt(args, context=self.context)
Beispiel #10
0
    def testDeleteHuntIsNotAccessCheckedIfUserIsCreator(self):
        hunt = self.CreateHunt()
        args = api_hunt.ApiDeleteHuntArgs(hunt_id=hunt.urn.Basename())

        self.CheckMethodIsNotAccessChecked(self.router.DeleteHunt, args=args)