Skip to content

Commit 8fac96d

Browse files
Milad LalyMilad Laly
authored andcommitted
Additional Unittesting
1 parent b70eb95 commit 8fac96d

File tree

1 file changed

+75
-2
lines changed

1 file changed

+75
-2
lines changed

test/test_gateway_mgd.py

Lines changed: 75 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,81 @@ def testSetPropertyName(self, gateway):
121121
except:
122122
assert False == True
123123

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+
124199
def testManagedDeviceMgmtResponseError(self, gateway):
125200
with pytest.raises(Exception) as e:
126201
config = {
@@ -132,5 +207,3 @@ def testManagedDeviceMgmtResponseError(self, gateway):
132207
encodedPayload = Utf8Codec.encode(testValue)
133208
managedDevice._ManagedGatewayClient__onDeviceMgmtResponse(client=1, userdata=2, pahoMessage=encodedPayload)
134209
assert "Unable to parse JSON. payload=" " error" in str(e.value)
135-
136-

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy