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) == []
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) == []
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
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