@@ -92,10 +92,10 @@ async def load_testdata(
9292 def setup_app (
9393 self ,
9494 broken = False ,
95- timeout_happened = False ,
96- raise_timeout = False ,
9795 fail_auth = False ,
96+ raise_timeout = False ,
9897 stretch = False ,
98+ timeout_happened = False ,
9999 ):
100100 """Create mock webserver for Smile to interface with."""
101101 app = aiohttp .web .Application ()
@@ -135,10 +135,10 @@ def setup_app(
135135 def setup_legacy_app (
136136 self ,
137137 broken = False ,
138- timeout_happened = False ,
139- raise_timeout = False ,
140138 fail_auth = False ,
139+ raise_timeout = False ,
141140 stretch = False ,
141+ timeout_happened = False ,
142142 ):
143143 """Create mock webserver for Smile to interface with."""
144144 app = aiohttp .web .Application ()
@@ -264,7 +264,7 @@ async def smile_fail_auth(cls, request):
264264 raise aiohttp .web .HTTPUnauthorized ()
265265
266266 @staticmethod
267- def connect_status (broken , timeout_happened , fail_auth ):
267+ def connect_status (broken , fail_auth , timeout_happened ):
268268 """Determine assumed status from settings."""
269269 assumed_status = 200
270270 if broken :
@@ -279,11 +279,11 @@ async def connect(
279279 self ,
280280 function ,
281281 broken = False ,
282- timeout_happened = False ,
283- raise_timeout = False ,
284- real_timeout_value = 10 ,
285282 fail_auth = False ,
283+ raise_timeout = False ,
284+ smile_timeout_value = 10 ,
286285 stretch = False ,
286+ timeout_happened = False ,
287287 url_part = CORE_DOMAIN_OBJECTS ,
288288 ):
289289 """Connect to a smile environment and perform basic asserts."""
@@ -293,7 +293,7 @@ async def connect(
293293 )
294294
295295 # Happy flow
296- app = function (broken , timeout_happened , raise_timeout , fail_auth , stretch )
296+ app = function (broken , fail_auth , raise_timeout , stretch , timeout_happened )
297297
298298 server = aiohttp .test_utils .TestServer (
299299 app , port = port , scheme = "http" , host = "127.0.0.1"
@@ -308,7 +308,7 @@ async def connect(
308308 # Try/exceptpass to accommodate for Timeout of aoihttp
309309 try :
310310 resp = await websession .get (url )
311- assumed_status = self .connect_status (broken , timeout_happened , fail_auth )
311+ assumed_status = self .connect_status (broken , fail_auth , timeout_happened )
312312 assert resp .status == assumed_status
313313 timeoutpass_result = False
314314 assert timeoutpass_result
@@ -351,7 +351,7 @@ async def connect(
351351 try :
352352 smile_version = await smile .connect ()
353353 assert smile_version is not None
354- assert smile ._timeout == real_timeout_value
354+ assert smile ._timeout == smile_timeout_value
355355 return server , smile , client
356356 except (
357357 pw_exceptions .ConnectionFailedError ,
@@ -409,15 +409,15 @@ async def connect_legacy_wrapper(
409409 return await self .connect (
410410 self .setup_legacy_app ,
411411 raise_timeout = True ,
412- real_timeout_value = 30 ,
412+ smile_timeout_value = 30 ,
413413 url_part = CORE_LOCATIONS ,
414414 )
415415
416416 try :
417417 _LOGGER .warning ("Connecting to device exceeding timeout in response:" )
418418 await self .connect (
419419 self .setup_legacy_app ,
420- real_timeout_value = 30 ,
420+ smile_timeout_value = 30 ,
421421 timeout_happened = True ,
422422 url_part = CORE_LOCATIONS ,
423423 )
@@ -431,7 +431,7 @@ async def connect_legacy_wrapper(
431431 await self .connect (
432432 self .setup_legacy_app ,
433433 broken = True ,
434- real_timeout_value = 30 ,
434+ smile_timeout_value = 30 ,
435435 url_part = CORE_LOCATIONS ,
436436 )
437437 _LOGGER .error (" - broken information not handled" ) # pragma: no cover
@@ -442,7 +442,7 @@ async def connect_legacy_wrapper(
442442 _LOGGER .info ("Connecting to functioning device:" )
443443 return await self .connect (
444444 self .setup_legacy_app ,
445- real_timeout_value = 30 ,
445+ smile_timeout_value = 30 ,
446446 stretch = stretch ,
447447 url_part = CORE_LOCATIONS ,
448448 )
0 commit comments