This commit is contained in:
@@ -32,6 +32,23 @@ def test_health_is_independent_of_btcdata():
|
||||
assert response.json() == {"status": "up"}
|
||||
|
||||
|
||||
def test_home_updates_title_from_latest_price():
|
||||
response = TestClient(main.app).get("/")
|
||||
|
||||
assert response.status_code == 200
|
||||
assert "new MutationObserver(updateTitleFromPrice)" in response.text
|
||||
assert "document.title = price + ' | BTC Price'" in response.text
|
||||
|
||||
|
||||
def test_price_fragment_exposes_formatted_price_for_title():
|
||||
html = main.price_json_to_html(
|
||||
'{"price": 67432.1, "prev_price": 67400, "recorded_at": ""}'
|
||||
)
|
||||
|
||||
assert 'data-title-price="$67.432,10"' in html
|
||||
assert ">$67.432,10</p>" in html
|
||||
|
||||
|
||||
def test_ready_when_btcdata_is_healthy(monkeypatch):
|
||||
request = httpx.Request("GET", "http://btcdata.test/api/health")
|
||||
upstream = httpx.Response(200, request=request)
|
||||
|
||||
Reference in New Issue
Block a user