Esempio n. 1
0
    def testGetFlowFilesArchiveReturnsNonLimitedHandlerForArtifactsWhenNeeded(
            self):
        router = self._CreateRouter(
            artifact_collector_flow=rr.RobotRouterArtifactCollectorFlowParams(
                artifact_collector_flow_name=AnotherArtifactCollector.__name__
            ),
            get_flow_files_archive=rr.RobotRouterGetFlowFilesArchiveParams(
                enabled=True,
                skip_glob_checks_for_artifact_collector=True,
                path_globs_blacklist=["**/*.txt"],
                path_globs_whitelist=["foo/*", "bar/*"]))

        flow_id = self._CreateFlowWithRobotId()
        handler = router.GetFlowFilesArchive(
            api_flow.ApiGetFlowFilesArchiveArgs(client_id=self.client_id,
                                                flow_id=flow_id),
            token=self.token)
        self.assertEqual(handler.path_globs_blacklist, ["**/*.txt"])
        self.assertEqual(handler.path_globs_whitelist, ["foo/*", "bar/*"])

        flow_id = self._CreateFlowWithRobotId(
            flow_name=AnotherArtifactCollector.__name__,
            flow_args=rdf_artifacts.ArtifactCollectorFlowArgs(
                artifact_list=["Foo"]))
        handler = router.GetFlowFilesArchive(
            api_flow.ApiGetFlowFilesArchiveArgs(client_id=self.client_id,
                                                flow_id=flow_id),
            token=self.token)
        self.assertTrue(handler.path_globs_blacklist is None)
        self.assertTrue(handler.path_globs_whitelist is None)
Esempio n. 2
0
    def testGetFlowFilesArchiveReturnsNonLimitedHandlerForArtifactsWhenNeeded(
            self):
        router = self._CreateRouter(
            artifact_collector_flow=rr.RobotRouterArtifactCollectorFlowParams(
                artifact_collector_flow_name=AnotherArtifactCollector.__name__
            ),  # pylint: disable=undefined-variable
            get_flow_files_archive=rr.RobotRouterGetFlowFilesArchiveParams(
                enabled=True,
                skip_glob_checks_for_artifact_collector=True,
                exclude_path_globs=["**/*.txt"],
                include_only_path_globs=["foo/*", "bar/*"]))

        flow_id = self._CreateFlowWithRobotId()
        handler = router.GetFlowFilesArchive(
            api_flow.ApiGetFlowFilesArchiveArgs(client_id=self.client_id,
                                                flow_id=flow_id),
            context=self.context)
        self.assertEqual(handler.exclude_path_globs, ["**/*.txt"])
        self.assertEqual(handler.include_only_path_globs, ["foo/*", "bar/*"])

        flow_id = self._CreateFlowWithRobotId(
            flow_name=AnotherArtifactCollector.__name__,  # pylint: disable=undefined-variable
            flow_args=rdf_artifacts.ArtifactCollectorFlowArgs(
                artifact_list=["Foo"]))
        handler = router.GetFlowFilesArchive(
            api_flow.ApiGetFlowFilesArchiveArgs(client_id=self.client_id,
                                                flow_id=flow_id),
            context=self.context)
        self.assertIsNone(handler.exclude_path_globs)
        self.assertIsNone(handler.include_only_path_globs)
Esempio n. 3
0
 def testGetFlowFilesArchiveWorksIfFlowWasCreatedBySameRouter(self):
     flow_id = self._CreateFlowWithRobotId()
     router = self._CreateRouter(
         get_flow_files_archive=rr.RobotRouterGetFlowFilesArchiveParams(
             enabled=True))
     router.GetFlowFilesArchive(api_flow.ApiGetFlowFilesArchiveArgs(
         client_id=self.client_id, flow_id=flow_id),
                                token=self.token)
Esempio n. 4
0
 def testGetFlowFilesArchiveReturnsLimitedHandler(self):
     flow_id = self._CreateFlowWithRobotId()
     router = self._CreateRouter(
         get_flow_files_archive=rr.RobotRouterGetFlowFilesArchiveParams(
             enabled=True,
             path_globs_blacklist=["**/*.txt"],
             path_globs_whitelist=["foo/*", "bar/*"]))
     handler = router.GetFlowFilesArchive(
         api_flow.ApiGetFlowFilesArchiveArgs(client_id=self.client_id,
                                             flow_id=flow_id),
         token=self.token)
     self.assertEqual(handler.path_globs_blacklist, ["**/*.txt"])
     self.assertEqual(handler.path_globs_whitelist, ["foo/*", "bar/*"])
Esempio n. 5
0
 def testGetFlowFilesArchiveReturnsLimitedHandler(self):
     flow_id = self._CreateFlowWithRobotId()
     router = self._CreateRouter(
         get_flow_files_archive=rr.RobotRouterGetFlowFilesArchiveParams(
             enabled=True,
             exclude_path_globs=["**/*.txt"],
             include_only_path_globs=["foo/*", "bar/*"]))
     handler = router.GetFlowFilesArchive(
         api_flow.ApiGetFlowFilesArchiveArgs(client_id=self.client_id,
                                             flow_id=flow_id),
         context=self.context)
     self.assertEqual(handler.exclude_path_globs, ["**/*.txt"])
     self.assertEqual(handler.include_only_path_globs, ["foo/*", "bar/*"])