def testCmdArtifact(self):
    """Check we can run command based artifacts and get anomalies."""
    client_mock = self.MockClient("ExecuteCommand", client_id=self.client_id)
    with utils.Stubber(subprocess, "Popen", test_lib.Popen):
      for _ in test_lib.TestFlowHelper(
          "ArtifactCollectorFlow", client_mock, client_id=self.client_id,
          store_results_in_aff4=True, use_tsk=False,
          artifact_list=["TestCmdArtifact"], token=self.token):
        pass
    urn = self.client_id.Add("info/software")
    fd = aff4.FACTORY.Open(urn, token=self.token)
    packages = fd.Get(fd.Schema.INSTALLED_PACKAGES)
    self.assertEqual(len(packages), 2)
    self.assertEqual(packages[0].__class__.__name__, "SoftwarePackage")

    with aff4.FACTORY.Open(self.client_id.Add("anomalies"),
                           token=self.token) as anomaly_coll:
      self.assertEqual(len(anomaly_coll), 1)
      self.assertTrue(anomaly_coll[0].symptom in "gremlin")
dataset/ETHPy150Open google/grr/grr/lib/artifact_test.py/ArtifactFlowLinuxTest.testCmdArtifact/swapped operands of `in`