1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 12:59:34 +00:00
This commit is contained in:
Paulus Schoutsen
2019-07-31 12:25:30 -07:00
parent da05dfe708
commit 4de97abc3a
2676 changed files with 163166 additions and 140084 deletions

View File

@@ -9,11 +9,9 @@ import homeassistant.components.prometheus as prometheus
@pytest.fixture
def prometheus_client(loop, hass, hass_client):
"""Initialize an hass_client with Prometheus component."""
assert loop.run_until_complete(async_setup_component(
hass,
prometheus.DOMAIN,
{prometheus.DOMAIN: {}},
))
assert loop.run_until_complete(
async_setup_component(hass, prometheus.DOMAIN, {prometheus.DOMAIN: {}})
)
return loop.run_until_complete(hass_client())
@@ -23,13 +21,15 @@ def test_view(prometheus_client): # pylint: disable=redefined-outer-name
resp = yield from prometheus_client.get(prometheus.API_ENDPOINT)
assert resp.status == 200
assert resp.headers['content-type'] == 'text/plain'
assert resp.headers["content-type"] == "text/plain"
body = yield from resp.text()
body = body.split("\n")
assert len(body) > 3 # At least two comment lines and a metric
for line in body:
if line:
assert line.startswith('# ') \
or line.startswith('process_') \
or line.startswith('python_info')
assert (
line.startswith("# ")
or line.startswith("process_")
or line.startswith("python_info")
)