Skip to content

Commit 92ef5a6

Browse files
committed
Change boolean name to timeout_happened
1 parent 548d445 commit 92ef5a6

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

tests/test_init.py

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ async def load_testdata(
9292
def setup_app(
9393
self,
9494
broken=False,
95-
timeout=False,
95+
timeout_happened=False,
9696
raise_timeout=False,
9797
fail_auth=False,
9898
stretch=False,
@@ -108,7 +108,7 @@ def setup_app(
108108

109109
if broken:
110110
app.router.add_get(CORE_DOMAIN_OBJECTS, self.smile_broken)
111-
elif timeout:
111+
elif timeout_happened:
112112
app.router.add_get(CORE_DOMAIN_OBJECTS, self.smile_timeout)
113113
else:
114114
app.router.add_get(CORE_DOMAIN_OBJECTS, self.smile_domain_objects)
@@ -135,7 +135,7 @@ def setup_app(
135135
def setup_legacy_app(
136136
self,
137137
broken=False,
138-
timeout=False,
138+
timeout_happened=False,
139139
raise_timeout=False,
140140
fail_auth=False,
141141
stretch=False,
@@ -151,7 +151,7 @@ def setup_legacy_app(
151151

152152
if broken:
153153
app.router.add_get(CORE_LOCATIONS, self.smile_broken)
154-
elif timeout:
154+
elif timeout_happened:
155155
app.router.add_get(CORE_LOCATIONS, self.smile_timeout)
156156
else:
157157
app.router.add_get(CORE_LOCATIONS, self.smile_locations)
@@ -264,12 +264,12 @@ async def smile_fail_auth(cls, request):
264264
raise aiohttp.web.HTTPUnauthorized()
265265

266266
@staticmethod
267-
def connect_status(broken, timeout, fail_auth):
267+
def connect_status(broken, timeout_happened, fail_auth):
268268
"""Determine assumed status from settings."""
269269
assumed_status = 200
270270
if broken:
271271
assumed_status = 500
272-
if timeout:
272+
if timeout_happened:
273273
assumed_status = 504
274274
if fail_auth:
275275
assumed_status = 401
@@ -278,7 +278,7 @@ def connect_status(broken, timeout, fail_auth):
278278
async def connect(
279279
self,
280280
broken=False,
281-
timeout=False,
281+
timeout_happened=False,
282282
raise_timeout=False,
283283
fail_auth=False,
284284
stretch=False,
@@ -290,7 +290,7 @@ async def connect(
290290
)
291291

292292
# Happy flow
293-
app = self.setup_app(broken, timeout, raise_timeout, fail_auth, stretch)
293+
app = self.setup_app(broken, timeout_happened, raise_timeout, fail_auth, stretch)
294294

295295
server = aiohttp.test_utils.TestServer(
296296
app, port=port, scheme="http", host="127.0.0.1"
@@ -313,7 +313,7 @@ async def connect(
313313
timeoutpass_result = True
314314
assert timeoutpass_result
315315

316-
if not broken and not timeout and not fail_auth:
316+
if not broken and not timeout_happened and not fail_auth:
317317
text = await resp.text()
318318
assert "xml" in text
319319

@@ -340,7 +340,7 @@ async def connect(
340340
websession=websession,
341341
)
342342

343-
if not timeout:
343+
if not timeout_happened:
344344
assert smile._timeout == 30
345345

346346
# Connect to the smile
@@ -362,7 +362,7 @@ async def connect(
362362
async def connect_legacy(
363363
self,
364364
broken=False,
365-
timeout=False,
365+
timeout_happened=False,
366366
raise_timeout=False,
367367
fail_auth=False,
368368
stretch=False,
@@ -374,7 +374,7 @@ async def connect_legacy(
374374
)
375375

376376
# Happy flow
377-
app = self.setup_legacy_app(broken, timeout, raise_timeout, fail_auth, stretch)
377+
app = self.setup_legacy_app(broken, timeout_happened, raise_timeout, fail_auth, stretch)
378378

379379
server = aiohttp.test_utils.TestServer(
380380
app, port=port, scheme="http", host="127.0.0.1"
@@ -389,15 +389,15 @@ async def connect_legacy(
389389
# Try/exceptpass to accommodate for Timeout of aoihttp
390390
try:
391391
resp = await websession.get(url)
392-
assumed_status = self.connect_status(broken, timeout, fail_auth)
392+
assumed_status = self.connect_status(broken, timeout_happened, fail_auth)
393393
assert resp.status == assumed_status
394394
timeoutpass_result = False
395395
assert timeoutpass_result
396396
except Exception: # pylint: disable=broad-except
397397
timeoutpass_result = True
398398
assert timeoutpass_result
399399

400-
if not broken and not timeout and not fail_auth:
400+
if not broken and not timeout_happened and not fail_auth:
401401
text = await resp.text()
402402
assert "xml" in text
403403

@@ -424,7 +424,7 @@ async def connect_legacy(
424424
websession=websession,
425425
)
426426

427-
if not timeout:
427+
if not timeout_happened:
428428
assert smile._timeout == 30
429429

430430
# Connect to the smile
@@ -464,7 +464,7 @@ async def connect_wrapper(
464464

465465
try:
466466
_LOGGER.warning("Connecting to device exceeding timeout in response:")
467-
await self.connect(timeout=True)
467+
await self.connect(timeout_happened=True)
468468
_LOGGER.error(" - timeout not handled") # pragma: no cover
469469
raise self.ConnectError # pragma: no cover
470470
except pw_exceptions.ConnectionFailedError:
@@ -491,7 +491,7 @@ async def connect_legacy_wrapper(
491491

492492
try:
493493
_LOGGER.warning("Connecting to device exceeding timeout in response:")
494-
await self.connect_legacy(timeout=True)
494+
await self.connect_legacy(timeout_happened=True)
495495
_LOGGER.error(" - timeout not handled") # pragma: no cover
496496
raise self.ConnectError # pragma: no cover
497497
except pw_exceptions.ConnectionFailedError:

0 commit comments

Comments
 (0)