File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2929logger = 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 )
Original file line number Diff line number Diff line change 3535 },
3636]
3737
38+ services = ("Earthdata Login" , "Common Metadata Repository" )
39+ expected = {service : "Unknown" for service in services }
40+
3841nasa_statuses = {
3942 PROD : {
4043 "success" : True ,
@@ -109,9 +112,6 @@ def test_earthdata_status_service_outage():
109112
110113@responses .activate
111114def 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
128128def 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" ,
You can’t perform that action at this time.
0 commit comments