@@ -1095,7 +1095,10 @@ async def test_events(self, mock_response, client):
1095
1095
mock_response .get (
1096
1096
f"{ API_URL } /box/finger/api/{ API_VERSION } /events" ,
1097
1097
status = 200 ,
1098
- body = 'data: { "devices": { "device1":'
1098
+ body = "event: pulse\n "
1099
+ "data: 1730803627\n \n "
1100
+ "event: snapshot\n "
1101
+ 'data: { "devices": { "device1":'
1099
1102
'{ "name": "device1", "type": "rollershutter" },'
1100
1103
'"device2": { "name": "device2" },'
1101
1104
'"device3": { "type": "rollershutter" } } }' ,
@@ -1112,7 +1115,10 @@ async def test_start(self, mock__complete_internal_task, mock_response, client):
1112
1115
mock_response .get (
1113
1116
f"{ API_URL } /box/finger/api/{ API_VERSION } /events" ,
1114
1117
status = 200 ,
1115
- body = 'data: { "devices": { "device1":'
1118
+ body = "event: pulse\n "
1119
+ "data: 1730803627\n \n "
1120
+ "event: snapshot\n "
1121
+ 'data: { "devices": { "device1":'
1116
1122
'{ "name": "device1", "type": "rollershutter" },'
1117
1123
'"device2": { "name": "device2" },'
1118
1124
'"device3": { "type": "rollershutter" } } }' ,
@@ -1141,12 +1147,14 @@ async def test_start_break(self, mock_response, client):
1141
1147
mock_response .get (
1142
1148
f"{ API_URL } /box/finger/api/{ API_VERSION } /events" ,
1143
1149
status = 200 ,
1144
- body = 'data: { "devices": { "device1":'
1150
+ body = "event: pulse\n "
1151
+ "data: 1730803627\n \n "
1152
+ "event: snapshot\n "
1153
+ 'data: { "devices": { "device1":'
1145
1154
'{ "name": "device1", "type": "rollershutter" },'
1146
1155
'"device2": { "name": "device2" },'
1147
1156
'"device3": { "type": "rollershutter" } } }' ,
1148
1157
)
1149
-
1150
1158
def callback (device ):
1151
1159
if device .identifier == "device1" :
1152
1160
client .stop ()
@@ -1163,7 +1171,10 @@ async def test_start_without_callback(self, mock_response, client):
1163
1171
mock_response .get (
1164
1172
f"{ API_URL } /box/finger/api/{ API_VERSION } /events" ,
1165
1173
status = 200 ,
1166
- body = 'data: { "devices": { "device1":'
1174
+ body = "event: pulse\n "
1175
+ "data: 1730803627\n \n "
1176
+ "event: snapshot\n "
1177
+ 'data: { "devices": { "device1":'
1167
1178
'{ "name": "device1", "type": "rollershutter" },'
1168
1179
'"device2": { "name": "device2" },'
1169
1180
'"device3": { "type": "rollershutter" } } }' ,
@@ -1179,7 +1190,10 @@ async def test_events_details(self, mock_device, mock_response, client):
1179
1190
mock_response .get (
1180
1191
f"{ API_URL } /box/finger/api/{ API_VERSION } /events" ,
1181
1192
status = 200 ,
1182
- body = 'data: { "devices": { "device":'
1193
+ body = "event: pulse\n "
1194
+ "data: 1730803627\n \n "
1195
+ "event: snapshot\n "
1196
+ 'data: { "devices": { "device":'
1183
1197
'{ "name": "device", "type": "rollershutter" } } }' ,
1184
1198
)
1185
1199
mock_device .return_value = Device (
@@ -1202,7 +1216,10 @@ async def test_events_device_exception(self, mock_device, mock_response, client)
1202
1216
mock_response .get (
1203
1217
f"{ API_URL } /box/finger/api/{ API_VERSION } /events" ,
1204
1218
status = 200 ,
1205
- body = 'data: { "devices": { "device":'
1219
+ body = "event: pulse\n "
1220
+ "data: 1730803627\n \n "
1221
+ "event: patch\n "
1222
+ 'data: { "devices": { "device":'
1206
1223
'{ "name": "device", "type": "rollershutter" } } }' ,
1207
1224
)
1208
1225
mock_device .side_effect = AttributeError ()
@@ -1217,7 +1234,10 @@ async def test_events_empty_data(self, mock_response, client):
1217
1234
mock_response .get (
1218
1235
f"{ API_URL } /box/finger/api/{ API_VERSION } /events" ,
1219
1236
status = 200 ,
1220
- body = 'data: { "devices": { "device1": {} } }' ,
1237
+ body = "event: pulse\n "
1238
+ "data: 1730803627\n \n "
1239
+ "event: patch\n "
1240
+ 'data: { "devices": { "device1": {} } }' ,
1221
1241
)
1222
1242
index = 1
1223
1243
async for device in client .events ():
@@ -1230,7 +1250,10 @@ async def test_events_no_devices(self, mock_response, client):
1230
1250
mock_response .get (
1231
1251
f"{ API_URL } /box/finger/api/{ API_VERSION } /events" ,
1232
1252
status = 200 ,
1233
- body = 'data: { "devices": { } }' ,
1253
+ body = "event: pulse\n "
1254
+ "data: 1730803627\n \n "
1255
+ "event: patch\n "
1256
+ 'data: { "devices": { } }' ,
1234
1257
)
1235
1258
index = 1
1236
1259
async for device in client .events ():
@@ -1243,7 +1266,10 @@ async def test_events_none(self, mock_response, client):
1243
1266
mock_response .get (
1244
1267
f"{ API_URL } /box/finger/api/{ API_VERSION } /events" ,
1245
1268
status = 200 ,
1246
- body = "data: { }" ,
1269
+ body = "event: pulse\n "
1270
+ "data: 1730803627\n \n "
1271
+ "event: patch\n "
1272
+ "data: { }" ,
1247
1273
)
1248
1274
index = 1
1249
1275
async for device in client .events ():
@@ -1255,7 +1281,10 @@ async def test_events_error(self, mock_response, client):
1255
1281
mock_response .get (
1256
1282
f"{ API_URL } /box/finger/api/{ API_VERSION } /events" ,
1257
1283
status = 500 ,
1258
- body = "data: { }" ,
1284
+ body = "event: pulse\n "
1285
+ "data: 1730803627\n \n "
1286
+ "event: patch\n "
1287
+ "data: { }" ,
1259
1288
)
1260
1289
index = 1
1261
1290
async for device in client .events ():
@@ -1267,7 +1296,10 @@ async def test_events_shutter(self, mock_response, client):
1267
1296
mock_response .get (
1268
1297
f"{ API_URL } /box/finger/api/{ API_VERSION } /events" ,
1269
1298
status = 200 ,
1270
- body = 'data: { "devices": { "device1":'
1299
+ body = "event: pulse\n "
1300
+ "data: 1730803627\n \n "
1301
+ "event: patch\n "
1302
+ 'data: { "devices": { "device1":'
1271
1303
'{ "name": "device1", "type": "rollershutter" },'
1272
1304
'"device2": { "name": "device2" },'
1273
1305
'"device3": { "type": "rollershutter" } } }' ,
0 commit comments