'Test for checking that monitor is disabled.'

def testNtpHasMonitorDisabled(self):

    parser = config_file.NtpdParser()
    check_id = 'TIME-NTP-REFLECTION'
    artifact_id = 'NtpConfFile'
    good_config = {'/etc/ntp.conf': '\n                                disable    monitor\n                                '}
    good_tricky_config = {'/etc/ntp.conf': '\n                                disable    monitor    auth\n                                enable    kernel    monitor    auth\n                                disable    kernel    monitor\n                                '}
    bad_config = {'/etc/ntp.conf': '\n                                enable    monitor\n                                '}
    bad_default_config = {'/etc/ntp.conf': '\n                                '}
    bad_tricky_config = {'/etc/ntp.conf': '\n                                enable    kernel    monitor    auth\n                                disable    monitor    auth\n                                enable    kernel    monitor\n                                '}
    found = ['ntpd.conf    has    monitor    flag    set    to    True.']
    sym = 'Found:    ntpd.conf    is    configured    to    allow    monlist    NTP    reflection    attacks.'
    results = self.RunChecks(self.GenFileData(artifact_id, good_config, parser))
    self.assertCheckUndetected(check_id, results)
    results = self.RunChecks(self.GenFileData(artifact_id, good_tricky_config, parser))
    self.assertCheckUndetected(check_id, results)
    results = self.RunChecks(self.GenFileData(artifact_id, bad_config, parser))
    self.assertCheckDetectedAnom(check_id, results, sym, found)
    results = self.RunChecks(self.GenFileData(artifact_id, bad_default_config, parser))
    self.assertCheckDetectedAnom(check_id, results, sym, found)
    results = self.RunChecks(self.GenFileData(artifact_id, bad_tricky_config, parser))
    self.assertCheckDetectedAnom(check_id, results, sym, found)
