'Assert a check was performed and specific anomalies were found.
Results may contain multiple anomalies. The check will hold true if any
one of them matches. As some results can contain multiple anomalies we
will need to make sure the right anomalies are selected.
If an symptom is provided, look for anomalies that matches the
expression string and use those. Otherwise, all anomalies in the
check should be used.
If finding strings are provided, the check tests if the substring is present
in the findings of the anomalies that are selected for testing. If the
finding results can have variable ordering, use a substring that will remain
constant for each finding.
Args:
check_id: The check_id as a string.
results: A dictionary of check results, mapped to check_ids
sym: An symptom string. This is the "title" of an advisory.
findings: A list of finding strings that should be present in the findings
of the selected anomaly.
Returns:
True if tests have succeeded and no further processing is required.'

def assertCheckDetectedAnom(self, check_id, results, sym=None, findings=None):

    chk = results.get(check_id)
    self.assertTrue((chk is not None), ('check    %s    did    not    run' % check_id))
    self.assertTrue(chk, ('check    %s    did    not    generate    anomalies' % check_id))
    self._HasSymptom(chk.anomaly, sym)
    if (findings is None):
        return True
    findings = set(findings)
    found = self._GetFindings(chk.anomaly, sym)
    if self._MatchFindings(findings, found):
        return True
    others = '\n'.join([str(a) for a in chk.anomaly])
    self.fail(("Findings    don't    match    for    symptom    '%s':\nExpected:\n        %s\nGot:\n        %s\nFrom:\n%s" % (sym, ',    '.join(findings), ',    '.join(found), others)))
