Example #1
0
    def testPassesFlowArgsThroughIfNoOverridesSpecified(self):
        h = rr.ApiRobotCreateFlowHandler(robot_id="foo")

        args = api_flow.ApiCreateFlowArgs(client_id=self.client_id.Basename())
        args.flow.name = file_finder.FileFinder.__name__
        args.flow.args = rdf_file_finder.FileFinderArgs(paths=["foo"])

        f = h.Handle(args=args, token=self.token)
        self.assertEqual(f.args.paths, ["foo"])
Example #2
0
    def _CreateFlowWithRobotId(self, flow_name=None, flow_args=None):
        flow_name = flow_name or file_finder.FileFinder.__name__

        handler = rr.ApiRobotCreateFlowHandler(robot_id=self.robot_id)
        flow_result = handler.Handle(api_flow.ApiCreateFlowArgs(
            client_id=self.client_id,
            flow=api_flow.ApiFlow(name=flow_name, args=flow_args)),
                                     token=self.token)
        return flow_result.flow_id
Example #3
0
    def testOverridesFlowArgsThroughIfOverridesSpecified(self):
        override_flow_args = rdf_file_finder.FileFinderArgs(paths=["bar"])
        h = rr.ApiRobotCreateFlowHandler(override_flow_args=override_flow_args)

        args = api_flow.ApiCreateFlowArgs(client_id=self.client_id)
        args.flow.name = file_finder.FileFinder.__name__
        args.flow.args = rdf_file_finder.FileFinderArgs(paths=["foo"])

        f = h.Handle(args=args, context=self.context)
        self.assertEqual(f.args.paths, ["bar"])
Example #4
0
    def testOverridesFlowNameIfOverrideArgIsSpecified(self):
        h = rr.ApiRobotCreateFlowHandler(
            override_flow_name=AnotherFileFinder.__name__)  # pylint: disable=undefined-variable

        args = api_flow.ApiCreateFlowArgs(client_id=self.client_id)
        args.flow.name = file_finder.FileFinder.__name__
        args.flow.args = rdf_file_finder.FileFinderArgs(paths=["foo"])

        f = h.Handle(args=args, context=self.context)
        self.assertEqual(f.name, AnotherFileFinder.__name__)  # pylint: disable=undefined-variable