Ejemplo n.º 1
0
 def testMatchPathParent(self):
     tree = ServiceTree(_services)
     for i in _services:
         parentId = i.parentId if i.parentId else i.id
         expected = [tree.getService(parentId)]
         result = tree.matchServicePath(i.id, '..')
         self.assertEqual(result, expected)
Ejemplo n.º 2
0
 def testMatchPathParent(self):
     tree = ServiceTree(_services)
     for i in _services:
         parentId = i.parentId if i.parentId else i.id
         expected = [tree.getService(parentId)]
         result = tree.matchServicePath(i.id, '..')
         self.assertEqual(result, expected)
Ejemplo n.º 3
0
 def testGetPath(self):
     tree = ServiceTree(_services)
     tests = (('zenoss', '/zenoss'), ('zenping',
                                      '/zenoss/hub1/collector1/zenping'))
     for service, expected in tests:
         path = tree.getPath(tree.getService(service))
         actual = '/' + '/'.join(i.id for i in path)
         self.assertEqual(actual, expected)
Ejemplo n.º 4
0
 def testGetPath(self):
     tree = ServiceTree(_services)
     tests = (('zenoss', '/zenoss'),
              ('zenping', '/zenoss/hub1/collector1/zenping'))
     for service, expected in tests:
         path = tree.getPath(tree.getService(service))
         actual = '/'+'/'.join(i.id for i in path)
         self.assertEqual(actual, expected)
Ejemplo n.º 5
0
 def testFindMatchingServices(self):
     tree = ServiceTree(_services)
     tests = (
         ('zenoss', 'collector', ('zenping', 'collector1', 'zencommand', 'collector2', 'collector3')),
         ('hub1', 'collector', ('zenping', 'collector1', 'zencommand', 'collector2')),
         ('zenoss', '=HUB1', ('hub1',)),
     )
     for service, pattern, expected in tests:
         root = tree.getService(service)
         result = [i.id for i in tree.findMatchingServices(root, pattern)]
         self.assertEqual(sorted(result), sorted(expected))
Ejemplo n.º 6
0
 def testFindMatchingServices(self):
     tree = ServiceTree(_services)
     tests = (
         ('zenoss', 'collector', ('zenping', 'collector1', 'zencommand',
                                  'collector2', 'collector3')),
         ('hub1', 'collector', ('zenping', 'collector1', 'zencommand',
                                'collector2')),
         ('zenoss', '=HUB1', ('hub1', )),
     )
     for service, pattern, expected in tests:
         root = tree.getService(service)
         result = [i.id for i in tree.findMatchingServices(root, pattern)]
         self.assertEqual(sorted(result), sorted(expected))
Ejemplo n.º 7
0
 def testGetServices(self):
     tree = ServiceTree(_services)
     for i in _services:
         self.assertEqual(tree.getService(i.id), i)
Ejemplo n.º 8
0
 def testGetServices(self):
     tree=ServiceTree(_services)
     for i in _services:
         self.assertEqual(tree.getService(i.id), i)