コード例 #1
0
def test_update_vanguards():
  controller = MockController()
  vanguards.vanguards.LAYER1_LIFETIME_DAYS = 30
  state = VanguardState.read_from_file("tests/state.mock")
  sanity_check(state)

  state.new_consensus_event(controller, None)
  sanity_check(state)
コード例 #2
0
def test_update_vanguards():
    controller = MockController()
    vanguards.vanguards.LAYER1_LIFETIME_DAYS = 30
    shutil.copy("tests/state.mock", "tests/state.mock.test")
    state = VanguardState.read_from_file("tests/state.mock.test")
    state.enable_vanguards = True
    sanity_check(state)

    state.new_consensus_event(controller, None)
    sanity_check(state)
    os.remove("tests/state.mock.test")
コード例 #3
0
def test_disable():
  controller = MockController()
  vanguards.vanguards.LAYER1_LIFETIME_DAYS = 30
  shutil.copy("tests/state.mock", "tests/state.mock.test")
  state = VanguardState.read_from_file("tests/state.mock.test")
  state.enable_vanguards = False
  sanity_check(state)

  state.new_consensus_event(controller, None)
  sanity_check(state)
  assert controller.got_set_conf == False
  assert controller.got_save_conf == False
  os.remove("tests/state.mock.test")
コード例 #4
0
def test_update_vanguards():
  controller = MockController()
  vanguards.vanguards.LAYER1_LIFETIME_DAYS = 30
  shutil.copy("tests/state.mock", "tests/state.mock.test")
  state = VanguardState.read_from_file("tests/state.mock.test")
  state.enable_vanguards = True
  sanity_check(state)

  state.new_consensus_event(controller, None)
  sanity_check(state)
  os.remove("tests/state.mock.test")

  # test signal HUP
  state.signal_event(controller,
                     ControlMessage.from_str("650 SIGNAL RELOAD\r\n",
                                             "EVENT"))
  sanity_check(state)