def test_searchDir_missing(self): """searchDir: set no objects when directory doesn't exists""" nagctl.searchDir("nonexisting.d") hosts = [host.getName() for host in nagctl.hosts] services = [service.getName() for service in nagctl.services] self.assertEqual(hosts, []) self.assertEqual(services, [])
def test_searchDir_regular(self): """searchDir: set host and service objects read from all files""" nagctl.searchDir("conf.d") hosts = [host.getName() for host in nagctl.hosts] hosts.sort() services = [service.getName() for service in nagctl.services] services.sort() self.assertEqual(hosts, ["multiverse", "universe"]) self.assertEqual(services, ["ping"])