@@ -121,6 +121,81 @@ def testSetPropertyName(self, gateway):
121
121
except :
122
122
assert False == True
123
123
124
+ def testOnDeviceCommand0Lifetime (self , gateway ):
125
+ try :
126
+ option = {
127
+ "identity" : {"orgId" : "test" , "typeId" : "xxx" , "deviceId" : "xxx" },
128
+ "auth" : {"token" : gateway .authToken },
129
+ }
130
+ testVariable = 3599
131
+ test = ManagedGatewayClient (option )
132
+ test2 = test .manage (lifetime = testVariable )
133
+ assert True
134
+ except :
135
+ assert False == True
136
+
137
+ def testOnDeviceCommandLifetime (self , gateway ):
138
+ try :
139
+ option = {
140
+ "identity" : {"orgId" : "test" , "typeId" : "xxx" , "deviceId" : "xxx" },
141
+ "auth" : {"token" : gateway .authToken },
142
+ }
143
+ testVariable = 3600
144
+ test = ManagedGatewayClient (option )
145
+ test2 = test .manage (lifetime = testVariable )
146
+ assert True
147
+ except :
148
+ assert False == True
149
+
150
+ def testUnmanage (self , gateway ):
151
+ try :
152
+ option = {
153
+ "identity" : {"orgId" : "test" , "typeId" : "xxx" , "deviceId" : "xxx" },
154
+ "auth" : {"token" : gateway .authToken },
155
+ }
156
+ testVariable = 3600
157
+ test = ManagedGatewayClient (option )
158
+ test2 = test .unmanage ()
159
+ assert True
160
+ except :
161
+ assert False == True
162
+
163
+ def testSetErrorCodesNone (self , gateway ):
164
+ try :
165
+ option = {
166
+ "identity" : {"orgId" : "test" , "typeId" : "xxx" , "deviceId" : "xxx" },
167
+ "auth" : {"token" : gateway .authToken },
168
+ }
169
+ testVariable = 3600
170
+ test = ManagedGatewayClient (option ).setErrorCode (errorCode = None )
171
+ assert True
172
+ except :
173
+ assert False == True
174
+
175
+ def testSetErrorCodesValue (self , gateway ):
176
+ try :
177
+ option = {
178
+ "identity" : {"orgId" : "test" , "typeId" : "xxx" , "deviceId" : "xxx" },
179
+ "auth" : {"token" : gateway .authToken },
180
+ }
181
+ testVariable = 3600
182
+ test = ManagedGatewayClient (option ).setErrorCode (errorCode = 0 )
183
+ assert True
184
+ except :
185
+ assert False == True
186
+
187
+ def testSetErrorCodesValue (self , gateway ):
188
+ try :
189
+ option = {
190
+ "identity" : {"orgId" : "test" , "typeId" : "xxx" , "deviceId" : "xxx" },
191
+ "auth" : {"token" : gateway .authToken },
192
+ }
193
+ testVariable = 3600
194
+ test = ManagedGatewayClient (option ).clearErrorCodes ()
195
+ assert True
196
+ except :
197
+ assert False == True
198
+
124
199
def testManagedDeviceMgmtResponseError (self , gateway ):
125
200
with pytest .raises (Exception ) as e :
126
201
config = {
@@ -132,5 +207,3 @@ def testManagedDeviceMgmtResponseError(self, gateway):
132
207
encodedPayload = Utf8Codec .encode (testValue )
133
208
managedDevice ._ManagedGatewayClient__onDeviceMgmtResponse (client = 1 , userdata = 2 , pahoMessage = encodedPayload )
134
209
assert "Unable to parse JSON. payload=" " error" in str (e .value )
135
-
136
-
0 commit comments