示例#1
0
 def test_detail_url(self):
     self.print_header()
     oracle = Application({
         'host_name': 'test',
         'name': 'test',
         'type': 'generic',
     })
     url = MonitoringDetail({
         'host_name': 'test',
         'application_name': 'test',
         'application_type': 'generic',
         'monitoring_type': 'URL',
         'monitoring_0': 'oracle://*****:*****@dbsrv:1522/svc',
     })
     oracle.monitoring_details.append(url)
     oracle.resolve_monitoring_details()
     self.assert_(len(oracle.urls) == 1)
     # consol app_db_oracle class will call wemustrepeat() to create
     # a fake LOGIN-detail, so there is a oracle.username
     self.assert_(oracle.urls[0].username == 'dbadm')
     self.assert_(oracle.urls[0].password == 'pass')
     self.assert_(oracle.urls[0].hostname == 'dbsrv')
     self.assert_(oracle.urls[0].port == 1522)
     # will be without the / in the consol app_db_oracle class
     self.assert_(oracle.urls[0].path == '/svc')
示例#2
0
 def test_detail_ram(self):
     Application.init_classes([
         os.path.join(os.path.dirname(__file__), 'recipes/test6/classes'),
         os.path.join(os.path.dirname(__file__), '../recipes/default/classes')])
     MonitoringDetail.init_classes([
         os.path.join(os.path.dirname(__file__), 'recipes/test6/classes'),
         os.path.join(os.path.dirname(__file__), '../recipes/default/classes')])
     self.print_header()
     opsys = Application({'name': 'os', 'type': 'red hat 6.1'})
     ram = MonitoringDetail({'application_name': 'os',
         'application_type': 'red hat 6.1',
         'monitoring_type': 'RAM',
         'monitoring_0': '80',
         'monitoring_1': '90',
     })
     opsys.monitoring_details.append(ram)
     for m in opsys.monitoring_details:
         print "detail", m
     opsys.resolve_monitoring_details()
     self.assert_(hasattr(opsys, 'ram'))
     self.assert_(opsys.ram.warning == '80')