Skip to content

Commit 8700fbc

Browse files
committed
Rename smile to api
to avoid smile.smile.xyz constructs
1 parent 52f28a5 commit 8700fbc

File tree

9 files changed

+368
-391
lines changed

9 files changed

+368
-391
lines changed

tests/test_adam.py

Lines changed: 120 additions & 128 deletions
Large diffs are not rendered by default.

tests/test_anna.py

Lines changed: 110 additions & 121 deletions
Large diffs are not rendered by default.

tests/test_generic.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ async def test_fail_anna_connected_to_adam(self):
1717
"""Test erroneous adam with anna system."""
1818
self.smile_setup = "anna_connected_to_adam"
1919
try:
20-
_server, _smile, _client = await self.connect_wrapper()
20+
_server, _api, _client = await self.connect_wrapper()
2121
setup_result = False # pragma: no cover
2222
except pw_exceptions.InvalidSetupError:
2323
setup_result = True
@@ -59,7 +59,7 @@ async def test_connect_timeout(self, timeout_test):
5959
self.smile_setup = "p1v4"
6060
(
6161
server,
62-
smile,
62+
api,
6363
client,
6464
) = await self.connect_wrapper()
6565
setup_result = False # pragma: no cover

tests/test_init.py

Lines changed: 66 additions & 68 deletions
Large diffs are not rendered by default.

tests/test_legacy_anna.py

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -18,34 +18,32 @@ async def test_connect_legacy_anna(self):
1818
self.smile_setup = "legacy_anna"
1919
testdata = await self.load_testdata(SMILE_TYPE, self.smile_setup)
2020

21-
server, smile, client = await self.connect_legacy_wrapper()
22-
assert smile.smile.hostname == "smile000000"
21+
server, api, client = await self.connect_legacy_wrapper()
22+
assert api.smile.hostname == "smile000000"
2323

2424
self.validate_test_basics(
2525
_LOGGER,
26-
smile,
26+
api,
2727
smile_version="1.8.22",
2828
smile_legacy=True,
2929
)
3030

31-
await self.device_test(smile, "2020-03-22 00:00:01", testdata)
32-
assert smile.gateway_id == "0000aaaa0000aaaa0000aaaa0000aa00"
31+
await self.device_test(api, "2020-03-22 00:00:01", testdata)
32+
assert api.gateway_id == "0000aaaa0000aaaa0000aaaa0000aa00"
3333
assert self.entity_items == 41
34-
assert not smile.reboot
34+
assert not api.reboot
3535

36-
result = await self.tinker_legacy_thermostat(smile, schedule_on=False)
36+
result = await self.tinker_legacy_thermostat(api, schedule_on=False)
3737
assert result
3838

39-
await smile.close_connection()
39+
await api.close_connection()
4040
await self.disconnect(server, client)
4141

42-
server, smile, client = await self.connect_legacy_wrapper(raise_timeout=True)
43-
await self.device_test(
44-
smile, "2020-03-22 00:00:01", testdata, skip_testing=True
45-
)
46-
result = await self.tinker_legacy_thermostat(smile, unhappy=True)
42+
server, api, client = await self.connect_legacy_wrapper(raise_timeout=True)
43+
await self.device_test(api, "2020-03-22 00:00:01", testdata, skip_testing=True)
44+
result = await self.tinker_legacy_thermostat(api, unhappy=True)
4745
assert result
48-
await smile.close_connection()
46+
await api.close_connection()
4947
await self.disconnect(server, client)
5048

5149
@pytest.mark.asyncio
@@ -54,26 +52,26 @@ async def test_connect_legacy_anna_2(self):
5452
self.smile_setup = "legacy_anna_2"
5553

5654
testdata = await self.load_testdata(SMILE_TYPE, self.smile_setup)
57-
server, smile, client = await self.connect_legacy_wrapper()
58-
assert smile.smile.hostname == "smile000000"
55+
server, api, client = await self.connect_legacy_wrapper()
56+
assert api.smile.hostname == "smile000000"
5957

6058
self.validate_test_basics(
6159
_LOGGER,
62-
smile,
60+
api,
6361
smile_version="1.8.22",
6462
smile_legacy=True,
6563
)
6664

