Exemplo n.º 1
0
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()]
Exemplo n.º 2
0
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={})]
Exemplo n.º 3
0
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("."),)}),
    ]
Exemplo n.º 4
0
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("."), )}),
    ]