22
33import time
44from threading import Event , Thread
5- from unittest .mock import MagicMock , patch
6-
7- import pytest
5+ from unittest .mock import MagicMock
86
97from intersect_sdk .client import IntersectClient
108from intersect_sdk .client_callback_definitions import IntersectClientCallback
@@ -18,7 +16,15 @@ def test_timeout_callback_is_called():
1816 system = 'test' ,
1917 facility = 'test' ,
2018 organization = 'test' ,
21- brokers = [{'host' : 'localhost' , 'port' : 1883 , 'protocol' : 'mqtt3.1.1' , 'username' : 'test' , 'password' : 'test' }],
19+ brokers = [
20+ {
21+ 'host' : 'localhost' ,
22+ 'port' : 1883 ,
23+ 'protocol' : 'mqtt3.1.1' ,
24+ 'username' : 'test' ,
25+ 'password' : 'test' ,
26+ }
27+ ],
2228 initial_message_event_config = IntersectClientCallback (),
2329 terminate_after_initial_messages = True ,
2430 )
@@ -72,7 +78,15 @@ def test_timeout_callback_is_not_called():
7278 system = 'test' ,
7379 facility = 'test' ,
7480 organization = 'test' ,
75- brokers = [{'host' : 'localhost' , 'port' : 1883 , 'protocol' : 'mqtt3.1.1' , 'username' : 'test' , 'password' : 'test' }],
81+ brokers = [
82+ {
83+ 'host' : 'localhost' ,
84+ 'port' : 1883 ,
85+ 'protocol' : 'mqtt3.1.1' ,
86+ 'username' : 'test' ,
87+ 'password' : 'test' ,
88+ }
89+ ],
7690 initial_message_event_config = IntersectClientCallback (),
7791 terminate_after_initial_messages = True ,
7892 )
@@ -86,7 +100,6 @@ def on_timeout(operation_id):
86100
87101 def user_callback (source , operation_id , has_error , payload ):
88102 user_callback_called .append (True )
89- return None
90103
91104 client = IntersectClient (config , user_callback = user_callback )
92105
@@ -151,7 +164,15 @@ def test_response_after_timeout_is_ignored():
151164 system = 'test' ,
152165 facility = 'test' ,
153166 organization = 'test' ,
154- brokers = [{'host' : 'localhost' , 'port' : 1883 , 'protocol' : 'mqtt3.1.1' , 'username' : 'test' , 'password' : 'test' }],
167+ brokers = [
168+ {
169+ 'host' : 'localhost' ,
170+ 'port' : 1883 ,
171+ 'protocol' : 'mqtt3.1.1' ,
172+ 'username' : 'test' ,
173+ 'password' : 'test' ,
174+ }
175+ ],
155176 initial_message_event_config = IntersectClientCallback (),
156177 terminate_after_initial_messages = True ,
157178 )
@@ -165,7 +186,6 @@ def on_timeout(operation_id):
165186
166187 def user_callback (source , operation_id , has_error , payload ):
167188 user_callback_called .append (True )
168- return None
169189
170190 client = IntersectClient (config , user_callback = user_callback )
171191
0 commit comments