summaryrefslogtreecommitdiff
path: root/tests/test_discovery.py
diff options
context:
space:
mode:
authorLudovic Pouzenc <ludovic@pouzenc.fr>2016-05-15 13:05:33 +0200
committerLudovic Pouzenc <ludovic@pouzenc.fr>2016-05-15 13:05:33 +0200
commit928aa3ef114ebf9246c90f9eae80da9a20172530 (patch)
treea30537ba248d023f863c0e61bdab8da73842d3ec /tests/test_discovery.py
parent2e59a405596156412ff7240934071be76ec30301 (diff)
downloadhaircontrol-928aa3ef114ebf9246c90f9eae80da9a20172530.zip
haircontrol-928aa3ef114ebf9246c90f9eae80da9a20172530.tar.gz
haircontrol-928aa3ef114ebf9246c90f9eae80da9a20172530.tar.bz2
Add ip link support to mac local_macs, improove test result readability
Diffstat (limited to 'tests/test_discovery.py')
-rwxr-xr-xtests/test_discovery.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/tests/test_discovery.py b/tests/test_discovery.py
index b0de19b..7fb0bd2 100755
--- a/tests/test_discovery.py
+++ b/tests/test_discovery.py
@@ -3,9 +3,9 @@ import unittest
#import pudb; pudb.set_trace()
from context import haircontrol
-from haircontrol import discovery, data
+from haircontrol import discovery, data, inspectors
-class MockInspector(object):
+class MockInspector(inspectors.Inspector):
def __init__(self, testDataPath):
self.testDataPath = testDataPath
self.e = None
@@ -20,7 +20,7 @@ class MockInspector(object):
if not self.e:
return None
mockfile = self.testDataPath + '/' + self.e.name + '-' + command + '.out'
- return open(mockfile)
+ return open(mockfile) #XXX use Inspector.parse()
class TestDiscovery(unittest.TestCase):
@@ -30,11 +30,11 @@ class TestDiscovery(unittest.TestCase):
self.maxDiff=None
def test_wire_graph(self):
- ref_equipments = { 'todo': data.Equipment() } #json.load('../test-data/ref-output/equipments.json')
+ ref_net = data.EtherDomain() #json.load('../test-data/ref-output/equipments.json')
- self.discovery.discover_hinting_from_lldp(data.Equipment('stg2', '172.16.0.254'))
- self.discovery.discover_from_root(data.Equipment('stg', '172.16.0.253'))
- self.assertDictEqual(self.discovery.net.equipments, ref_equipments)
+ self.discovery.discover_hinting_from_lldp(data.Equipment('stg2', '172.16.0.253'))
+ self.discovery.discover_from_root(data.Equipment('stg', '172.16.0.254'))
+ self.assertEqual(ref_net.get_equipment_list_sorted(), list(self.discovery.net.get_equipment_list_sorted()))
if __name__ == '__main__':
unittest.main()