67-
await self.device_test(smile, "2020-05-03 00:00:01", testdata)
65+
await self.device_test(api, "2020-05-03 00:00:01", testdata)
6866

69-
assert smile.gateway_id == "be81e3f8275b4129852c4d8d550ae2eb"
67+
assert api.gateway_id == "be81e3f8275b4129852c4d8d550ae2eb"
7068
assert self.entity_items == 43
7169

72-
result = await self.tinker_legacy_thermostat(smile)
70+
result = await self.tinker_legacy_thermostat(api)
7371
assert result
7472

75-
result = await self.tinker_legacy_thermostat_schedule(smile, "on")
73+
result = await self.tinker_legacy_thermostat_schedule(api, "on")
7674
assert result
7775

78-
await smile.close_connection()
76+
await api.close_connection()
7977
await self.disconnect(server, client)

tests/test_legacy_generic.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ async def test_fail_legacy_system(self):
1313
"""Test erroneous legacy stretch system."""
1414
self.smile_setup = "faulty_stretch"
1515
try:
16-
_server, _smile, _client = await self.connect_legacy_wrapper()
16+
_server, _api, _client = await self.connect_legacy_wrapper()
1717
setup_result = False # pragma: no cover
1818
except pw_exceptions.InvalidXMLError:
1919
setup_result = True

tests/test_legacy_p1.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,22 @@ async def test_connect_smile_p1_v2(self):
1616
self.smile_setup = "smile_p1_v2"
1717

1818
testdata = await self.load_testdata(SMILE_TYPE, self.smile_setup)
19-
server, smile, client = await self.connect_legacy_wrapper()
20-
assert smile.smile.hostname == "smile000000"
19+
server, api, client = await self.connect_legacy_wrapper()
20+
assert api.smile.hostname == "smile000000"
2121

2222
self.validate_test_basics(
2323
_LOGGER,
24-
smile,
24+
api,
2525
smile_type="power",
2626
smile_version="2.5.9",
2727
smile_legacy=True,
2828
)
2929

30-
await self.device_test(smile, "2022-05-16 00:00:01", testdata)
31-
assert smile.gateway_id == "aaaa0000aaaa0000aaaa0000aaaa00aa"
30+
await self.device_test(api, "2022-05-16 00:00:01", testdata)
31+
assert api.gateway_id == "aaaa0000aaaa0000aaaa0000aaaa00aa"
3232
assert self.entity_items == 26
3333

34-
await smile.close_connection()
34+
await api.close_connection()
3535
await self.disconnect(server, client)
3636

3737
@pytest.mark.asyncio
@@ -40,18 +40,18 @@ async def test_connect_smile_p1_v2_2(self):
4040
self.smile_setup = "smile_p1_v2_2"
4141

4242
testdata = await self.load_testdata(SMILE_TYPE, self.smile_setup)
43-
server, smile, client = await self.connect_legacy_wrapper()
44-
assert smile.smile.hostname == "smile000000"
43+
server, api, client = await self.connect_legacy_wrapper()
44+
assert api.smile.hostname == "smile000000"
4545

4646
self.validate_test_basics(
4747
_LOGGER,
48-
smile,
48+
api,
4949
smile_type="power",
5050
smile_version="2.5.9",
5151
smile_legacy=True,
5252
)
5353

54-
await self.device_test(smile, "2022-05-16 00:00:01", testdata)
54+
await self.device_test(api, "2022-05-16 00:00:01", testdata)
5555
assert self.entity_items == 26
5656

5757
# Now change some data and change directory reading xml from
@@ -61,8 +61,8 @@ async def test_connect_smile_p1_v2_2(self):
6161
)
6262
self.smile_setup = "updated/smile_p1_v2_2"
6363
await self.device_test(
64-
smile, "2022-05-16 00:00:01", testdata_updated, initialize=False
64+
api, "2022-05-16 00:00:01", testdata_updated, initialize=False
6565
)
6666

67-
await smile.close_connection()
67+
await api.close_connection()
6868
await self.disconnect(server, client)

tests/test_legacy_stretch.py

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,23 @@ async def test_connect_stretch_v31(self):
1616
self.smile_setup = "stretch_v31"
1717

