diff options
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> | 2014-08-17 21:53:34 +0200 |
---|---|---|
committer | Florent Le Coz <louiz@louiz.org> | 2014-09-01 02:47:15 +0200 |
commit | 17174016ec6603afe87a65282f9b7eb55f2eafeb (patch) | |
tree | 1e815d4ab942bf3b8ac932d3a1213b7a00659e26 /tests | |
parent | ed37174a2b40d2d90aa6a0c7f778108687d39602 (diff) | |
download | slixmpp-17174016ec6603afe87a65282f9b7eb55f2eafeb.tar.gz slixmpp-17174016ec6603afe87a65282f9b7eb55f2eafeb.tar.bz2 slixmpp-17174016ec6603afe87a65282f9b7eb55f2eafeb.tar.xz slixmpp-17174016ec6603afe87a65282f9b7eb55f2eafeb.zip |
Remove all trailing whitespaces.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_plugins.py | 2 | ||||
-rw-r--r-- | tests/test_stanza_xep_0323.py | 42 | ||||
-rw-r--r-- | tests/test_stanza_xep_0325.py | 6 | ||||
-rw-r--r-- | tests/test_stream_xep_0323.py | 182 | ||||
-rw-r--r-- | tests/test_stream_xep_0325.py | 28 |
5 files changed, 130 insertions, 130 deletions
diff --git a/tests/test_plugins.py b/tests/test_plugins.py index 510ae7d7..ee6d44c0 100644 --- a/tests/test_plugins.py +++ b/tests/test_plugins.py @@ -77,7 +77,7 @@ class TestPlugins(unittest.TestCase): p.disable('a') self.assertEqual(len(p), 0, "Wrong number of enabled plugins.") - self.assertEqual(events, ['init', 'end'], + self.assertEqual(events, ['init', 'end'], "Plugin lifecycle methods not called.") def test_enable_dependencies(self): diff --git a/tests/test_stanza_xep_0323.py b/tests/test_stanza_xep_0323.py index 405245b5..95fb138b 100644 --- a/tests/test_stanza_xep_0323.py +++ b/tests/test_stanza_xep_0323.py @@ -6,7 +6,7 @@ import slixmpp.plugins.xep_0323 as xep_0323 namespace='sn' class TestSensorDataStanzas(SlixTest): - + def setUp(self): pass @@ -171,7 +171,7 @@ class TestSensorDataStanzas(SlixTest): iq['accepted']['seqnr'] = '2' self.check(iq,""" - <iq type='result' + <iq type='result' from='device@clayster.com' to='master@clayster.com/amr' id='2'> @@ -193,7 +193,7 @@ class TestSensorDataStanzas(SlixTest): iq['rejected']['error'] = 'Access denied.' self.check(iq,""" - <iq type='error' + <iq type='error' from='device@clayster.com' to='master@clayster.com/amr' id='4'> @@ -250,7 +250,7 @@ class TestSensorDataStanzas(SlixTest): <fields xmlns='urn:xmpp:iot:sensordata' seqnr='1'> <node nodeId='Device02'> <timestamp value='2013-03-07T16:24:30'> - <numeric name='Temperature' momentary='true' automaticReadout='true' value='-12.42' unit='K'/> + <numeric name='Temperature' momentary='true' automaticReadout='true' value='-12.42' unit='K'/> </timestamp> </node> </fields> @@ -269,7 +269,7 @@ class TestSensorDataStanzas(SlixTest): <fields xmlns='urn:xmpp:iot:sensordata' seqnr='1'> <node nodeId='Device02'> <timestamp value='2013-03-07T16:24:30'> - <numeric name='Temperature' momentary='true' automaticReadout='true' value='-12.42' unit='K'/> + <numeric name='Temperature' momentary='true' automaticReadout='true' value='-12.42' unit='K'/> </timestamp> </node> <node nodeId='EmptyDevice'/> @@ -314,7 +314,7 @@ class TestSensorDataStanzas(SlixTest): <fields xmlns='urn:xmpp:iot:sensordata' seqnr='1'> <node nodeId='Device02'> <timestamp value='2013-03-07T16:24:30'> - <numeric name='Temperature' momentary='true' automaticReadout='true' value='-12.42' unit='K'/> + <numeric name='Temperature' momentary='true' automaticReadout='true' value='-12.42' unit='K'/> </timestamp> </node> <node nodeId='EmptyDevice'/> @@ -323,18 +323,18 @@ class TestSensorDataStanzas(SlixTest): </node> <node nodeId='Device77'> <timestamp value='2013-05-03T12:00:01'> - <numeric name='Temperature' historicalDay='true' value='-12.42' unit='K'/> - <numeric name='Speed' historicalWeek='false' value='312.42' unit='km/h'/> - <string name='Temperature name' historicalMonth='true' value='Bottom oil'/> - <string name='Speed name' historicalQuarter='false' value='Top speed'/> - <dateTime name='T1' historicalYear='true' value='1979-01-01T00:00:00'/> - <dateTime name='T2' historicalOther='false' value='2000-01-01T01:02:03'/> - <timeSpan name='TS1' missing='true' value='P5Y'/> - <timeSpan name='TS2' manualEstimate='false' value='PT2M1S'/> - <enum name='top color' invoiced='true' value='red' dataType='string'/> - <enum name='bottom color' powerFailure='false' value='black' dataType='string'/> - <boolean name='Temperature real' historicalDay='true' value='false'/> - <boolean name='Speed real' historicalWeek='false' value='true'/> + <numeric name='Temperature' historicalDay='true' value='-12.42' unit='K'/> + <numeric name='Speed' historicalWeek='false' value='312.42' unit='km/h'/> + <string name='Temperature name' historicalMonth='true' value='Bottom oil'/> + <string name='Speed name' historicalQuarter='false' value='Top speed'/> + <dateTime name='T1' historicalYear='true' value='1979-01-01T00:00:00'/> + <dateTime name='T2' historicalOther='false' value='2000-01-01T01:02:03'/> + <timeSpan name='TS1' missing='true' value='P5Y'/> + <timeSpan name='TS2' manualEstimate='false' value='PT2M1S'/> + <enum name='top color' invoiced='true' value='red' dataType='string'/> + <enum name='bottom color' powerFailure='false' value='black' dataType='string'/> + <boolean name='Temperature real' historicalDay='true' value='false'/> + <boolean name='Speed real' historicalWeek='false' value='true'/> </timestamp> </node> </fields> @@ -342,7 +342,7 @@ class TestSensorDataStanzas(SlixTest): """ ) - + def testTimestamp(self): msg = self.Message(); @@ -386,8 +386,8 @@ class TestSensorDataStanzas(SlixTest): self.check(msg,emptyStringIdXML) msg['fields']['stringIds'] = "1" self.check(msg,emptyStringIdXML) - - + + suite = unittest.TestLoader().loadTestsFromTestCase(TestSensorDataStanzas) diff --git a/tests/test_stanza_xep_0325.py b/tests/test_stanza_xep_0325.py index 222e10ea..75a45907 100644 --- a/tests/test_stanza_xep_0325.py +++ b/tests/test_stanza_xep_0325.py @@ -15,7 +15,7 @@ import slixmpp.plugins.xep_0325 as xep_0325 namespace='sn' class TestControlStanzas(SlixTest): - + def setUp(self): pass @@ -89,7 +89,7 @@ class TestControlStanzas(SlixTest): msg['set'].add_data("Tjohej", "boolean", "true") self.check(msg,""" - <message + <message from='master@clayster.com/amr' to='device@clayster.com'> <set xmlns='urn:xmpp:iot:control'> @@ -244,5 +244,5 @@ class TestControlStanzas(SlixTest): </iq> """ ) - + suite = unittest.TestLoader().loadTestsFromTestCase(TestControlStanzas) diff --git a/tests/test_stream_xep_0323.py b/tests/test_stream_xep_0323.py index 3f54d861..d8e3b01f 100644 --- a/tests/test_stream_xep_0323.py +++ b/tests/test_stream_xep_0323.py @@ -46,7 +46,7 @@ class TestStreamSensorData(SlixTest): """) self.send(""" - <iq type='result' + <iq type='result' from='device@clayster.com' to='master@clayster.com/amr' id='1'> @@ -60,11 +60,11 @@ class TestStreamSensorData(SlixTest): <fields xmlns='urn:xmpp:iot:sensordata' seqnr='1' done='true'> <node nodeId='Device22'> <timestamp value='2013-03-07T16:24:30'> - <numeric name='Temperature' momentary='true' automaticReadout='true' value='23.4' unit='°C'/> + <numeric name='Temperature' momentary='true' automaticReadout='true' value='23.4' unit='°C'/> </timestamp> </node> </fields> - </message> + </message> """) def testRequestRejectAuth(self): @@ -85,7 +85,7 @@ class TestStreamSensorData(SlixTest): """) self.send(""" - <iq type='error' + <iq type='error' from='device@clayster.com' to='master@clayster.com/amr' id='4'> @@ -118,7 +118,7 @@ class TestStreamSensorData(SlixTest): """) self.send(""" - <iq type='error' + <iq type='error' from='device@clayster.com' to='master@clayster.com/amr' id='77'> @@ -142,7 +142,7 @@ class TestStreamSensorData(SlixTest): """) self.send(""" - <iq type='result' + <iq type='result' from='device@clayster.com' to='master@clayster.com/amr' id='8'> @@ -177,7 +177,7 @@ class TestStreamSensorData(SlixTest): """) self.send(""" - <iq type='error' + <iq type='error' from='device@clayster.com' to='master@clayster.com/amr' id='7'> @@ -201,7 +201,7 @@ class TestStreamSensorData(SlixTest): """) self.send(""" - <iq type='result' + <iq type='result' from='device@clayster.com' to='master@clayster.com/amr' id='8'> @@ -215,11 +215,11 @@ class TestStreamSensorData(SlixTest): <fields xmlns='urn:xmpp:iot:sensordata' seqnr='7'> <node nodeId='Device44'> <timestamp value='2000-01-01T00:01:02'> - <numeric name='Voltage' invoiced='true' value='230.4' unit='V'/> + <numeric name='Voltage' invoiced='true' value='230.4' unit='V'/> </timestamp> </node> </fields> - </message> + </message> """) self.send(""" @@ -227,7 +227,7 @@ class TestStreamSensorData(SlixTest): to='master@clayster.com/amr'> <fields xmlns='urn:xmpp:iot:sensordata' seqnr='7' done='true'> </fields> - </message> + </message> """) def testRequestMultiTimestampSingleField(self): @@ -260,7 +260,7 @@ class TestStreamSensorData(SlixTest): """) self.send(""" - <iq type='result' + <iq type='result' from='device@clayster.com' to='master@clayster.com/amr' id='8'> @@ -274,11 +274,11 @@ class TestStreamSensorData(SlixTest): <fields xmlns='urn:xmpp:iot:sensordata' seqnr='7'> <node nodeId='Device44'> <timestamp value='2000-01-01T00:01:02'> - <numeric name='Voltage' invoiced='true' value='230.4' unit='V'/> + <numeric name='Voltage' invoiced='true' value='230.4' unit='V'/> </timestamp> </node> </fields> - </message> + </message> """) self.send(""" @@ -287,11 +287,11 @@ class TestStreamSensorData(SlixTest): <fields xmlns='urn:xmpp:iot:sensordata' seqnr='7'> <node nodeId='Device44'> <timestamp value='2000-01-01T01:01:02'> - <numeric name='Voltage' value='230.6' unit='V'/> + <numeric name='Voltage' value='230.6' unit='V'/> </timestamp> </node> </fields> - </message> + </message> """) self.send(""" @@ -299,7 +299,7 @@ class TestStreamSensorData(SlixTest): to='master@clayster.com/amr'> <fields xmlns='urn:xmpp:iot:sensordata' seqnr='7' done='true'> </fields> - </message> + </message> """) def testRequestMultiTimestampAllFields(self): @@ -330,7 +330,7 @@ class TestStreamSensorData(SlixTest): """) self.send(""" - <iq type='result' + <iq type='result' from='device@clayster.com' to='master@clayster.com/amr' id='8'> @@ -344,11 +344,11 @@ class TestStreamSensorData(SlixTest): <fields xmlns='urn:xmpp:iot:sensordata' seqnr='7'> <node nodeId='Device44'> <timestamp value='2000-01-01T00:01:02'> - <numeric name='Voltage' invoiced='true' value='230.4' unit='V'/> + <numeric name='Voltage' invoiced='true' value='230.4' unit='V'/> </timestamp> </node> </fields> - </message> + </message> """) self.send(""" @@ -357,12 +357,12 @@ class TestStreamSensorData(SlixTest): <fields xmlns='urn:xmpp:iot:sensordata' seqnr='7'> <node nodeId='Device44'> <timestamp value='2000-01-01T01:01:02'> - <numeric name='Voltage' value='230.6' unit='V'/> - <string name='Height' invoiced='true' value='115 m'/> + <numeric name='Voltage' value='230.6' unit='V'/> + <string name='Height' invoiced='true' value='115 m'/> </timestamp> </node> </fields> - </message> + </message> """) self.send(""" @@ -370,7 +370,7 @@ class TestStreamSensorData(SlixTest): to='master@clayster.com/amr'> <fields xmlns='urn:xmpp:iot:sensordata' seqnr='7' done='true'> </fields> - </message> + </message> """) def testRequestAPI(self): @@ -424,7 +424,7 @@ class TestStreamSensorData(SlixTest): plugins=['xep_0030', 'xep_0323']) - results = []; + results = []; def my_callback(from_jid, result, nodeId=None, timestamp=None, fields=None, error_msg=None): if (result == "rejected") and (error_msg == "Invalid device Device22"): @@ -445,19 +445,19 @@ class TestStreamSensorData(SlixTest): """) self.recv(""" - <iq type='error' + <iq type='error' from='you@google.com' to='tester@localhost' id='1'> <rejected xmlns='urn:xmpp:iot:sensordata' seqnr='1'> <error>Invalid device Device22</error> </rejected> - </iq> + </iq> """) time.sleep(.1) - self.failUnless(results == ["rejected"], + self.failUnless(results == ["rejected"], "Rejected callback was not properly executed"); def testRequestAcceptedAPI(self): @@ -466,7 +466,7 @@ class TestStreamSensorData(SlixTest): plugins=['xep_0030', 'xep_0323']) - results = []; + results = []; def my_callback(from_jid, result, nodeId=None, timestamp=None, fields=None, error_msg=None): results.append(result); @@ -486,17 +486,17 @@ class TestStreamSensorData(SlixTest): """) self.recv(""" - <iq type='result' + <iq type='result' from='you@google.com' to='tester@localhost' id='1'> <accepted xmlns='urn:xmpp:iot:sensordata' seqnr='1'/> - </iq> + </iq> """) time.sleep(.1) - self.failUnless(results == ["accepted"], + self.failUnless(results == ["accepted"], "Accepted callback was not properly executed"); def testRequestFieldsAPI(self): @@ -505,8 +505,8 @@ class TestStreamSensorData(SlixTest): plugins=['xep_0030', 'xep_0323']) - results = []; - callback_data = {}; + results = []; + callback_data = {}; def my_callback(from_jid, result, nodeId=None, timestamp=None, fields=None, error_msg=None): results.append(result); @@ -519,9 +519,9 @@ class TestStreamSensorData(SlixTest): t1= threading.Thread(name="request_data", target=self.xmpp['xep_0323'].request_data, - kwargs={"from_jid": "tester@localhost", - "to_jid": "you@google.com", - "nodeIds": ['Device33'], + kwargs={"from_jid": "tester@localhost", + "to_jid": "you@google.com", + "nodeIds": ['Device33'], "callback": my_callback}); t1.start(); #self.xmpp['xep_0323'].request_data(from_jid="tester@localhost", to_jid="you@google.com", nodeIds=['Device33'], callback=my_callback); @@ -538,12 +538,12 @@ class TestStreamSensorData(SlixTest): """) self.recv(""" - <iq type='result' + <iq type='result' from='you@google.com' to='tester@localhost' id='1'> <accepted xmlns='urn:xmpp:iot:sensordata' seqnr='1'/> - </iq> + </iq> """) self.recv(""" @@ -552,19 +552,19 @@ class TestStreamSensorData(SlixTest): <fields xmlns='urn:xmpp:iot:sensordata' seqnr='1'> <node nodeId='Device33'> <timestamp value='2000-01-01T00:01:02'> - <numeric name='Voltage' invoiced='true' value='230.4' unit='V'/> - <boolean name='TestBool' value='true'/> + <numeric name='Voltage' invoiced='true' value='230.4' unit='V'/> + <boolean name='TestBool' value='true'/> </timestamp> </node> </fields> - </message> + </message> """) self.recv(""" <message from='you@google.com' to='tester@localhost'> <fields xmlns='urn:xmpp:iot:sensordata' seqnr='1' done='true'/> - </message> + </message> """) t1.join(); @@ -605,8 +605,8 @@ class TestStreamSensorData(SlixTest): <query xmlns='http://jabber.org/protocol/disco#info'> <identity category='client' type='bot'/> <feature var='urn:xmpp:iot:sensordata'/> - </query> - </iq> + </query> + </iq> """) def testServiceDiscoveryComponent(self): @@ -631,8 +631,8 @@ class TestStreamSensorData(SlixTest): <query xmlns='http://jabber.org/protocol/disco#info'> <identity category='component' type='generic'/> <feature var='urn:xmpp:iot:sensordata'/> - </query> - </iq> + </query> + </iq> """) def testRequestTimeout(self): @@ -642,7 +642,7 @@ class TestStreamSensorData(SlixTest): 'xep_0323']) results = []; - callback_data = {}; + callback_data = {}; def my_callback(from_jid, result, nodeId=None, timestamp=None, error_msg=None): results.append(result); @@ -653,9 +653,9 @@ class TestStreamSensorData(SlixTest): t1= threading.Thread(name="request_data", target=self.xmpp['xep_0323'].request_data, - kwargs={"from_jid": "tester@localhost", - "to_jid": "you@google.com", - "nodeIds": ['Device33'], + kwargs={"from_jid": "tester@localhost", + "to_jid": "you@google.com", + "nodeIds": ['Device33'], "callback": my_callback}); t1.start(); @@ -671,12 +671,12 @@ class TestStreamSensorData(SlixTest): """) self.recv(""" - <iq type='result' + <iq type='result' from='you@google.com' to='tester@localhost' id='1'> <accepted xmlns='urn:xmpp:iot:sensordata' seqnr='1'/> - </iq> + </iq> """) self.recv(""" @@ -729,7 +729,7 @@ class TestStreamSensorData(SlixTest): """) self.send(""" - <iq type='result' + <iq type='result' from='device@clayster.com' to='master@clayster.com/amr' id='1'> @@ -743,7 +743,7 @@ class TestStreamSensorData(SlixTest): <message from='device@clayster.com' to='master@clayster.com/amr'> <started xmlns='urn:xmpp:iot:sensordata' seqnr='1' /> - </message> + </message> """) self.send(""" @@ -752,11 +752,11 @@ class TestStreamSensorData(SlixTest): <fields xmlns='urn:xmpp:iot:sensordata' seqnr='1' done='true'> <node nodeId='Device22'> <timestamp value='2013-03-07T16:24:30'> - <numeric name='Temperature' momentary='true' automaticReadout='true' value='23.4' unit='°C'/> + <numeric name='Temperature' momentary='true' automaticReadout='true' value='23.4' unit='°C'/> </timestamp> </node> </fields> - </message> + </message> """) def testDelayedRequestFail(self): @@ -792,7 +792,7 @@ class TestStreamSensorData(SlixTest): xml_stanza['rejected']['error'] = error_text self._filtered_stanza_check(""" - <iq type='error' + <iq type='error' from='device@clayster.com' to='master@clayster.com/amr' id='1'> @@ -847,7 +847,7 @@ class TestStreamSensorData(SlixTest): """) self.send(""" - <iq type='result' + <iq type='result' from='device@clayster.com' to='master@clayster.com/amr' id='6'> @@ -861,11 +861,11 @@ class TestStreamSensorData(SlixTest): <fields xmlns='urn:xmpp:iot:sensordata' seqnr='6'> <node nodeId='Device44'> <timestamp value='2000-02-01T00:01:02'> - <numeric name='Voltage' invoiced='true' value='230.2' unit='V'/> + <numeric name='Voltage' invoiced='true' value='230.2' unit='V'/> </timestamp> </node> </fields> - </message> + </message> """) self.send(""" @@ -874,11 +874,11 @@ class TestStreamSensorData(SlixTest): <fields xmlns='urn:xmpp:iot:sensordata' seqnr='6'> <node nodeId='Device44'> <timestamp value='2000-03-01T00:01:02'> - <numeric name='Voltage' invoiced='true' value='230.3' unit='V'/> + <numeric name='Voltage' invoiced='true' value='230.3' unit='V'/> </timestamp> </node> </fields> - </message> + </message> """) self.send(""" @@ -886,7 +886,7 @@ class TestStreamSensorData(SlixTest): to='master@clayster.com/amr'> <fields xmlns='urn:xmpp:iot:sensordata' seqnr='6' done='true'> </fields> - </message> + </message> """) def testRequestFieldTo(self): @@ -917,7 +917,7 @@ class TestStreamSensorData(SlixTest): """) self.send(""" - <iq type='result' + <iq type='result' from='device@clayster.com' to='master@clayster.com/amr' id='6'> @@ -931,11 +931,11 @@ class TestStreamSensorData(SlixTest): <fields xmlns='urn:xmpp:iot:sensordata' seqnr='6'> <node nodeId='Device44'> <timestamp value='2000-01-01T00:01:02'> - <numeric name='Voltage' invoiced='true' value='230.1' unit='V'/> + <numeric name='Voltage' invoiced='true' value='230.1' unit='V'/> </timestamp> </node> </fields> - </message> + </message> """) self.send(""" @@ -944,11 +944,11 @@ class TestStreamSensorData(SlixTest): <fields xmlns='urn:xmpp:iot:sensordata' seqnr='6'> <node nodeId='Device44'> <timestamp value='2000-02-01T00:01:02'> - <numeric name='Voltage' invoiced='true' value='230.2' unit='V'/> + <numeric name='Voltage' invoiced='true' value='230.2' unit='V'/> </timestamp> </node> </fields> - </message> + </message> """) self.send(""" @@ -956,7 +956,7 @@ class TestStreamSensorData(SlixTest): to='master@clayster.com/amr'> <fields xmlns='urn:xmpp:iot:sensordata' seqnr='6' done='true'> </fields> - </message> + </message> """) def testRequestFieldFromTo(self): @@ -987,7 +987,7 @@ class TestStreamSensorData(SlixTest): """) self.send(""" - <iq type='result' + <iq type='result' from='device@clayster.com' to='master@clayster.com/amr' id='6'> @@ -1001,11 +1001,11 @@ class TestStreamSensorData(SlixTest): <fields xmlns='urn:xmpp:iot:sensordata' seqnr='6'> <node nodeId='Device44'> <timestamp value='2000-02-01T00:01:02'> - <numeric name='Voltage' invoiced='true' value='230.2' unit='V'/> + <numeric name='Voltage' invoiced='true' value='230.2' unit='V'/> </timestamp> </node> </fields> - </message> + </message> """) self.send(""" @@ -1013,7 +1013,7 @@ class TestStreamSensorData(SlixTest): to='master@clayster.com/amr'> <fields xmlns='urn:xmpp:iot:sensordata' seqnr='6' done='true'> </fields> - </message> + </message> """) def testDelayedRequestClient(self): @@ -1021,8 +1021,8 @@ class TestStreamSensorData(SlixTest): plugins=['xep_0030', 'xep_0323']) - results = []; - callback_data = {}; + results = []; + callback_data = {}; def my_callback(from_jid, result, nodeId=None, timestamp=None, fields=None, error_msg=None): results.append(result); @@ -1035,9 +1035,9 @@ class TestStreamSensorData(SlixTest): t1= threading.Thread(name="request_data", target=self.xmpp['xep_0323'].request_data, - kwargs={"from_jid": "tester@localhost", - "to_jid": "you@google.com", - "nodeIds": ['Device33'], + kwargs={"from_jid": "tester@localhost", + "to_jid": "you@google.com", + "nodeIds": ['Device33'], "callback": my_callback}); t1.start(); #self.xmpp['xep_0323'].request_data(from_jid="tester@localhost", to_jid="you@google.com", nodeIds=['Device33'], callback=my_callback); @@ -1054,20 +1054,20 @@ class TestStreamSensorData(SlixTest): """) self.recv(""" - <iq type='result' + <iq type='result' from='you@google.com' to='tester@localhost' id='1'> <accepted xmlns='urn:xmpp:iot:sensordata' seqnr='1' queued='true'/> - </iq> + </iq> """) self.recv(""" <message from='device@clayster.com' to='master@clayster.com/amr'> <started xmlns='urn:xmpp:iot:sensordata' seqnr='1' /> - </message> - """) + </message> + """) self.recv(""" <message from='you@google.com' @@ -1075,19 +1075,19 @@ class TestStreamSensorData(SlixTest): <fields xmlns='urn:xmpp:iot:sensordata' seqnr='1'> <node nodeId='Device33'> <timestamp value='2000-01-01T00:01:02'> - <numeric name='Voltage' invoiced='true' value='230.4' unit='V'/> - <boolean name='TestBool' value='true'/> + <numeric name='Voltage' invoiced='true' value='230.4' unit='V'/> + <boolean name='TestBool' value='true'/> </timestamp> </node> </fields> - </message> + </message> """) self.recv(""" <message from='you@google.com' to='tester@localhost'> <fields xmlns='urn:xmpp:iot:sensordata' seqnr='1' done='true'/> - </message> + </message> """) t1.join(); @@ -1114,7 +1114,7 @@ class TestStreamSensorData(SlixTest): plugins=['xep_0030', 'xep_0323']) - results = []; + results = []; def my_callback(from_jid, result, nodeId=None, timestamp=None, fields=None, error_msg=None): results.append(result); @@ -1133,12 +1133,12 @@ class TestStreamSensorData(SlixTest): """) self.recv(""" - <iq type='result' + <iq type='result' from='you@google.com' to='tester@localhost' id='1'> <accepted xmlns='urn:xmpp:iot:sensordata' seqnr='1'/> - </iq> + </iq> """) self.xmpp['xep_0323'].cancel_request(session=session); @@ -1192,7 +1192,7 @@ class TestStreamSensorData(SlixTest): """) self.send(""" - <iq type='result' + <iq type='result' from='device@clayster.com' to='master@clayster.com/amr' id='1'> diff --git a/tests/test_stream_xep_0325.py b/tests/test_stream_xep_0325.py index b85342ff..0d4ab907 100644 --- a/tests/test_stream_xep_0325.py +++ b/tests/test_stream_xep_0325.py @@ -60,7 +60,7 @@ class TestStreamControl(SlixTest): 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"); @@ -99,7 +99,7 @@ class TestStreamControl(SlixTest): 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"); @@ -125,7 +125,7 @@ class TestStreamControl(SlixTest): 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"); @@ -163,7 +163,7 @@ class TestStreamControl(SlixTest): <parameter name='Voltage' /> <error var='Output'>Invalid field Voltage</error> </setResponse> - </iq> + </iq> """) self.assertEqual(myDevice._get_field_value("Temperature"), "15"); @@ -180,7 +180,7 @@ class TestStreamControl(SlixTest): 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'> @@ -204,7 +204,7 @@ class TestStreamControl(SlixTest): 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'> @@ -225,7 +225,7 @@ class TestStreamControl(SlixTest): plugins=['xep_0030', 'xep_0325']) - results = []; + results = []; def my_callback(from_jid, result, nodeIds=None, fields=None, error_msg=None): results.append(result); @@ -256,7 +256,7 @@ class TestStreamControl(SlixTest): to='tester@localhost' id='1'> <setResponse xmlns='urn:xmpp:iot:control' responseCode="OK" /> - </iq> + </iq> """) time.sleep(.5) @@ -269,7 +269,7 @@ class TestStreamControl(SlixTest): plugins=['xep_0030', 'xep_0325']) - results = []; + results = []; def my_callback(from_jid, result, nodeIds=None, fields=None, error_msg=None): results.append(result); @@ -302,7 +302,7 @@ class TestStreamControl(SlixTest): <setResponse xmlns='urn:xmpp:iot:control' responseCode="OtherError" > <error var='Temperature'>Sensor error</error> </setResponse> - </iq> + </iq> """) time.sleep(.5) @@ -330,8 +330,8 @@ class TestStreamControl(SlixTest): <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): @@ -356,8 +356,8 @@ class TestStreamControl(SlixTest): <query xmlns='http://jabber.org/protocol/disco#info'> <identity category='component' type='generic'/> <feature var='urn:xmpp:iot:control'/> - </query> - </iq> + </query> + </iq> """) |