Esempio n. 1
0
 def _check_setup(self, cons_dir):
     inst = SibraExtSteady()
     inst._get_prev_raw = create_mock()
     inst.setup = True
     inst.path_ids = "path ids"
     iof = create_mock(["cons_dir_flag"])
     iof.cons_dir_flag = cons_dir
     hof = create_mock(["egress_if", "ingress_if"])
     path = create_mock(["get_hof", "get_iof"])
     path.get_iof.return_value = iof
     path.get_hof.return_value = hof
     spkt = create_mock(["path"])
     spkt.path = path
     req = create_mock(["add_hop"])
     inst.req_block = req
     # Call
     inst._add_hop("key", spkt)
     # Tests
     if cons_dir:
         req.add_hop.assert_called_once_with(
             hof.ingress_if, hof.egress_if, inst._get_prev_raw.return_value,
             "key", "path ids")
     else:
         req.add_hop.assert_called_once_with(
             hof.egress_if, hof.ingress_if, inst._get_prev_raw.return_value,
             "key", "path ids")
Esempio n. 2
0
 def test_non_setup(self, super_addhop):
     inst = SibraExtSteady()
     inst.setup = False
     # Call
     inst._add_hop("key")
     # Tests
     super_addhop.assert_called_once_with(inst, "key")