fix(satellite): populate currentPos with full telemetry in pass predictions

Previously currentPos only had lat/lon, so the updateTelemetry fallback
(used before first live position arrives) always showed '---' for
altitude/elevation/azimuth/distance. currentPos now includes all fields
computed from the request observer location. updateTelemetry simplified
to delegate to applyTelemetryPosition.
This commit is contained in:
James Smith
2026-03-19 21:48:33 +00:00
parent d84237dbb4
commit d240ae06e3
3 changed files with 34 additions and 15 deletions
+19
View File
@@ -121,6 +121,25 @@ def test_tracker_position_has_no_observer_fields():
assert required in pos, f"SSE tracker must emit '{required}'"
def test_predict_passes_currentpos_has_full_fields(client):
"""currentPos in pass results must include altitude, elevation, azimuth, distance."""
payload = {
'latitude': 51.5074,
'longitude': -0.1278,
'hours': 48,
'minEl': 5,
'satellites': ['ISS'],
}
response = client.post('/satellite/predict', json=payload)
assert response.status_code == 200
data = response.json
assert data['status'] == 'success'
if data['passes']:
cp = data['passes'][0].get('currentPos', {})
for field in ('lat', 'lon', 'altitude', 'elevation', 'azimuth', 'distance'):
assert field in cp, f"currentPos missing field: {field}"
@patch('routes.satellite.refresh_tle_data', return_value=['ISS'])
@patch('routes.satellite._load_db_satellites_into_cache')
def test_tle_auto_refresh_schedules_daily_repeat(mock_load_db, mock_refresh):