server-restart: add failing test

"wormhole-server restart" was broken by the addition of --disallow-list,
because the Click parser wasn't update to include the argument. This test
should exercise that a basic no-argv invocation of both "start" and "restart"
can at least build the Service object successfully.

refs #151
This commit is contained in:
Brian Warner 2017-06-26 17:44:53 +01:00
parent f282649f81
commit 4169545c28

View File

@ -1195,3 +1195,18 @@ class Server(unittest.TestCase):
plugin = MyPlugin(cfg)
relay = plugin.makeService(None)
self.assertEqual(False, relay._allow_list)
@mock.patch("wormhole.server.cmd_server.start_server")
def test_start_no_args(self, fake_start_server):
result = self.runner.invoke(server, ['start'])
self.assertEqual(0, result.exit_code)
cfg = fake_start_server.mock_calls[0][1][0]
MyPlugin(cfg).makeService(None)
@mock.patch("wormhole.server.cmd_server.restart_server")
def test_restart_no_args(self, fake_start_reserver):
result = self.runner.invoke(server, ['restart'])
self.assertEqual(0, result.exit_code)
cfg = fake_start_reserver.mock_calls[0][1][0]
MyPlugin(cfg).makeService(None)