def test_cli_no_settings(monkeypatch, cli): config = pretend.stub() configure = pretend.call_recorder(lambda: config) monkeypatch.setattr(warehouse.cli, "LazyConfig", configure) @warehouse.cli.warehouse.command() @click.pass_obj def cli_test_command(obj): assert obj is config result = cli.invoke(warehouse.cli.warehouse, ["cli_test_command"]) assert result.exit_code == 0 assert configure.calls == [pretend.call()]
def test_cli_no_settings(monkeypatch, cli): config = pretend.stub() configure = pretend.call_recorder(lambda settings: config) monkeypatch.setattr(warehouse.cli, "LazyConfig", configure) @warehouse.cli.warehouse.command() @click.pass_obj def cli_test_command(obj): assert obj is config result = cli.invoke(warehouse.cli.warehouse, ["cli_test_command"]) assert result.exit_code == 0 assert configure.calls == [pretend.call(settings={})]
def test_cli_with_settings(monkeypatch, cli): config = pretend.stub() configure = pretend.call_recorder(lambda settings: config) monkeypatch.setattr(warehouse.cli, "LazyConfig", configure) @warehouse.cli.warehouse.command() @click.pass_obj def cli_test_command(obj): assert obj is config result = cli.invoke( warehouse.cli.warehouse, ["--config", ".", "cli_test_command"], ) assert result.exit_code == 0 assert configure.calls == [ pretend.call(settings={"yml.location": (os.path.abspath("."),)}), ]
def test_cli_with_settings(monkeypatch, cli): config = pretend.stub() configure = pretend.call_recorder(lambda settings: config) monkeypatch.setattr(warehouse.cli, "LazyConfig", configure) @warehouse.cli.warehouse.command() @click.pass_obj def cli_test_command(obj): assert obj is config result = cli.invoke( warehouse.cli.warehouse, ["--config", ".", "cli_test_command"], ) assert result.exit_code == 0 assert configure.calls == [ pretend.call(settings={"yml.location": (os.path.abspath("."), )}), ]