'Test we handle when PAM ssh service doesn\'t require an account.'

def testPamSshAccess(self):

    good1_contents = 'account    required    pam_access.so\n'
    good2_contents = 'account    required    /lib/security/pam_access.so    foo\n'
    good3_contents = 'account    required    /lib64/security/pam_access.so    f    b\n'
    bad_contents = 'account    required    test.so\n'
    pam_good1 = {'/etc/pam.d/ssh': good1_contents}
    pam_good2 = {'/etc/pam.d/ssh': good2_contents}
    pam_good3 = {'/etc/pam.d/ssh': good3_contents}
    pam_bad = {'/etc/pam.d/ssh': bad_contents}
    sym = 'Missing    attribute:    PAM    ssh    service    must    require    an    account.'
    found = ['Expected    state    was    not    found']
    results = self.RunChecks(self.GenFileData('PamConfig', pam_bad, parser=self.parser))
    self.assertCheckDetectedAnom('PAM-SSH-PAMACCESS', results, sym, found)
    results = self.RunChecks(self.GenFileData('PamConfig', pam_good1, parser=self.parser))
    self.assertCheckUndetected('PAM-SSH-PAMACCESS', results)
    results = self.RunChecks(self.GenFileData('PamConfig', pam_good2, parser=self.parser))
    self.assertCheckUndetected('PAM-SSH-PAMACCESS', results)
    results = self.RunChecks(self.GenFileData('PamConfig', pam_good3, parser=self.parser))
    self.assertCheckUndetected('PAM-SSH-PAMACCESS', results)
