@@ -146,6 +146,46 @@ async def test_safe_dict_post_and_list_post(monkeypatch, make_client) -> None:
146146 assert result_empty_list == []
147147
148148
149+ @pytest .mark .asyncio
150+ async def test_get_check (make_client ) -> None :
151+ """Test _get_check method returns True for ok responses, False otherwise."""
152+ session = MagicMock (spec = aiohttp .ClientSession )
153+
154+ # Fake response class for testing
155+ class FakeResp :
156+ def __init__ (self , status = 500 , ok = False ):
157+ self .status = status
158+ self .reason = "Test"
159+ self .ok = ok
160+ self .request_info = MagicMock ()
161+ self .history = []
162+ self .headers = {}
163+
164+ async def __aenter__ (self ):
165+ return self
166+
167+ async def __aexit__ (self , exc_type , exc , tb ):
168+ return False
169+
170+ # Test successful response (ok=True)
171+ session .get = lambda * a , ** k : FakeResp (status = 200 , ok = True )
172+ client = make_client (session = session )
173+ result = await client ._get_check ("/api/test" )
174+ assert result is True
175+
176+ # Test failed response (ok=False)
177+ session .get = lambda * a , ** k : FakeResp (status = 404 , ok = False )
178+ client = make_client (session = session )
179+ result = await client ._get_check ("/api/test" )
180+ assert result is False
181+
182+ # Test 403 response specifically
183+ session .get = lambda * a , ** k : FakeResp (status = 403 , ok = False )
184+ client = make_client (session = session )
185+ result = await client ._get_check ("/api/test" )
186+ assert result is False
187+
188+
149189@pytest .mark .asyncio
150190async def test_get_ip_key_sorting (make_client ) -> None :
151191 """Sort IP-like items using get_ip_key ordering."""
0 commit comments