1818
testdata = await self.load_testdata(SMILE_TYPE, self.smile_setup)
19-
server, smile, client = await self.connect_legacy_wrapper(stretch=True)
20-
assert smile.smile.hostname == "stretch000000"
19+
server, api, client = await self.connect_legacy_wrapper(stretch=True)
20+
assert api.smile.hostname == "stretch000000"
2121

2222
self.validate_test_basics(
2323
_LOGGER,
24-
smile,
24+
api,
2525
smile_type="stretch",
2626
smile_version="3.1.11",
2727
smile_legacy=True,
2828
)
2929

30-
await self.device_test(smile, "2022-05-16 00:00:01", testdata)
31-
assert smile.gateway_id == "0000aaaa0000aaaa0000aaaa0000aa00"
30+
await self.device_test(api, "2022-05-16 00:00:01", testdata)
31+
assert api.gateway_id == "0000aaaa0000aaaa0000aaaa0000aa00"
3232
assert self.entity_items == 83
3333

3434
switch_change = await self.tinker_switch(
35-
smile,
35+
api,
3636
"059e4d03c7a34d278add5c7a4a781d19",
3737
)
3838
assert not switch_change
@@ -44,10 +44,10 @@ async def test_connect_stretch_v31(self):
4444
)
4545
self.smile_setup = "updated/stretch_v31"
4646
await self.device_test(
47-
smile, "2022-05-16 00:00:01", testdata_updated, initialize=False
47+
api, "2022-05-16 00:00:01", testdata_updated, initialize=False
4848
)
4949

50-
await smile.close_connection()
50+
await api.close_connection()
5151
await self.disconnect(server, client)
5252

5353
@pytest.mark.asyncio
@@ -56,36 +56,36 @@ async def test_connect_stretch_v23(self):
5656
self.smile_setup = "stretch_v23"
5757

5858
testdata = await self.load_testdata(SMILE_TYPE, self.smile_setup)
59-
server, smile, client = await self.connect_legacy_wrapper(stretch=True)
60-
assert smile.smile.hostname == "stretch000000"
59+
server, api, client = await self.connect_legacy_wrapper(stretch=True)
60+
assert api.smile.hostname == "stretch000000"
6161

6262
self.validate_test_basics(
6363
_LOGGER,
64-
smile,
64+
api,
6565
smile_type="stretch",
6666
smile_version="2.3.12",
6767
smile_legacy=True,
6868
)
6969

70-
await self.device_test(smile, "2022-05-16 00:00:01", testdata)
70+
await self.device_test(api, "2022-05-16 00:00:01", testdata)
7171
assert self.entity_items == 243
7272

7373
switch_change = await self.tinker_switch(
74-
smile, "2587a7fcdd7e482dab03fda256076b4b"
74+
api, "2587a7fcdd7e482dab03fda256076b4b"
7575
)
7676
assert switch_change
7777
switch_change = await self.tinker_switch(
78-
smile, "2587a7fcdd7e482dab03fda256076b4b", model="lock"
78+
api, "2587a7fcdd7e482dab03fda256076b4b", model="lock"
7979
)
8080
assert switch_change
8181
switch_change = await self.tinker_switch(
82-
smile,
82+
api,
8383
"f7b145c8492f4dd7a4de760456fdef3e",
8484
["407aa1c1099d463c9137a3a9eda787fd"],
8585
)
8686
assert switch_change
8787

88-
await smile.close_connection()
88+
await api.close_connection()
8989
await self.disconnect(server, client)
9090

9191
@pytest.mark.asyncio
@@ -95,25 +95,25 @@ async def test_connect_stretch_v27_no_domain(self):
9595
self.smile_setup = "stretch_v27_no_domain"
9696

9797
testdata = await self.load_testdata(SMILE_TYPE, self.smile_setup)
98-
server, smile, client = await self.connect_legacy_wrapper(stretch=True)
99-
assert smile.smile.hostname == "stretch000000"
98+
server, api, client = await self.connect_legacy_wrapper(stretch=True)
99+
assert api.smile.hostname == "stretch000000"
100100

101101
self.validate_test_basics(
102102
_LOGGER,
103-
smile,
103+
api,
104104
smile_type="stretch",
105105
smile_version="2.7.18",
106106
smile_legacy=True,
107107
)
108108

