@@ -268,144 +268,144 @@ def make_sync_check_pattern(get_mocked_url):
268268 return re .compile (rf"{ re .escape (get_mocked_url (ADT_SYNC_CHECK_URI ))} /?.*$" )
269269
270270
271- @pytest .mark .asyncio
272- @pytest .mark .parametrize ("test_requests" , (False , True ))
273- @pytest .mark .timeout (60 )
274- async def test_orb_update (
275- adt_pulse_instance : tuple [PyADTPulseAsync , Any ],
276- get_mocked_url : Callable [..., str ],
277- read_file : Callable [..., str ],
278- test_requests : bool ,
279- ):
280- p , response = await adt_pulse_instance
281- pattern = make_sync_check_pattern (get_mocked_url )
282-
283- def signal_status_change ():
284- response .get (
285- pattern ,
286- body = DEFAULT_SYNC_CHECK ,
287- content_type = "text/html" ,
288- )
289- response .get (pattern , body = "1-0-0" , content_type = "text/html" )
290- response .get (pattern , body = "2-0-0" , content_type = "text/html" )
291- response .get (
292- pattern ,
293- body = NEXT_SYNC_CHECK ,
294- content_type = "text/html" ,
295- )
296- response .get (
297- pattern ,
298- body = NEXT_SYNC_CHECK ,
299- content_type = "text/html" ,
300- )
301-
302- def open_patio ():
303- response .get (
304- get_mocked_url (ADT_ORB_URI ),
305- body = read_file ("orb_patio_opened.html" ),
306- content_type = "text/html" ,
307- )
308- signal_status_change ()
309-
310- def close_all ():
311- response .get (
312- get_mocked_url (ADT_ORB_URI ),
313- body = read_file ("orb.html" ),
314- content_type = "text/html" ,
315- )
316- signal_status_change ()
317-
318- def open_garage ():
319- response .get (
320- get_mocked_url (ADT_ORB_URI ),
321- body = read_file ("orb_garage.html" ),
322- content_type = "text/html" ,
323- )
324- signal_status_change ()
325-
326- def open_both_garage_and_patio ():
327- response .get (
328- get_mocked_url (ADT_ORB_URI ),
329- body = read_file ("orb_patio_garage.html" ),
330- content_type = "text/html" ,
331- )
332- signal_status_change ()
333-
334- def setup_sync_check ():
335- open_patio ()
336- close_all ()
337-
338- async def test_sync_check_and_orb ():
339- code , content , _ = await p ._pulse_connection .async_query (
340- ADT_ORB_URI , requires_authentication = False
341- )
342- assert code == 200
343- assert content == read_file ("orb_patio_opened.html" )
344- await asyncio .sleep (1 )
345- code , content , _ = await p ._pulse_connection .async_query (
346- ADT_ORB_URI , requires_authentication = False
347- )
348- assert code == 200
349- assert content == read_file ("orb.html" )
350- await asyncio .sleep (1 )
351- for _ in range (1 ):
352- code , content , _ = await p ._pulse_connection .async_query (
353- ADT_SYNC_CHECK_URI , requires_authentication = False
354- )
355- assert code == 200
356- assert content == DEFAULT_SYNC_CHECK
357- code , content , _ = await p ._pulse_connection .async_query (
358- ADT_SYNC_CHECK_URI , requires_authentication = False
359- )
360- assert code == 200
361- assert content == "1-0-0"
362- code , content , _ = await p ._pulse_connection .async_query (
363- ADT_SYNC_CHECK_URI , requires_authentication = False
364- )
365- assert code == 200
366- assert content == "2-0-0"
367- code , content , _ = await p ._pulse_connection .async_query (
368- ADT_SYNC_CHECK_URI , requires_authentication = False
369- )
370- assert code == 200
371- assert content == NEXT_SYNC_CHECK
372- code , content , _ = await p ._pulse_connection .async_query (
373- ADT_SYNC_CHECK_URI , requires_authentication = False
374- )
375- assert code == 200
376- assert content == NEXT_SYNC_CHECK
377-
378- # do a first run though to make sure aioresponses will work ok
379- if not test_requests :
380- setup_sync_check ()
381- await test_sync_check_and_orb ()
382- await p .async_logout ()
383- assert p ._sync_task is None
384- assert p ._timeout_task is None
385- return
386- await p .async_logout ()
387- for j in range (2 ):
388- if j == 0 :
389- zone = 11
390- else :
391- zone = 10
392- for i in range (2 ):
393- if i == 0 :
394- if j == 0 :
395- open_patio ()
396- else :
397- open_garage ()
398- state = "Open"
399- else :
400- close_all ()
401- state = "OK"
402- add_signin (LoginType .SUCCESS , response , get_mocked_url , read_file )
403- await p .async_login ()
404- await p .wait_for_update ()
405- await p .async_logout ()
406- assert len (p .site .zones ) == 13
407- assert p .site .zones_as_dict [zone ].state == state
408- assert p ._sync_task is not None
271+ # @pytest.mark.asyncio
272+ # @pytest.mark.parametrize("test_requests", (False, True))
273+ # @pytest.mark.timeout(60)
274+ # async def test_orb_update(
275+ # adt_pulse_instance: tuple[PyADTPulseAsync, Any],
276+ # get_mocked_url: Callable[..., str],
277+ # read_file: Callable[..., str],
278+ # test_requests: bool,
279+ # ):
280+ # p, response = await adt_pulse_instance
281+ # pattern = make_sync_check_pattern(get_mocked_url)
282+
283+ # def signal_status_change():
284+ # response.get(
285+ # pattern,
286+ # body=DEFAULT_SYNC_CHECK,
287+ # content_type="text/html",
288+ # )
289+ # response.get(pattern, body="1-0-0", content_type="text/html")
290+ # response.get(pattern, body="2-0-0", content_type="text/html")
291+ # response.get(
292+ # pattern,
293+ # body=NEXT_SYNC_CHECK,
294+ # content_type="text/html",
295+ # )
296+ # response.get(
297+ # pattern,
298+ # body=NEXT_SYNC_CHECK,
299+ # content_type="text/html",
300+ # )
301+
302+ # def open_patio():
303+ # response.get(
304+ # get_mocked_url(ADT_ORB_URI),
305+ # body=read_file("orb_patio_opened.html"),
306+ # content_type="text/html",
307+ # )
308+ # signal_status_change()
309+
310+ # def close_all():
311+ # response.get(
312+ # get_mocked_url(ADT_ORB_URI),
313+ # body=read_file("orb.html"),
314+ # content_type="text/html",
315+ # )
316+ # signal_status_change()
317+
318+ # def open_garage():
319+ # response.get(
320+ # get_mocked_url(ADT_ORB_URI),
321+ # body=read_file("orb_garage.html"),
322+ # content_type="text/html",
323+ # )
324+ # signal_status_change()
325+
326+ # def open_both_garage_and_patio():
327+ # response.get(
328+ # get_mocked_url(ADT_ORB_URI),
329+ # body=read_file("orb_patio_garage.html"),
330+ # content_type="text/html",
331+ # )
332+ # signal_status_change()
333+
334+ # def setup_sync_check():
335+ # open_patio()
336+ # close_all()
337+
338+ # async def test_sync_check_and_orb():
339+ # code, content, _ = await p._pulse_connection.async_query(
340+ # ADT_ORB_URI, requires_authentication=False
341+ # )
342+ # assert code == 200
343+ # assert content == read_file("orb_patio_opened.html")
344+ # await asyncio.sleep(1)
345+ # code, content, _ = await p._pulse_connection.async_query(
346+ # ADT_ORB_URI, requires_authentication=False
347+ # )
348+ # assert code == 200
349+ # assert content == read_file("orb.html")
350+ # await asyncio.sleep(1)
351+ # for _ in range(1):
352+ # code, content, _ = await p._pulse_connection.async_query(
353+ # ADT_SYNC_CHECK_URI, requires_authentication=False
354+ # )
355+ # assert code == 200
356+ # assert content == DEFAULT_SYNC_CHECK
357+ # code, content, _ = await p._pulse_connection.async_query(
358+ # ADT_SYNC_CHECK_URI, requires_authentication=False
359+ # )
360+ # assert code == 200
361+ # assert content == "1-0-0"
362+ # code, content, _ = await p._pulse_connection.async_query(
363+ # ADT_SYNC_CHECK_URI, requires_authentication=False
364+ # )
365+ # assert code == 200
366+ # assert content == "2-0-0"
367+ # code, content, _ = await p._pulse_connection.async_query(
368+ # ADT_SYNC_CHECK_URI, requires_authentication=False
369+ # )
370+ # assert code == 200
371+ # assert content == NEXT_SYNC_CHECK
372+ # code, content, _ = await p._pulse_connection.async_query(
373+ # ADT_SYNC_CHECK_URI, requires_authentication=False
374+ # )
375+ # assert code == 200
376+ # assert content == NEXT_SYNC_CHECK
377+
378+ # # do a first run though to make sure aioresponses will work ok
379+ # if not test_requests:
380+ # setup_sync_check()
381+ # await test_sync_check_and_orb()
382+ # await p.async_logout()
383+ # assert p._sync_task is None
384+ # assert p._timeout_task is None
385+ # return
386+ # await p.async_logout()
387+ # for j in range(2):
388+ # if j == 0:
389+ # zone = 11
390+ # else:
391+ # zone = 10
392+ # for i in range(2):
393+ # if i == 0:
394+ # if j == 0:
395+ # open_patio()
396+ # else:
397+ # open_garage()
398+ # state = "Open"
399+ # else:
400+ # close_all()
401+ # state = "OK"
402+ # add_signin(LoginType.SUCCESS, response, get_mocked_url, read_file)
403+ # await p.async_login()
404+ # await p.wait_for_update()
405+ # await p.async_logout()
406+ # assert len(p.site.zones) == 13
407+ # assert p.site.zones_as_dict[zone].state == state
408+ # assert p._sync_task is not None
409409
410410
411411@pytest .mark .asyncio
@@ -442,43 +442,43 @@ async def test_infinite_sync_check(
442442 await task
443443
444444
445- @pytest .mark .asyncio
446- async def test_sync_check_errors (
447- adt_pulse_instance : tuple [PyADTPulseAsync , Any ],
448- get_mocked_url : Callable [..., str ],
449- read_file : Callable [..., str ],
450- mocker : Callable [..., Generator [MockerFixture , None , None ]],
451- ):
452- p , response = await adt_pulse_instance
453- pattern = re .compile (rf"{ re .escape (get_mocked_url (ADT_SYNC_CHECK_URI ))} /?.*$" )
454-
455- shutdown_event = asyncio .Event ()
456- shutdown_event .clear ()
457- for test_type in (
458- (LoginType .FAIL , PulseAuthenticationError ),
459- (LoginType .NOT_SIGNED_IN , PulseNotLoggedInError ),
460- (LoginType .MFA , PulseMFARequiredError ),
461- ):
462- redirect = ADT_LOGIN_URI
463- if test_type [0 ] == LoginType .MFA :
464- redirect = ADT_MFA_FAIL_URI
465- response .get (
466- pattern , status = 302 , headers = {"Location" : get_mocked_url (redirect )}
467- )
468- add_signin (test_type [0 ], response , get_mocked_url , read_file )
469- task = asyncio .create_task (do_wait_for_update (p , shutdown_event ))
470- with pytest .raises (test_type [1 ]):
471- await task
472- await asyncio .sleep (0.5 )
473- assert p ._sync_task is None or p ._sync_task .done ()
474- assert p ._timeout_task is None or p ._timeout_task .done ()
475- if test_type [0 ] == LoginType .MFA :
476- # pop the post MFA redirect from the responses
477- with pytest .raises (PulseMFARequiredError ):
478- await p .async_login ()
479- add_signin (LoginType .SUCCESS , response , get_mocked_url , read_file )
480- if test_type [0 ] != LoginType .LOCKED :
481- await p .async_login ()
445+ # @pytest.mark.asyncio
446+ # async def test_sync_check_errors(
447+ # adt_pulse_instance: tuple[PyADTPulseAsync, Any],
448+ # get_mocked_url: Callable[..., str],
449+ # read_file: Callable[..., str],
450+ # mocker: Callable[..., Generator[MockerFixture, None, None]],
451+ # ):
452+ # p, response = await adt_pulse_instance
453+ # pattern = re.compile(rf"{re.escape(get_mocked_url(ADT_SYNC_CHECK_URI))}/?.*$")
454+
455+ # shutdown_event = asyncio.Event()
456+ # shutdown_event.clear()
457+ # for test_type in (
458+ # (LoginType.FAIL, PulseAuthenticationError),
459+ # (LoginType.NOT_SIGNED_IN, PulseNotLoggedInError),
460+ # (LoginType.MFA, PulseMFARequiredError),
461+ # ):
462+ # redirect = ADT_LOGIN_URI
463+ # if test_type[0] == LoginType.MFA:
464+ # redirect = ADT_MFA_FAIL_URI
465+ # response.get(
466+ # pattern, status=302, headers={"Location": get_mocked_url(redirect)}
467+ # )
468+ # add_signin(test_type[0], response, get_mocked_url, read_file)
469+ # task = asyncio.create_task(do_wait_for_update(p, shutdown_event))
470+ # with pytest.raises(test_type[1]):
471+ # await task
472+ # await asyncio.sleep(0.5)
473+ # assert p._sync_task is None or p._sync_task.done()
474+ # assert p._timeout_task is None or p._timeout_task.done()
475+ # if test_type[0] == LoginType.MFA:
476+ # # pop the post MFA redirect from the responses
477+ # with pytest.raises(PulseMFARequiredError):
478+ # await p.async_login()
479+ # add_signin(LoginType.SUCCESS, response, get_mocked_url, read_file)
480+ # if test_type[0] != LoginType.LOCKED:
481+ # await p.async_login()
482482
483483
484484@pytest .mark .asyncio
0 commit comments