Ejemplo n.º 1
0
def test_cleanup_cli(client, fake_config):
    hooks.main(["-t", "cleanup", "-c", str(fake_config), "-l", LINEAGE])

    assert len(client.call_args[0]) == 1
    resolver = client.call_args[0][0]

    assert resolver.resolve("lexicon:action") == "delete"
    assert resolver.resolve("lexicon:domain") == LINEAGE
    assert resolver.resolve("lexicon:type") == "TXT"
    assert resolver.resolve("lexicon:name") == f"_acme-challenge.{LINEAGE}."
    assert resolver.resolve("lexicon:content") == "VALIDATION"
    assert resolver.resolve("lexicon:provider_name") == "dummy"
    assert resolver.resolve("lexicon:dummy:auth_token") == "TOKEN"
def test_auth_cli(client, fake_config):
    hooks.main(["-t", "auth", "-c", str(fake_config), "-l", LINEAGE])

    assert len(client.call_args[0]) == 1
    resolver = client.call_args[0][0]

    assert resolver.resolve("lexicon:action") == "create"
    assert resolver.resolve("lexicon:domain") == LINEAGE
    assert resolver.resolve("lexicon:type") == "TXT"
    assert resolver.resolve("lexicon:name") == "_acme-challenge.{0}.".format(
        LINEAGE)
    assert resolver.resolve("lexicon:content") == "VALIDATION"
    assert resolver.resolve("lexicon:provider_name") == "dummy"
    assert resolver.resolve("lexicon:ttl") == 42
    assert resolver.resolve("lexicon:dummy:auth_token") == "TOKEN"
def test_deploy_cli(deploy, fake_config):
    hooks.main(["-t", "deploy", "-c", str(fake_config), "-l", LINEAGE])
    deploy.assert_called_with(config.load(fake_config), LINEAGE)