修复测试:AMSC/NMC 测试适配环境变量 URL 模式
This commit is contained in:
@@ -73,7 +73,8 @@ def test_parse_wind_plate_payload_rejects_unauthorized_or_empty_payloads():
|
||||
assert _amsc_parse_wind_plate_payload({"code": 200, "data": {}}, city_key="beijing", icao="ZBAA") is None
|
||||
|
||||
|
||||
def test_fetch_amsc_official_current_uses_domestic_city_whitelist():
|
||||
def test_fetch_amsc_official_current_uses_domestic_city_whitelist(monkeypatch):
|
||||
monkeypatch.setenv("AMSC_AWOS_BASE_URL", "https://www.amsc.net.cn/gateway/api/saas/rest/amc/AwosController/getWindPlate")
|
||||
assert _amsc_supported_city_codes()["beijing"] == "ZBAA"
|
||||
assert "new york" not in _amsc_supported_city_codes()
|
||||
|
||||
|
||||
@@ -40,7 +40,8 @@ class _DummyCollector(NmcSourceMixin):
|
||||
self._nmc_cache_lock = threading.Lock()
|
||||
|
||||
|
||||
def test_fetch_nmc_region_current_parses_rest_payload():
|
||||
def test_fetch_nmc_region_current_parses_rest_payload(monkeypatch):
|
||||
monkeypatch.setenv("NMC_REALTIME_BASE_URL", "https://www.nmc.cn/rest/real")
|
||||
collector = _DummyCollector(
|
||||
{
|
||||
"https://www.nmc.cn/rest/real/atcMf": _DummyResponse(
|
||||
@@ -70,7 +71,8 @@ def test_fetch_nmc_region_current_parses_rest_payload():
|
||||
assert out["current"]["airpressure"] is None
|
||||
|
||||
|
||||
def test_fetch_nmc_official_nearby_returns_normalized_row():
|
||||
def test_fetch_nmc_official_nearby_returns_normalized_row(monkeypatch):
|
||||
monkeypatch.setenv("NMC_REALTIME_BASE_URL", "https://www.nmc.cn/rest/real")
|
||||
collector = _DummyCollector(
|
||||
{
|
||||
"https://www.nmc.cn/rest/real/atcMf": _DummyResponse(
|
||||
|
||||
Reference in New Issue
Block a user