diff options
author | Lance Stout <lancestout@gmail.com> | 2014-08-17 17:20:26 -0700 |
---|---|---|
committer | Lance Stout <lancestout@gmail.com> | 2014-08-17 17:20:26 -0700 |
commit | ca306e7cecee4bf7afd9ce44f5f067b305928682 (patch) | |
tree | 3641ff7754a221a53d6b5af08ffefa3f6898627d /tests/test_stream_xep_0325.py | |
parent | a5c03b763a6545a214f4f391f7c07582c22150b2 (diff) | |
parent | 1bf34f7fe694c2997710e0d23b0784e824df5e5e (diff) | |
download | slixmpp-ca306e7cecee4bf7afd9ce44f5f067b305928682.tar.gz slixmpp-ca306e7cecee4bf7afd9ce44f5f067b305928682.tar.bz2 slixmpp-ca306e7cecee4bf7afd9ce44f5f067b305928682.tar.xz slixmpp-ca306e7cecee4bf7afd9ce44f5f067b305928682.zip |
Merge pull request #310 from Mayflower/cleanup
Cleanup
Diffstat (limited to 'tests/test_stream_xep_0325.py')
-rw-r--r-- | tests/test_stream_xep_0325.py | 110 |
1 files changed, 55 insertions, 55 deletions
diff --git a/tests/test_stream_xep_0325.py b/tests/test_stream_xep_0325.py index 4b3250fc..2ebdd121 100644 --- a/tests/test_stream_xep_0325.py +++ b/tests/test_stream_xep_0325.py @@ -28,7 +28,7 @@ class TestStreamControl(SleekTest): pass def _time_now(self): - return datetime.datetime.now().replace(microsecond=0).isoformat(); + return datetime.datetime.now().replace(microsecond=0).isoformat() def tearDown(self): self.stream_close() @@ -38,10 +38,10 @@ class TestStreamControl(SleekTest): plugins=['xep_0030', 'xep_0325']) - myDevice = Device("Device22"); - myDevice._add_control_field(name="Temperature", typename="int", value="15"); + myDevice = Device("Device22") + myDevice._add_control_field(name="Temperature", typename="int", value="15") - self.xmpp['xep_0325'].register_node(nodeId="Device22", device=myDevice, commTimeout=0.5); + self.xmpp['xep_0325'].register_node(nodeId="Device22", device=myDevice, commTimeout=0.5) self.recv(""" <iq type='set' @@ -60,26 +60,26 @@ class TestStreamControl(SleekTest): to='master@clayster.com/amr' id='1'> <setResponse xmlns='urn:xmpp:iot:control' responseCode="OK" /> - </iq> + </iq> """) - self.assertEqual(myDevice._get_field_value("Temperature"), "17"); + self.assertEqual(myDevice._get_field_value("Temperature"), "17") def testRequestSetMulti(self): self.stream_start(mode='component', plugins=['xep_0030', 'xep_0325']) - myDevice = Device("Device22"); - myDevice._add_control_field(name="Temperature", typename="int", value="15"); - myDevice._add_control_field(name="Startup", typename="date", value="2013-01-03"); + myDevice = Device("Device22") + myDevice._add_control_field(name="Temperature", typename="int", value="15") + myDevice._add_control_field(name="Startup", typename="date", value="2013-01-03") - myDevice2 = Device("Device23"); - myDevice2._add_control_field(name="Temperature", typename="int", value="19"); - myDevice2._add_control_field(name="Startup", typename="date", value="2013-01-09"); + myDevice2 = Device("Device23") + myDevice2._add_control_field(name="Temperature", typename="int", value="19") + myDevice2._add_control_field(name="Startup", typename="date", value="2013-01-09") - self.xmpp['xep_0325'].register_node(nodeId="Device22", device=myDevice, commTimeout=0.5); - self.xmpp['xep_0325'].register_node(nodeId="Device23", device=myDevice2, commTimeout=0.5); + self.xmpp['xep_0325'].register_node(nodeId="Device22", device=myDevice, commTimeout=0.5) + self.xmpp['xep_0325'].register_node(nodeId="Device23", device=myDevice2, commTimeout=0.5) self.recv(""" <iq type='set' @@ -99,11 +99,11 @@ class TestStreamControl(SleekTest): to='master@clayster.com/amr' id='1'> <setResponse xmlns='urn:xmpp:iot:control' responseCode="OK" /> - </iq> + </iq> """) - self.assertEqual(myDevice._get_field_value("Temperature"), "17"); - self.assertEqual(myDevice2._get_field_value("Temperature"), "19"); + self.assertEqual(myDevice._get_field_value("Temperature"), "17") + self.assertEqual(myDevice2._get_field_value("Temperature"), "19") self.recv(""" <iq type='set' @@ -125,23 +125,23 @@ class TestStreamControl(SleekTest): to='master@clayster.com/amr' id='2'> <setResponse xmlns='urn:xmpp:iot:control' responseCode="OK" /> - </iq> + </iq> """) - self.assertEqual(myDevice._get_field_value("Temperature"), "20"); - self.assertEqual(myDevice2._get_field_value("Temperature"), "20"); - self.assertEqual(myDevice._get_field_value("Startup"), "2013-02-01"); - self.assertEqual(myDevice2._get_field_value("Startup"), "2013-02-01"); + self.assertEqual(myDevice._get_field_value("Temperature"), "20") + self.assertEqual(myDevice2._get_field_value("Temperature"), "20") + self.assertEqual(myDevice._get_field_value("Startup"), "2013-02-01") + self.assertEqual(myDevice2._get_field_value("Startup"), "2013-02-01") def testRequestSetFail(self): self.stream_start(mode='component', plugins=['xep_0030', 'xep_0325']) - myDevice = Device("Device23"); - myDevice._add_control_field(name="Temperature", typename="int", value="15"); + myDevice = Device("Device23") + myDevice._add_control_field(name="Temperature", typename="int", value="15") - self.xmpp['xep_0325'].register_node(nodeId="Device23", device=myDevice, commTimeout=0.5); + self.xmpp['xep_0325'].register_node(nodeId="Device23", device=myDevice, commTimeout=0.5) self.recv(""" <iq type='set' @@ -163,24 +163,24 @@ class TestStreamControl(SleekTest): <parameter name='Voltage' /> <error var='Output'>Invalid field Voltage</error> </setResponse> - </iq> + </iq> """) - self.assertEqual(myDevice._get_field_value("Temperature"), "15"); - self.assertFalse(myDevice.has_control_field("Voltage", "int")); + self.assertEqual(myDevice._get_field_value("Temperature"), "15") + self.assertFalse(myDevice.has_control_field("Voltage", "int")) def testDirectSetOk(self): self.stream_start(mode='component', plugins=['xep_0030', 'xep_0325']) - myDevice = Device("Device22"); - myDevice._add_control_field(name="Temperature", typename="int", value="15"); + myDevice = Device("Device22") + myDevice._add_control_field(name="Temperature", typename="int", value="15") - self.xmpp['xep_0325'].register_node(nodeId="Device22", device=myDevice, commTimeout=0.5); + self.xmpp['xep_0325'].register_node(nodeId="Device22", device=myDevice, commTimeout=0.5) self.recv(""" - <message + <message from='master@clayster.com/amr' to='device@clayster.com'> <set xmlns='urn:xmpp:iot:control'> @@ -191,20 +191,20 @@ class TestStreamControl(SleekTest): time.sleep(.5) - self.assertEqual(myDevice._get_field_value("Temperature"), "17"); + self.assertEqual(myDevice._get_field_value("Temperature"), "17") def testDirectSetFail(self): self.stream_start(mode='component', plugins=['xep_0030', 'xep_0325']) - myDevice = Device("Device22"); - myDevice._add_control_field(name="Temperature", typename="int", value="15"); + myDevice = Device("Device22") + myDevice._add_control_field(name="Temperature", typename="int", value="15") - self.xmpp['xep_0325'].register_node(nodeId="Device22", device=myDevice, commTimeout=0.5); + self.xmpp['xep_0325'].register_node(nodeId="Device22", device=myDevice, commTimeout=0.5) self.recv(""" - <message + <message from='master@clayster.com/amr' to='device@clayster.com'> <set xmlns='urn:xmpp:iot:control'> @@ -215,8 +215,8 @@ class TestStreamControl(SleekTest): time.sleep(.5) - self.assertEqual(myDevice._get_field_value("Temperature"), "15"); - self.assertFalse(myDevice.has_control_field("Voltage", "int")); + self.assertEqual(myDevice._get_field_value("Temperature"), "15") + self.assertFalse(myDevice.has_control_field("Voltage", "int")) def testRequestSetOkAPI(self): @@ -225,16 +225,16 @@ class TestStreamControl(SleekTest): plugins=['xep_0030', 'xep_0325']) - results = []; + results = [] def my_callback(from_jid, result, nodeIds=None, fields=None, error_msg=None): - results.append(result); + results.append(result) fields = [] fields.append(("Temperature", "double", "20.5")) fields.append(("TemperatureAlarmSetting", "string", "High")) - self.xmpp['xep_0325'].set_request(from_jid="tester@localhost", to_jid="you@google.com", fields=fields, nodeIds=['Device33', 'Device22'], callback=my_callback); + self.xmpp['xep_0325'].set_request(from_jid="tester@localhost", to_jid="you@google.com", fields=fields, nodeIds=['Device33', 'Device22'], callback=my_callback) self.send(""" <iq type='set' @@ -256,12 +256,12 @@ class TestStreamControl(SleekTest): to='tester@localhost' id='1'> <setResponse xmlns='urn:xmpp:iot:control' responseCode="OK" /> - </iq> + </iq> """) time.sleep(.5) - self.assertEqual(results, ["OK"]); + self.assertEqual(results, ["OK"]) def testRequestSetErrorAPI(self): @@ -269,16 +269,16 @@ class TestStreamControl(SleekTest): plugins=['xep_0030', 'xep_0325']) - results = []; + results = [] def my_callback(from_jid, result, nodeIds=None, fields=None, error_msg=None): - results.append(result); + results.append(result) fields = [] fields.append(("Temperature", "double", "20.5")) fields.append(("TemperatureAlarmSetting", "string", "High")) - self.xmpp['xep_0325'].set_request(from_jid="tester@localhost", to_jid="you@google.com", fields=fields, nodeIds=['Device33', 'Device22'], callback=my_callback); + self.xmpp['xep_0325'].set_request(from_jid="tester@localhost", to_jid="you@google.com", fields=fields, nodeIds=['Device33', 'Device22'], callback=my_callback) self.send(""" <iq type='set' @@ -302,17 +302,17 @@ class TestStreamControl(SleekTest): <setResponse xmlns='urn:xmpp:iot:control' responseCode="OtherError" > <error var='Temperature'>Sensor error</error> </setResponse> - </iq> + </iq> """) time.sleep(.5) - self.assertEqual(results, ["OtherError"]); + self.assertEqual(results, ["OtherError"]) def testServiceDiscoveryClient(self): self.stream_start(mode='client', plugins=['xep_0030', - 'xep_0325']); + 'xep_0325']) self.recv(""" <iq type='get' @@ -330,14 +330,14 @@ class TestStreamControl(SleekTest): <query xmlns='http://jabber.org/protocol/disco#info'> <identity category='client' type='bot'/> <feature var='urn:xmpp:iot:control'/> - </query> - </iq> + </query> + </iq> """) def testServiceDiscoveryComponent(self): self.stream_start(mode='component', plugins=['xep_0030', - 'xep_0325']); + 'xep_0325']) self.recv(""" <iq type='get' @@ -356,8 +356,8 @@ class TestStreamControl(SleekTest): <query xmlns='http://jabber.org/protocol/disco#info'> <identity category='component' type='generic'/> <feature var='urn:xmpp:iot:control'/> - </query> - </iq> + </query> + </iq> """) |