def testMapChecksToTriggers(self):
    """Checks are identified and run when their prerequisites are met."""
    expect = ["SW-CHECK"]
    result = checks.CheckRegistry.FindChecks(
        artifact="WMIInstalledSoftware", os_name="Windows")
    self.assertItemsEqual(expect, result)
    result = checks.CheckRegistry.FindChecks(
        artifact="DebianPackagesStatus", os_name="Linux")
    self.assertItemsEqual(expect, result)
    result = checks.CheckRegistry.FindChecks(
        artifact="DebianPackagesStatus", labels="foo")
    self.assertItemsEqual(expect, result)

    expect = set(["SSHD-CHECK"])
    result = set(checks.CheckRegistry.FindChecks(
        artifact="SshdConfigFile", os_name="Darwin"))
    residual = expect - result
    self.assertFalse(residual)

    result = set(checks.CheckRegistry.FindChecks(
        artifact="SshdConfigFile", os_name="Linux"))
    residual = expect - result
    self.assertFalse(residual)

    # All sshd config checks specify an OS, so should get no results.
    expect = set([])
    result = set(checks.CheckRegistry.FindChecks(artifact="SshdConfigFile"))
    residual = expect - result
    self.assertFalse(residual)
    result = set(checks.CheckRegistry.FindChecks(
        artifact="SshdConfigFile", os_name="Windows"))
    residual = expect - result
    self.assertFalse(residual)
dataset/ETHPy150Open google/grr/grr/lib/checks/checks_test.py/CheckRegistryTests.testMapChecksToTriggers/original