コード例 #1
0
 def test_netmap_metadata_is_correct_for_2_links_edge_between_a_and_b(self):
     self.maxDiff = None
     metadata = (self.netmap_graph.get_edge_data(self.a, self.b) or {}).get(
         'metadata'
     )
     assert Edge(nx_edge=(self.a, self.b), meta_edge=(self.a1, self.b1)) in metadata
     assert Edge(nx_edge=(self.a, self.b), meta_edge=(self.a2, self.b2)) in metadata
コード例 #2
0
ファイル: metadata_nx_test.py プロジェクト: bj0rns0der/nav
 def test_netmap_metadata_is_correct_for_2_links_edge_between_a_and_b(self):
     self.maxDiff = None
     assert [
         Edge(
             nx_edge=(self.a, self.b),
             source=self.a1,
             target=self.b1,
         ),
         Edge(nx_edge=(self.a, self.b), source=self.a2, target=self.b2)
     ] == (self.netmap_graph.get_edge_data(self.a, self.b)
           or {}).get('metadata')
コード例 #3
0
    def test_json_edge_is_NA_if_speed_is_undefined(self):
        self.a1.speed = None
        self.b1.speed = None

        results = Edge((self.a, self.b), (self.a1, self.b1)).to_json()

        self.assertEqual(results['link_speed'], 'N/A')
コード例 #4
0
    def test_edge_allows_both_interface_linkspeed_in_group_to_be_none(self):
        netbox_a = Mock(name='netbox a', sepc=Netbox)
        netbox_a.id = 'foo'
        a = Mock(name='interface a', spec=Interface)
        a.speed = None

        netbox_b = Mock(name='netbox b', spec=Netbox)
        netbox_b.id = 'bar'
        b = Mock(name='interface b', spec=Interface)
        b.speed = None

        foo = Edge((netbox_a, netbox_b), (a, b))
コード例 #5
0
 def test_not_failing_when_both_interface_speed_is_undefined(self):
     self.a1.speed = None
     self.b1.speed = None
     results = Edge((self.a, self.b), (self.a1, self.b1))
     self.assertTrue(results.link_speed is None)