def test_generate_id_different_valid_different_id():
    pub = PagerDutyPublisher("url", "token")
    v = Validation("low", priority=Priority.CRITICAL)
    v2 = Validation("what", priority=Priority.CRITICAL)
    failure = Failure("bar", v, "unable to transmogrify")
    another = Failure("foo", v2, "to transmogrify")
    assert pub._generate_id(failure) != pub._generate_id(another)
Ejemplo n.º 2
0
def test_generate_id_different_valid_different_id():
    pub = PagerDutyPublisher("url", "token")
    v = Validation("low", priority=Priority.CRITICAL)
    v2 = Validation("what", priority=Priority.CRITICAL)
    failure = Failure("bar", v, "unable to transmogrify")
    another = Failure("foo", v2, "to transmogrify")
    assert pub._generate_id(failure) != pub._generate_id(another)
def test_generate_id_consistency_ssh(tmpdir):

    pub = PagerDutyPublisher("url", "token")
    ssh_ctx = ssh.SshContext("ubuntu", ssh_key_file(tmpdir))
    ssh_ctx2 = ssh.SshContext("ubuntu", ssh_key_file(tmpdir))

    v = ssh.SshCommandValidation(ssh_ctx, "name", "cmd", hosts=["a fake host"])
    v2 = ssh.SshCommandValidation(ssh_ctx2, "name", "cmd", hosts=["a fake host"])

    failure = Failure("bar", v, "unable to transmogrify")
    another = Failure("foo", v2, "to transmogrify")

    assert pub._generate_id(failure) == pub._generate_id(another)
Ejemplo n.º 4
0
def test_generate_id_consistency_ssh(tmpdir):

    pub = PagerDutyPublisher("url", "token")
    ssh_ctx = ssh.SshContext("ubuntu", ssh_key_file(tmpdir))
    ssh_ctx2 = ssh.SshContext("ubuntu", ssh_key_file(tmpdir))

    v = ssh.SshCommandValidation(ssh_ctx, "name", "cmd", hosts=["a fake host"])
    v2 = ssh.SshCommandValidation(ssh_ctx2,
                                  "name",
                                  "cmd",
                                  hosts=["a fake host"])

    failure = Failure("bar", v, "unable to transmogrify")
    another = Failure("foo", v2, "to transmogrify")

    assert pub._generate_id(failure) == pub._generate_id(another)
def test_generate_id_reflexive():
    pub = PagerDutyPublisher("url", "token")
    v = Validation("low", priority=Priority.CRITICAL)
    failure = Failure("bar", v, "unable to transmogrify")
    another = Failure("foo", v, "unable")
    assert pub._generate_id(failure) == pub._generate_id(another)
Ejemplo n.º 6
0
def test_generate_id_reflexive():
    pub = PagerDutyPublisher("url", "token")
    v = Validation("low", priority=Priority.CRITICAL)
    failure = Failure("bar", v, "unable to transmogrify")
    another = Failure("foo", v, "unable")
    assert pub._generate_id(failure) == pub._generate_id(another)