예제 #1
0
파일: main_test.py 프로젝트: stschwar/scion
 def test_trace(self, signals, argparse, init_log, trace):
     type_ = create_mock()
     inst = type_.return_value = create_mock(["id", "run"])
     parser = argparse.return_value
     args = parser.parse_args.return_value
     args.log_dir = "logging"
     args.server_id = "srvid"
     args.conf_dir = "confdir"
     args.prom = "prom"
     args.spki_cache_dir = "gen-cache"
     # Call
     main_default(type_, trace_=True, kwarg1="kwarg1")
     # Tests
     signals.assert_called_once_with()
     argparse.assert_called_once_with()
     ntools.ok_(parser.add_argument.called)
     parser.parse_args.assert_called_once_with()
     init_log.assert_called_once_with("logging/srvid")
     type_.assert_called_once_with("srvid",
                                   "confdir",
                                   spki_cache_dir="gen-cache",
                                   prom_export="prom",
                                   kwarg1="kwarg1")
     trace.assert_called_once_with(inst.id)
     inst.run.assert_called_once_with()
예제 #2
0
파일: main_test.py 프로젝트: nerd100/scion
 def _check_core_local(self, is_core, core_called, local_called, signals,
                       argparse, init_log, topo):
     core_type = create_mock()
     local_type = create_mock()
     topo.return_value = create_mock(["is_core_as"])
     topo.return_value.is_core_as = is_core
     # Call
     main_default(core_type, local_type)
     # Tests
     ntools.eq_(core_type.called, core_called)
     ntools.eq_(local_type.called, local_called)