Skip to content

Commit 7b3c87d

Browse files
committed
Compare internal test-items to code entity_items
1 parent bdde93c commit 7b3c87d

File tree

2 files changed

+18
-10
lines changed

2 files changed

+18
-10
lines changed

tests/test_adam.py

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,10 @@ async def test_connect_adam_plus_anna_new(self):
3232
smile_version="3.9.0",
3333
)
3434

35-
await self.device_test(api, "2025-10-12 00:00:01", testdata)
35+
test_items = await self.device_test(api, "2025-10-12 00:00:01", testdata)
3636
assert api.gateway_id == "da224107914542988a88561b4452b0f6"
3737
assert self.entity_items == 216
38+
assert test_items == self.entity_items
3839
assert self.entity_list == [
3940
"da224107914542988a88561b4452b0f6",
4041
"056ee145a816487eaa69243c3280f8bf",
@@ -210,9 +211,10 @@ async def test_connect_adam_zone_per_device(self):
210211
smile_version="3.0.15",
211212
)
212213

213-
await self.device_test(api, "2022-05-16 00:00:01", testdata)
214+
test_items = await self.device_test(api, "2022-05-16 00:00:01", testdata)
214215
assert api.gateway_id == "fe799307f1624099878210aa0b9f1475"
215216
assert self.entity_items == 379
217+
assert test_items == self.entity_items
216218

217219
assert "af82e4ccf9c548528166d38e560662a4" in self.notifications
218220
await api.delete_notification()
@@ -284,8 +286,9 @@ async def test_connect_adam_multiple_devices_per_zone(self):
284286
smile_version="3.0.15",
285287
)
286288

287-
await self.device_test(api, "2022-05-16 00:00:01", testdata)
289+
test_items = await self.device_test(api, "2022-05-16 00:00:01", testdata)
288290
assert self.entity_items == 385
291+
assert test_items == self.entity_items
289292

290293
assert "af82e4ccf9c548528166d38e560662a4" in self.notifications
291294

@@ -320,8 +323,9 @@ async def test_adam_heatpump_cooling(self):
320323
testdata = await self.load_testdata(SMILE_TYPE, self.smile_setup)
321324
server, api, client = await self.connect_wrapper()
322325

323-
await self.device_test(api, "2022-01-02 00:00:01", testdata)
326+
test_items = await self.device_test(api, "2022-01-02 00:00:01", testdata)
324327
assert self.entity_items == 518
328+
assert test_items == self.entity_items
325329
assert self.cooling_present
326330
assert self._cooling_enabled
327331

@@ -343,8 +347,9 @@ async def test_connect_adam_onoff_cooling_fake_firmware(self):
343347
smile_version=None,
344348
)
345349

346-
await self.device_test(api, "2022-01-02 00:00:01", testdata)
350+
test_items = await self.device_test(api, "2022-01-02 00:00:01", testdata)
347351
assert self.entity_items == 67
352+
assert test_items == self.entity_items
348353
assert self.cooling_present
349354
# assert self._cooling_enabled - no cooling_enabled indication present
350355

@@ -366,9 +371,10 @@ async def test_connect_adam_plus_anna(self):
366371
smile_version="3.0.15",
367372
)
368373

369-
await self.device_test(api, "2020-03-22 00:00:01", testdata)
374+
test_items = await self.device_test(api, "2020-03-22 00:00:01", testdata)
370375
assert api.gateway_id == "b128b4bbbd1f47e9bf4d756e8fb5ee94"
371376
assert self.entity_items == 82
377+
assert test_items == self.entity_items
372378
assert "6fb89e35caeb4b1cb275184895202d84" in self.notifications
373379

374380
result = await self.tinker_thermostat(
@@ -406,9 +412,10 @@ async def test_adam_plus_jip(self):
406412
testdata = await self.load_testdata(SMILE_TYPE, self.smile_setup)
407413
server, api, client = await self.connect_wrapper()
408414

409-
await self.device_test(api, "2021-06-20 00:00:01", testdata)
415+
test_items = await self.device_test(api, "2021-06-20 00:00:01", testdata)
410416
assert api.gateway_id == "b5c2386c6f6342669e50fe49dd05b188"
411417
assert self.entity_items == 261
418+
assert test_items == self.entity_items
412419

413420
# Negative test
414421
result = await self.tinker_thermostat(

tests/test_init.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
CORE_RULES_TAIL = "/core/rules{tail:.*}"
4040
EMPTY_XML = "<xml />"
4141
BOGUS = "!bogus"
42-
4342
_LOGGER = logging.getLogger(__name__)
4443
_LOGGER.setLevel(logging.DEBUG)
4544

@@ -538,6 +537,7 @@ def test_and_assert(test_dict, data, header):
538537
assert tests == asserts + tested_items
539538
_LOGGER.debug("Total items tested: %s", tested_items)
540539
_LOGGER.debug("Total entity test-asserts: %s", asserts)
540+
return asserts
541541

542542
# pragma warning disable S3776
543543

@@ -596,9 +596,10 @@ def test_and_assert(test_dict, data, header):
596596

597597
# Perform tests and asserts in two steps: devices and zones
598598
local_testdata = {"devices": testdata}
599-
for header, data_dict in local_testdata.items():
600-
test_and_assert(data_dict, data, header)
599+
for header, data_dict in local_testdata.items(): # single key, value pair
600+
internal_asserts = test_and_assert(data_dict, data, header)
601601

602+
return internal_asserts
602603
# pragma warning restore S3776
603604

604605
@pytest.mark.asyncio

0 commit comments

Comments
 (0)