Skip to content

Commit 2f5abab

Browse files
committed
Relocated some variables used in tests related to status function
1 parent ad3adb4 commit 2f5abab

2 files changed

Lines changed: 6 additions & 12 deletions

File tree

earthaccess/api.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,7 @@
2929
logger = logging.getLogger(__name__)
3030

3131

32-
def status(
33-
system: System = PROD, raise_on_outage: bool = False
34-
) -> dict[str, str]:
32+
def status(system: System = PROD, raise_on_outage: bool = False) -> dict[str, str]:
3533
"""Get the statuses of NASA's Earthdata services.
3634
3735
Parameters:
@@ -70,9 +68,8 @@ def status(
7068
except (json.JSONDecodeError, requests.exceptions.RequestException):
7169
logger.error(msg)
7270

73-
if (
74-
raise_on_outage and
75-
any(status not in {"OK", "Unknown"} for status in statuses.values())
71+
if raise_on_outage and any(
72+
status not in {"OK", "Unknown"} for status in statuses.values()
7673
):
7774
msg = f"At least 1 service is unhealthy: {services}"
7875
raise ServiceOutage(msg)

tests/integration/test_api.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@
3535
},
3636
]
3737

38+
services = ("Earthdata Login", "Common Metadata Repository")
39+
expected = {service: "Unknown" for service in services}
40+
3841
nasa_statuses = {
3942
PROD: {
4043
"success": True,
@@ -109,9 +112,6 @@ def test_earthdata_status_service_outage():
109112

110113
@responses.activate
111114
def test_earthdata_status_malformed_json():
112-
services = ("Earthdata Login", "Common Metadata Repository")
113-
expected = {service: "Unknown" for service in services}
114-
115115
responses.add(
116116
responses.GET,
117117
"https://status.earthdata.nasa.gov/api/v1/statuses",
@@ -126,9 +126,6 @@ def test_earthdata_status_malformed_json():
126126

127127
@responses.activate
128128
def test_earthdata_status_fetch_fail():
129-
services = ("Earthdata Login", "Common Metadata Repository")
130-
expected = {service: "Unknown" for service in services}
131-
132129
responses.add(
133130
responses.GET,
134131
"https://status.earthdata.nasa.gov/api/v1/statuses",

0 commit comments

Comments
 (0)