109-
await self.device_test(smile, "2022-05-16 00:00:01", testdata)
109+
await self.device_test(api, "2022-05-16 00:00:01", testdata)
110110
assert self.entity_items == 190
111111
_LOGGER.info(" # Assert no master thermostat")
112112

113113
switch_change = await self.tinker_switch(
114-
smile, "8b8d14b242e24cd789743c828b9a2ea9"
114+
api, "8b8d14b242e24cd789743c828b9a2ea9"
115115
)
116116
assert switch_change
117117

118-
await smile.close_connection()
118+
await api.close_connection()
119119
await self.disconnect(server, client)

tests/test_p1.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,18 @@ async def test_connect_p1v4_442_single(self):
1616
self.smile_setup = "p1v4_442_single"
1717

1818
testdata = await self.load_testdata(SMILE_TYPE, self.smile_setup)
19-
server, smile, client = await self.connect_wrapper()
20-
assert smile.smile.hostname == "smile000000"
19+
server, api, client = await self.connect_wrapper()
20+
assert api.smile.hostname == "smile000000"
2121

2222
self.validate_test_basics(
2323
_LOGGER,
24-
smile,
24+
api,
2525
smile_type="power",
2626
smile_version="4.4.2",
2727
)
2828

29-
await self.device_test(smile, "2022-05-16 00:00:01", testdata)
30-
assert smile.gateway_id == "a455b61e52394b2db5081ce025a430f3"
29+
await self.device_test(api, "2022-05-16 00:00:01", testdata)
30+
assert api.gateway_id == "a455b61e52394b2db5081ce025a430f3"
3131
assert self.entity_items == 33
3232
assert not self.notifications
3333

@@ -38,13 +38,13 @@ async def test_connect_p1v4_442_single(self):
3838
)
3939
self.smile_setup = "updated/p1v4_442_single"
4040
await self.device_test(
41-
smile, "2022-05-16 00:00:01", testdata_updated, initialize=False
41+
api, "2022-05-16 00:00:01", testdata_updated, initialize=False
4242
)
4343

4444
# Simulate receiving no xml-data after a requesting a reboot of the gateway
4545
self.smile_setup = "reboot/p1v4_442_single"
4646
try:
47-
await self.device_test(smile, initialize=False)
47+
await self.device_test(api, initialize=False)
4848
except pw_exceptions.PlugwiseError as err:
4949
_LOGGER.debug(
5050
f"Receiving no data after a reboot is properly handled: {err}"
@@ -53,11 +53,11 @@ async def test_connect_p1v4_442_single(self):
5353
# Simulate receiving xml-data with <error>
5454
self.smile_setup = "error/p1v4_442_single"
5555
try:
56-
await self.device_test(smile, initialize=False)
56+
await self.device_test(api, initialize=False)
5757
except pw_exceptions.ResponseError:
5858
_LOGGER.debug("Receiving error-data from the Gateway")
5959

60-
await smile.close_connection()
60+
await api.close_connection()
6161
await self.disconnect(server, client)
6262

6363
@pytest.mark.asyncio
@@ -66,20 +66,20 @@ async def test_connect_p1v4_442_triple(self):
6666
self.smile_setup = "p1v4_442_triple"
6767

6868
testdata = await self.load_testdata(SMILE_TYPE, self.smile_setup)
69-
server, smile, client = await self.connect_wrapper()
70-
assert smile.smile.hostname == "smile000000"
69+
server, api, client = await self.connect_wrapper()
70+
assert api.smile.hostname == "smile000000"
7171

7272
self.validate_test_basics(
7373
_LOGGER,
74-
smile,
74+
api,
7575
smile_type="power",
7676
smile_version="4.4.2",
7777
)
7878

79-
await self.device_test(smile, "2022-05-16 00:00:01", testdata)
80-
assert smile.gateway_id == "03e65b16e4b247a29ae0d75a78cb492e"
79+
await self.device_test(api, "2022-05-16 00:00:01", testdata)
80+
assert api.gateway_id == "03e65b16e4b247a29ae0d75a78cb492e"
8181
assert self.entity_items == 42
8282
assert self.notifications
8383

84-
await smile.close_connection()
84+
await api.close_connection()
8585
await self.disconnect(server, client)

0 commit comments

Comments
 (0)