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=artifact_utils.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)
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)
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/*"])