summaryrefslogtreecommitdiff
path: root/tests/test_stanza_xep_0323.py
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2015-09-23 23:14:26 +0200
committermathieui <mathieui@mathieui.net>2015-10-02 19:00:19 +0200
commitacc52fd935b7e74919ad748f3a630596f66c62af (patch)
tree2d8988c57a63b9cec11c4bf03240a427df9632f8 /tests/test_stanza_xep_0323.py
parente42d651d7ed56375523f91076295fc5f388a8de0 (diff)
parent4305eddb4f634803423cd53d193125a63b00769a (diff)
downloadslixmpp-acc52fd935b7e74919ad748f3a630596f66c62af.tar.gz
slixmpp-acc52fd935b7e74919ad748f3a630596f66c62af.tar.bz2
slixmpp-acc52fd935b7e74919ad748f3a630596f66c62af.tar.xz
slixmpp-acc52fd935b7e74919ad748f3a630596f66c62af.zip
Merge branch 'develop' of https://github.com/fritzy/SleekXMPP into sleek-merge
Conflicts: README.rst examples/IoT_TestDevice.py examples/disco_browser.py setup.py sleekxmpp/jid.py sleekxmpp/plugins/google/auth/stanza.py sleekxmpp/plugins/google/gmail/notifications.py sleekxmpp/plugins/google/nosave/stanza.py sleekxmpp/plugins/google/settings/settings.py sleekxmpp/thirdparty/__init__.py sleekxmpp/thirdparty/socks.py sleekxmpp/thirdparty/statemachine.py sleekxmpp/util/__init__.py sleekxmpp/xmlstream/xmlstream.py slixmpp/basexmpp.py slixmpp/plugins/xep_0004/stanza/form.py slixmpp/plugins/xep_0009/rpc.py slixmpp/plugins/xep_0050/adhoc.py slixmpp/plugins/xep_0065/proxy.py slixmpp/plugins/xep_0084/stanza.py slixmpp/plugins/xep_0202/time.py slixmpp/plugins/xep_0323/sensordata.py slixmpp/plugins/xep_0325/control.py slixmpp/plugins/xep_0325/stanza/control.py slixmpp/roster/single.py slixmpp/stanza/atom.py slixmpp/stanza/rootstanza.py slixmpp/test/slixtest.py slixmpp/util/sasl/mechanisms.py slixmpp/version.py slixmpp/xmlstream/stanzabase.py tests/test_stanza_xep_0323.py tests/test_stanza_xep_0325.py tests/test_stream_xep_0323.py tests/test_stream_xep_0325.py
Diffstat (limited to 'tests/test_stanza_xep_0323.py')
-rw-r--r--tests/test_stanza_xep_0323.py94
1 files changed, 45 insertions, 49 deletions
diff --git a/tests/test_stanza_xep_0323.py b/tests/test_stanza_xep_0323.py
index 95fb138b..991481d7 100644
--- a/tests/test_stanza_xep_0323.py
+++ b/tests/test_stanza_xep_0323.py
@@ -7,7 +7,6 @@ namespace='sn'
class TestSensorDataStanzas(SlixTest):
-
def setUp(self):
pass
#register_stanza_plugin(Iq, xep_0323.stanza.Request)
@@ -59,8 +58,8 @@ class TestSensorDataStanzas(SlixTest):
iq['req']['momentary'] = 'true'
- iq['req'].add_node("Device02", "Source02", "CacheType");
- iq['req'].add_node("Device44");
+ iq['req'].add_node("Device02", "Source02", "CacheType")
+ iq['req'].add_node("Device44")
self.check(iq,"""
<iq type='get'
@@ -75,7 +74,7 @@ class TestSensorDataStanzas(SlixTest):
"""
)
- iq['req'].del_node("Device02");
+ iq['req'].del_node("Device02")
self.check(iq,"""
<iq type='get'
@@ -89,7 +88,7 @@ class TestSensorDataStanzas(SlixTest):
"""
)
- iq['req'].del_nodes();
+ iq['req'].del_nodes()
self.check(iq,"""
<iq type='get'
@@ -115,8 +114,8 @@ class TestSensorDataStanzas(SlixTest):
iq['req']['momentary'] = 'true'
- iq['req'].add_field("Top temperature");
- iq['req'].add_field("Bottom temperature");
+ iq['req'].add_field("Top temperature")
+ iq['req'].add_field("Bottom temperature")
self.check(iq,"""
<iq type='get'
@@ -237,12 +236,12 @@ class TestSensorDataStanzas(SlixTest):
msg['to'] = 'master@clayster.com/amr'
msg['fields']['seqnr'] = '1'
- node = msg['fields'].add_node("Device02");
- ts = node.add_timestamp("2013-03-07T16:24:30");
+ node = msg['fields'].add_node("Device02")
+ ts = node.add_timestamp("2013-03-07T16:24:30")
- data = ts.add_data(typename="numeric", name="Temperature", value="-12.42", unit='K');
- data['momentary'] = 'true';
- data['automaticReadout'] = 'true';
+ data = ts.add_data(typename="numeric", name="Temperature", value="-12.42", unit='K')
+ data['momentary'] = 'true'
+ data['automaticReadout'] = 'true'
self.check(msg,"""
<message from='device@clayster.com'
@@ -258,10 +257,9 @@ class TestSensorDataStanzas(SlixTest):
"""
)
- node = msg['fields'].add_node("EmptyDevice");
- node = msg['fields'].add_node("Device04");
- ts = node.add_timestamp("EmptyTimestamp");
-
+ node = msg['fields'].add_node("EmptyDevice")
+ node = msg['fields'].add_node("Device04")
+ ts = node.add_timestamp("EmptyTimestamp")
self.check(msg,"""
<message from='device@clayster.com'
@@ -281,32 +279,32 @@ class TestSensorDataStanzas(SlixTest):
"""
)
- node = msg['fields'].add_node("Device77");
- ts = node.add_timestamp("2013-05-03T12:00:01");
- data = ts.add_data(typename="numeric", name="Temperature", value="-12.42", unit='K');
- data['historicalDay'] = 'true';
- data = ts.add_data(typename="numeric", name="Speed", value="312.42", unit='km/h');
- data['historicalWeek'] = 'false';
- data = ts.add_data(typename="string", name="Temperature name", value="Bottom oil");
- data['historicalMonth'] = 'true';
- data = ts.add_data(typename="string", name="Speed name", value="Top speed");
- data['historicalQuarter'] = 'false';
- data = ts.add_data(typename="dateTime", name="T1", value="1979-01-01T00:00:00");
- data['historicalYear'] = 'true';
- data = ts.add_data(typename="dateTime", name="T2", value="2000-01-01T01:02:03");
- data['historicalOther'] = 'false';
- data = ts.add_data(typename="timeSpan", name="TS1", value="P5Y");
- data['missing'] = 'true';
- data = ts.add_data(typename="timeSpan", name="TS2", value="PT2M1S");
- data['manualEstimate'] = 'false';
- data = ts.add_data(typename="enum", name="top color", value="red", dataType="string");
- data['invoiced'] = 'true';
- data = ts.add_data(typename="enum", name="bottom color", value="black", dataType="string");
- data['powerFailure'] = 'false';
- data = ts.add_data(typename="boolean", name="Temperature real", value="false");
- data['historicalDay'] = 'true';
- data = ts.add_data(typename="boolean", name="Speed real", value="true");
- data['historicalWeek'] = 'false';
+ node = msg['fields'].add_node("Device77")
+ ts = node.add_timestamp("2013-05-03T12:00:01")
+ data = ts.add_data(typename="numeric", name="Temperature", value="-12.42", unit='K')
+ data['historicalDay'] = 'true'
+ data = ts.add_data(typename="numeric", name="Speed", value="312.42", unit='km/h')
+ data['historicalWeek'] = 'false'
+ data = ts.add_data(typename="string", name="Temperature name", value="Bottom oil")
+ data['historicalMonth'] = 'true'
+ data = ts.add_data(typename="string", name="Speed name", value="Top speed")
+ data['historicalQuarter'] = 'false'
+ data = ts.add_data(typename="dateTime", name="T1", value="1979-01-01T00:00:00")
+ data['historicalYear'] = 'true'
+ data = ts.add_data(typename="dateTime", name="T2", value="2000-01-01T01:02:03")
+ data['historicalOther'] = 'false'
+ data = ts.add_data(typename="timeSpan", name="TS1", value="P5Y")
+ data['missing'] = 'true'
+ data = ts.add_data(typename="timeSpan", name="TS2", value="PT2M1S")
+ data['manualEstimate'] = 'false'
+ data = ts.add_data(typename="enum", name="top color", value="red", dataType="string")
+ data['invoiced'] = 'true'
+ data = ts.add_data(typename="enum", name="bottom color", value="black", dataType="string")
+ data['powerFailure'] = 'false'
+ data = ts.add_data(typename="boolean", name="Temperature real", value="false")
+ data['historicalDay'] = 'true'
+ data = ts.add_data(typename="boolean", name="Speed real", value="true")
+ data['historicalWeek'] = 'false'
self.check(msg,"""
<message from='device@clayster.com'
@@ -344,19 +342,17 @@ class TestSensorDataStanzas(SlixTest):
def testTimestamp(self):
- msg = self.Message();
+ msg = self.Message()
msg['from'] = 'device@clayster.com'
msg['to'] = 'master@clayster.com/amr'
msg['fields']['seqnr'] = '1'
- node = msg['fields'].add_node("Device02");
- node = msg['fields'].add_node("Device03");
-
- ts = node.add_timestamp("2013-03-07T16:24:30");
- ts = node.add_timestamp("2013-03-07T16:24:31");
-
+ node = msg['fields'].add_node("Device02")
+ node = msg['fields'].add_node("Device03")
+ ts = node.add_timestamp("2013-03-07T16:24:30")
+ ts = node.add_timestamp("2013-03-07T16:24:31")
self.check(msg,"""
<message from='device@clayster.com'