def test_main_argv(tmpdir, mocker): conf_file = get_conf_file(tmpdir, verbose=False, ssl_cert=None) mocker.patch.object(sys, 'argv', new=[__file__, conf_file]) mocker.patch.object(script, 'async_main', new=noop_async) script.main()
def test_main_missing_args(mocker): mocker.patch.object(sys, 'argv', new=[__file__]) with pytest.raises(SystemExit): script.main()
def test_main(monkeypatch): sync_main_mock = MagicMock() monkeypatch.setattr(scriptworker.client, 'sync_main', sync_main_mock) script.main() sync_main_mock.asset_called_once_with(script.async_main, default_config=script.get_default_config())
def test_main_noargv(tmpdir, mocker): conf_file = get_conf_file(tmpdir, verbose=True) mocker.patch.object(script, 'async_main', new=die_async) with pytest.raises(SystemExit): script.main(config_path=conf_file)
def test_main(monkeypatch): sync_main_mock = MagicMock() monkeypatch.setattr(script, "sync_main", sync_main_mock) script.main() sync_main_mock.asset_called_once_with( script.async_main, default_config=script.get_default_config())