Files
second-screen/tests/test_registry.py
T
rickzkmandClaude Opus 5.5 2132262896 Sky and ISS views
Two new views, picked from mockups. `sky`: a star chart of the sky over
Zlín as seen lying on your back, with the planets, the moon in its phase,
tonight's darkness, cloud for the next 12 hours and the next visible ISS
pass. `iss`: a dotted world map with day and night, the ISS and its ground
track, and the next pass over Zlín with the cloud cover for that hour.

Positions are calculated locally with ephem; only the ISS orbit
(CelesTrak, every 6 h, retried gently) and cloud cover (Open-Meteo) are
fetched. The poller gained a per-source retry delay for that.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 00:03:38 +01:00

38 lines
1.1 KiB
Python

import pytest
from registry import REGISTRY, UnknownView, make_view
def test_registry_has_all_views():
assert sorted(REGISTRY) == ["iss", "server", "sky", "weather"]
def test_make_view_builds_named_views():
for name in ("weather", "server", "sky", "iss"):
assert make_view(name).name == name
def test_make_view_unknown_lists_valid_names():
with pytest.raises(UnknownView) as err:
make_view("bogus")
assert err.value.name == "bogus"
assert err.value.valid == ["iss", "server", "sky", "weather"]
def test_make_view_empty_name_is_unknown():
with pytest.raises(UnknownView):
make_view("")
def test_server_view_polls_every_second_and_weather_every_quarter_hour():
import registry
assert registry.SERVER_REFRESH_S == 1
assert registry.WEATHER_REFRESH_S == 15 * 60
def test_sky_views_fetch_the_orbit_gently_and_clouds_every_quarter_hour():
import registry
assert registry.TLE_REFRESH_S == 6 * 3600
assert registry.TLE_RETRY_S >= 15 * 60 # CelesTrak blocks clients that retry eagerly
assert registry.CLOUDS_REFRESH_S == 15 * 60