def testWithClientSet(self): mock_client = mock.MagicMock() with mock.patch.object(magics_impl._state, 'client', mock_client): magics_impl.grr_collect_impl('FakeArtifact') mock_client.collect.assert_called_once_with('FakeArtifact')
def grr_collect(line: Text) -> pd.DataFrame: """Collects specified artifact. Args: line: A string representing arguments passed to the magic command. Returns: Sequence of results that artifact collection yielded. Raises: NoClientSelectedError: Client is not selected to perform this operation. """ args = grr_collect.parser.parse_args(shlex.split(line)) return magics_impl.grr_collect_impl(args.artifact)
def testNoClientSelected(self): with self.assertRaises(magics_impl.NoClientSelectedError): magics_impl.grr_collect_impl('FakeArtifact')