def test_publish_failure(httpserver):
    httpserver.serve_content(code=300, headers={"content-type": "text/plain"},
                             content='{"mode":"NORMAL"}')
    pub = PagerDutyPublisher(httpserver.url, "token")
    v = Validation("low", priority=Priority.CRITICAL)
    failure = Failure("bar", v, "message")
    with pytest.raises(PublishFailure):
        pub.send(failure)
def test_publish_retries(ratelimited):
    global cutoff
    cutoff = 3
    global hits
    hits = 0
    pub = PagerDutyPublisher(ratelimited.url, "token")
    v = Validation("low", priority=Priority.CRITICAL)
    failure = Failure("bar", v, "message")
    pub.send(failure)
Example #3
0
def test_publish_failure(httpserver):
    httpserver.serve_content(code=300,
                             headers={"content-type": "text/plain"},
                             content='{"mode":"NORMAL"}')
    pub = PagerDutyPublisher(httpserver.url, "token")
    v = Validation("low", priority=Priority.CRITICAL)
    failure = Failure("bar", v, "message")
    with pytest.raises(PublishFailure):
        pub.send(failure)
Example #4
0
def test_publish_retries(ratelimited):
    global cutoff
    cutoff = 3
    global hits
    hits = 0
    pub = PagerDutyPublisher(ratelimited.url, "token")
    v = Validation("low", priority=Priority.CRITICAL)
    failure = Failure("bar", v, "message")
    pub.send(failure)
def test_publish_stops_retrying(ratelimited):
    global cutoff
    cutoff = 4
    global hits
    hits = 0
    pub = PagerDutyPublisher(ratelimited.url, "token")
    v = Validation("low", priority=Priority.CRITICAL)
    failure = Failure("bar", v, "message")
    with pytest.raises(PublishFailure):
        pub.send(failure)
Example #6
0
def test_publish_stops_retrying(ratelimited):
    global cutoff
    cutoff = 4
    global hits
    hits = 0
    pub = PagerDutyPublisher(ratelimited.url, "token")
    v = Validation("low", priority=Priority.CRITICAL)
    failure = Failure("bar", v, "message")
    with pytest.raises(PublishFailure):
        pub.send(failure)