コード例 #1
0
ファイル: state_test.py プロジェクト: Oncilla/scion-detached
 def test_renewal_denied(self, _):
     inst = SibraState("bw", "isd as")
     inst.update_tick = create_mock()
     inst._add = create_mock()
     inst.steady["path id"] = "resv"
     # Call
     ntools.eq_(
         inst.add_steady("path id", "resv idx", "bwsnap", "exp_tick",
                         "accepted", setup=False),
         inst._add.return_value)
     # Tests
     inst._add.assert_called_once_with(
         "resv", "resv idx", "bwsnap", "exp_tick", "accepted")
コード例 #2
0
ファイル: state_test.py プロジェクト: Oncilla/scion-detached
 def test_full(self, _):
     inst = SibraState("bw", "isd as")
     inst.curr_tick = "curr tick"
     resv = create_mock(["add"])
     bwhint_cls = create_mock(["floor"])
     bwhint = create_mock(["to_classes"])
     bwhint.to_classes.return_value = bwhint_cls
     resv.add.return_value = bwhint
     # Call
     ntools.eq_(inst._add(resv, "resv idx", "bwsnap", "exp_tick", False),
                bwhint_cls.floor.return_value)
     # Tests
     resv.add.assert_called_once_with("resv idx", "bwsnap", "exp_tick",
                                      "curr tick")
     bwhint.to_classes.assert_called_once_with(floor=True)
コード例 #3
0
ファイル: state_test.py プロジェクト: Oncilla/scion-detached
 def test_setup_success(self, _):
     inst = SibraState("bw", "isd as")
     inst.update_tick = create_mock()
     inst._create_steady = create_mock()
     inst._create_steady.return_value = "resv"
     inst._add = create_mock()
     inst._add.return_value = None
     # Call
     inst.add_steady("path id", "resv idx", "bwsnap", "exp_tick", "accepted")
     # Tests
     inst.update_tick.assert_called_once_with()
     inst._create_steady.assert_called_once_with("path id")
     inst._add.assert_called_once_with(
         "resv", "resv idx", "bwsnap", "exp_tick", "accepted")
     ntools.eq_(inst.steady, {"path id": "resv"})
     ntools.eq_(inst.pend_steady, {"path id": True})
コード例 #4
0
ファイル: state_test.py プロジェクト: Oncilla/scion-detached
 def test_setup_success(self, _):
     inst = SibraState("bw", "isd as")
     inst.update_tick = create_mock()
     inst._create_ephemeral = create_mock()
     inst._create_ephemeral.return_value = "resv"
     inst._add = create_mock()
     inst._add.return_value = None
     inst.steady["steady id"] = create_mock(["add_child"])
     # Call
     inst.add_ephemeral("path id", "steady id", "resv idx", "bwsnap",
                        "exp_tick", "accepted")
     # Tests
     inst.update_tick.assert_called_once_with()
     inst._create_ephemeral.assert_called_once_with("path id", "steady id")
     inst._add.assert_called_once_with(
         "resv", "resv idx", "bwsnap", "exp_tick", "accepted")
     ntools.eq_(inst.ephemeral, {"path id": "resv"})
     ntools.eq_(inst.pend_ephemeral, {"path id": True})
     inst.steady["steady id"].add_child.assert_called_once_with("path id")