Exemplo n.º 1
0
def test_webhook_inject_env_add_success():
    container = get_cmk_container()
    key = "fake"
    value = "fake"
    webhook.inject_env(container, key, value)
    assert key == container["env"][-1]["name"]
    assert value == container["env"][-1]["value"]
Exemplo n.º 2
0
def test_webhook_inject_env_exists(caplog):
    container = get_cmk_container()
    key = "fake"
    value = "fake"
    webhook.inject_env(container, key, value)
    assert key == container["env"][-1]["name"]
    assert value == container["env"][-1]["value"]

    # try to add again
    webhook.inject_env(container, key, value)
    log = "Environmental variable {} exists. Skipping...".format(key)
    caplog_tuple = caplog.record_tuples
    assert caplog_tuple[-1][2] == log