Esempio n. 1
0
def test_graphite_fetch_failure():
    opts = options_for(
        "-M 'cpu.load.average' -H http://example.com -U foo -P pass")
    url_re = re.compile("^{}.*$".format(re.escape(opts.hostname)))

    responses.add(responses.GET, url_re, status=500)

    assert main.graphite_fetch(opts) == []
Esempio n. 2
0
def test_graphite_fetch_failure():
    opts = options_for(
        "-M 'cpu.load.average' -H http://example.com -U foo -P pass")
    url_re = re.compile("^{}.*$".format(re.escape(opts.hostname)))

    responses.add(
        responses.GET, url_re, status=500)

    assert main.graphite_fetch(opts) == []
Esempio n. 3
0
def test_graphite_fetch_success():
    opts = options_for(
        "-M 'cpu.load.average' -H http://example.com -U foo -P pass")
    url_re = re.compile("^{}.*$".format(re.escape(opts.hostname)))

    resp = json.dumps(graphite_with_none)
    responses.add(
        responses.GET, url_re,
        body=resp, status=200,
        content_type='application/json')

    assert main.graphite_fetch(opts) == graphite_with_none
Esempio n. 4
0
def test_graphite_fetch_success():
    opts = options_for(
        "-M 'cpu.load.average' -H http://example.com -U foo -P pass")
    url_re = re.compile("^{}.*$".format(re.escape(opts.hostname)))

    resp = json.dumps(graphite_with_none)
    responses.add(responses.GET,
                  url_re,
                  body=resp,
                  status=200,
                  content_type='application/json')

    assert main.graphite_fetch(opts) == graphite_with_none