@@ -25,7 +25,7 @@ async def test_permit_join(device, fixed_joining_bug, mocker, make_application):
25
25
if fixed_joining_bug :
26
26
mocker .patch .object (device , "code_revision" , 20210708 )
27
27
28
- app , znp_server = make_application (server_cls = device )
28
+ app , znp_server = await make_application (server_cls = device )
29
29
30
30
# Handle us opening joins on the coordinator
31
31
permit_join_coordinator = znp_server .reply_once_to (
@@ -66,7 +66,7 @@ async def test_permit_join(device, fixed_joining_bug, mocker, make_application):
66
66
67
67
@pytest .mark .parametrize ("device" , FORMED_DEVICES )
68
68
async def test_join_coordinator (device , make_application ):
69
- app , znp_server = make_application (server_cls = device )
69
+ app , znp_server = await make_application (server_cls = device )
70
70
71
71
# Handle us opening joins on the coordinator
72
72
permit_join_coordinator = znp_server .reply_once_to (
@@ -80,7 +80,7 @@ async def test_join_coordinator(device, make_application):
80
80
)
81
81
82
82
await app .startup (auto_form = False )
83
- await app .permit (node = app .ieee )
83
+ await app .permit (node = app .state . node_info . ieee )
84
84
85
85
await permit_join_coordinator
86
86
@@ -90,7 +90,7 @@ async def test_join_coordinator(device, make_application):
90
90
@pytest .mark .parametrize ("device" , FORMED_ZSTACK3_DEVICES )
91
91
@pytest .mark .parametrize ("permit_result" , [None , asyncio .TimeoutError ()])
92
92
async def test_permit_join_with_key (device , permit_result , make_application , mocker ):
93
- app , znp_server = make_application (server_cls = device )
93
+ app , znp_server = await make_application (server_cls = device )
94
94
95
95
# Consciot bulb
96
96
ieee = t .EUI64 .convert ("EC:1B:BD:FF:FE:54:4F:40" )
@@ -112,10 +112,6 @@ async def test_permit_join_with_key(device, permit_result, make_application, moc
112
112
],
113
113
)
114
114
115
- mocker .patch .object (
116
- app , "permit" , new = CoroutineMock (side_effect = [None , permit_result ])
117
- )
118
-
119
115
join_disable_install_code = znp_server .reply_once_to (
120
116
c .AppConfig .BDBSetJoinUsesInstallCodeKey .Req (BdbJoinUsesInstallCodeKey = False ),
121
117
responses = [
@@ -125,14 +121,16 @@ async def test_permit_join_with_key(device, permit_result, make_application, moc
125
121
126
122
await app .startup (auto_form = False )
127
123
124
+ mocker .patch .object (app , "permit" , new = CoroutineMock (side_effect = permit_result ))
125
+
128
126
with contextlib .nullcontext () if permit_result is None else pytest .raises (
129
127
asyncio .TimeoutError
130
128
):
131
129
await app .permit_with_key (node = ieee , code = code , time_s = 1 )
132
130
133
131
await bdb_add_install_code
134
132
await join_enable_install_code
135
- assert app .permit .call_count == 2
133
+ assert app .permit .call_count == 1
136
134
137
135
# The install code policy is reset right after
138
136
await join_disable_install_code
@@ -142,7 +140,7 @@ async def test_permit_join_with_key(device, permit_result, make_application, moc
142
140
143
141
@pytest .mark .parametrize ("device" , FORMED_ZSTACK3_DEVICES )
144
142
async def test_permit_join_with_invalid_key (device , make_application ):
145
- app , znp_server = make_application (server_cls = device )
143
+ app , znp_server = await make_application (server_cls = device )
146
144
147
145
# Consciot bulb
148
146
ieee = t .EUI64 .convert ("EC:1B:BD:FF:FE:54:4F:40" )
@@ -156,7 +154,7 @@ async def test_permit_join_with_invalid_key(device, make_application):
156
154
157
155
@pytest .mark .parametrize ("device" , FORMED_DEVICES )
158
156
async def test_on_zdo_device_join (device , make_application , mocker ):
159
- app , znp_server = make_application (server_cls = device )
157
+ app , znp_server = await make_application (server_cls = device )
160
158
await app .startup (auto_form = False )
161
159
162
160
mocker .patch .object (app , "handle_join" )
@@ -176,7 +174,7 @@ async def test_on_zdo_device_join(device, make_application, mocker):
176
174
177
175
@pytest .mark .parametrize ("device" , FORMED_DEVICES )
178
176
async def test_on_zdo_device_join_and_announce_fast (device , make_application , mocker ):
179
- app , znp_server = make_application (server_cls = device )
177
+ app , znp_server = await make_application (server_cls = device )
180
178
await app .startup (auto_form = False )
181
179
182
180
mocker .patch .object (app , "handle_join" )
@@ -213,7 +211,7 @@ async def test_on_zdo_device_join_and_announce_fast(device, make_application, mo
213
211
214
212
@pytest .mark .parametrize ("device" , FORMED_DEVICES )
215
213
async def test_on_zdo_device_join_and_announce_slow (device , make_application , mocker ):
216
- app , znp_server = make_application (server_cls = device )
214
+ app , znp_server = await make_application (server_cls = device )
217
215
await app .startup (auto_form = False )
218
216
219
217
mocker .patch .object (app , "handle_join" )
@@ -251,7 +249,7 @@ async def test_on_zdo_device_join_and_announce_slow(device, make_application, mo
251
249
252
250
@pytest .mark .parametrize ("device" , FORMED_DEVICES )
253
251
async def test_new_device_join_and_bind_complex (device , make_application , mocker ):
254
- app , znp_server = make_application (server_cls = device )
252
+ app , znp_server = await make_application (server_cls = device )
255
253
await app .startup (auto_form = False )
256
254
257
255
nwk = 0x6A7C
@@ -502,7 +500,7 @@ def bind_req_callback(request):
502
500
ep = device .endpoints [request .SrcEndpoint ]
503
501
assert cluster in ep .in_clusters or cluster in ep .out_clusters
504
502
505
- assert request .Address .ieee == app .ieee
503
+ assert request .Address .ieee == app .state . node_info . ieee
506
504
assert request .Address .addrmode == 0x03
507
505
508
506
# Make sure the endpoint profiles match up
@@ -528,7 +526,7 @@ def bind_req_callback(request):
528
526
529
527
@pytest .mark .parametrize ("device" , FORMED_DEVICES )
530
528
async def test_unknown_device_discovery (device , make_application , mocker ):
531
- app , znp_server = make_application (server_cls = device )
529
+ app , znp_server = await make_application (server_cls = device )
532
530
await app .startup (auto_form = False )
533
531
534
532
mocker .spy (app , "handle_join" )
@@ -602,4 +600,4 @@ async def test_unknown_device_discovery(device, make_application, mocker):
602
600
assert new_dev .nwk == new_nwk
603
601
assert new_dev .ieee == new_ieee
604
602
605
- await app .pre_shutdown ()
603
+ await app .shutdown ()
0 commit comments