diff options
author | Robin Gloster <robin@loc-com.de> | 2014-08-18 00:52:24 +0200 |
---|---|---|
committer | Robin Gloster <robin@loc-com.de> | 2014-08-23 12:47:29 +0200 |
commit | afc939708ff71e168f9204f1eab8823b7dc9f875 (patch) | |
tree | 255d2c159d1b0b31ae7b1322d802a9fb4770f23b /tests/test_stream_xep_0325.py | |
parent | aabec8b993748866b9cf3f09ebb7ae7ce2ddc426 (diff) | |
download | slixmpp-afc939708ff71e168f9204f1eab8823b7dc9f875.tar.gz slixmpp-afc939708ff71e168f9204f1eab8823b7dc9f875.tar.bz2 slixmpp-afc939708ff71e168f9204f1eab8823b7dc9f875.tar.xz slixmpp-afc939708ff71e168f9204f1eab8823b7dc9f875.zip |
cleanup semicolons, whitespace and mutable default arguments
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> """) |