summaryrefslogtreecommitdiff
path: root/tests/test_stream_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_stream_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_stream_xep_0323.py')
-rw-r--r--tests/test_stream_xep_0323.py237
1 files changed, 118 insertions, 119 deletions
diff --git a/tests/test_stream_xep_0323.py b/tests/test_stream_xep_0323.py
index f92c4553..42230e1f 100644
--- a/tests/test_stream_xep_0323.py
+++ b/tests/test_stream_xep_0323.py
@@ -19,7 +19,7 @@ class TestStreamSensorData(SlixTest):
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()
@@ -29,12 +29,12 @@ class TestStreamSensorData(SlixTest):
plugins=['xep_0030',
'xep_0323'])
- myDevice = Device("Device22");
- myDevice._add_field(name="Temperature", typename="numeric", unit="°C");
+ myDevice = Device("Device22")
+ myDevice._add_field(name="Temperature", typename="numeric", unit="°C")
myDevice._set_momentary_timestamp("2013-03-07T16:24:30")
- myDevice._add_field_momentary_data("Temperature", "23.4", flags={"automaticReadout": "true"});
+ myDevice._add_field_momentary_data("Temperature", "23.4", flags={"automaticReadout": "true"})
- self.xmpp['xep_0323'].register_node(nodeId="Device22", device=myDevice, commTimeout=0.5);
+ self.xmpp['xep_0323'].register_node(nodeId="Device22", device=myDevice, commTimeout=0.5)
self.recv("""
<iq type='get'
@@ -73,7 +73,7 @@ class TestStreamSensorData(SlixTest):
plugins=['xep_0030',
'xep_0323'])
- self.xmpp['xep_0323']._set_authenticated("darth@deathstar.com");
+ self.xmpp['xep_0323']._set_authenticated("darth@deathstar.com")
self.recv("""
<iq type='get'
@@ -101,8 +101,8 @@ class TestStreamSensorData(SlixTest):
plugins=['xep_0030',
'xep_0323'])
- myDevice = Device("Device44");
- self.xmpp['xep_0323'].register_node('Device44', myDevice, commTimeout=0.5);
+ myDevice = Device("Device44")
+ self.xmpp['xep_0323'].register_node('Device44', myDevice, commTimeout=0.5)
print("."),
@@ -157,11 +157,11 @@ class TestStreamSensorData(SlixTest):
plugins=['xep_0030',
'xep_0323'])
- myDevice = Device("Device44");
- myDevice._add_field(name='Voltage', typename="numeric", unit="V");
- myDevice._add_field_timestamp_data(name="Voltage", value="230.4", timestamp="2000-01-01T00:01:02", flags={"invoiced": "true"});
+ myDevice = Device("Device44")
+ myDevice._add_field(name='Voltage', typename="numeric", unit="V")
+ myDevice._add_field_timestamp_data(name="Voltage", value="230.4", timestamp="2000-01-01T00:01:02", flags={"invoiced": "true"})
- self.xmpp['xep_0323'].register_node('Device44', myDevice, commTimeout=0.5);
+ self.xmpp['xep_0323'].register_node('Device44', myDevice, commTimeout=0.5)
print("."),
@@ -236,15 +236,15 @@ class TestStreamSensorData(SlixTest):
plugins=['xep_0030',
'xep_0323'])
- myDevice = Device("Device44");
- myDevice._add_field(name='Voltage', typename="numeric", unit="V");
- myDevice._add_field_timestamp_data(name="Voltage", value="230.4", timestamp="2000-01-01T00:01:02", flags={"invoiced": "true"});
- myDevice._add_field(name='Current', typename="numeric", unit="A");
- myDevice._add_field(name='Height', typename="string");
- myDevice._add_field_timestamp_data(name="Voltage", value="230.6", timestamp="2000-01-01T01:01:02");
- myDevice._add_field_timestamp_data(name="Height", value="115 m", timestamp="2000-01-01T01:01:02", flags={"invoiced": "true"});
+ myDevice = Device("Device44")
+ myDevice._add_field(name='Voltage', typename="numeric", unit="V")
+ myDevice._add_field_timestamp_data(name="Voltage", value="230.4", timestamp="2000-01-01T00:01:02", flags={"invoiced": "true"})
+ myDevice._add_field(name='Current', typename="numeric", unit="A")
+ myDevice._add_field(name='Height', typename="string")
+ myDevice._add_field_timestamp_data(name="Voltage", value="230.6", timestamp="2000-01-01T01:01:02")
+ myDevice._add_field_timestamp_data(name="Height", value="115 m", timestamp="2000-01-01T01:01:02", flags={"invoiced": "true"})
- self.xmpp['xep_0323'].register_node('Device44', myDevice, commTimeout=0.5);
+ self.xmpp['xep_0323'].register_node('Device44', myDevice, commTimeout=0.5)
print("."),
@@ -308,15 +308,15 @@ class TestStreamSensorData(SlixTest):
plugins=['xep_0030',
'xep_0323'])
- myDevice = Device("Device44");
- myDevice._add_field(name='Voltage', typename="numeric", unit="V");
- myDevice._add_field_timestamp_data(name="Voltage", value="230.4", timestamp="2000-01-01T00:01:02", flags={"invoiced": "true"});
- myDevice._add_field(name='Current', typename="numeric", unit="A");
- myDevice._add_field(name='Height', typename="string");
- myDevice._add_field_timestamp_data(name="Voltage", value="230.6", timestamp="2000-01-01T01:01:02");
- myDevice._add_field_timestamp_data(name="Height", value="115 m", timestamp="2000-01-01T01:01:02", flags={"invoiced": "true"});
+ myDevice = Device("Device44")
+ myDevice._add_field(name='Voltage', typename="numeric", unit="V")
+ myDevice._add_field_timestamp_data(name="Voltage", value="230.4", timestamp="2000-01-01T00:01:02", flags={"invoiced": "true"})
+ myDevice._add_field(name='Current', typename="numeric", unit="A")
+ myDevice._add_field(name='Height', typename="string")
+ myDevice._add_field_timestamp_data(name="Voltage", value="230.6", timestamp="2000-01-01T01:01:02")
+ myDevice._add_field_timestamp_data(name="Height", value="115 m", timestamp="2000-01-01T01:01:02", flags={"invoiced": "true"})
- self.xmpp['xep_0323'].register_node('Device44', myDevice, commTimeout=0.5);
+ self.xmpp['xep_0323'].register_node('Device44', myDevice, commTimeout=0.5)
print("."),
@@ -379,7 +379,7 @@ class TestStreamSensorData(SlixTest):
plugins=['xep_0030',
'xep_0323'])
- self.xmpp['xep_0323'].request_data(from_jid="tester@localhost", to_jid="you@google.com", callback=None);
+ self.xmpp['xep_0323'].request_data(from_jid="tester@localhost", to_jid="you@google.com", callback=None)
self.send("""
<iq type='get'
@@ -390,7 +390,7 @@ class TestStreamSensorData(SlixTest):
</iq>
""")
- self.xmpp['xep_0323'].request_data(from_jid="tester@localhost", to_jid="you@google.com", nodeIds=['Device33', 'Device22'], callback=None);
+ self.xmpp['xep_0323'].request_data(from_jid="tester@localhost", to_jid="you@google.com", nodeIds=['Device33', 'Device22'], callback=None)
self.send("""
<iq type='get'
@@ -404,7 +404,7 @@ class TestStreamSensorData(SlixTest):
</iq>
""")
- self.xmpp['xep_0323'].request_data(from_jid="tester@localhost", to_jid="you@google.com", fields=['Temperature', 'Voltage'], callback=None);
+ self.xmpp['xep_0323'].request_data(from_jid="tester@localhost", to_jid="you@google.com", fields=['Temperature', 'Voltage'], callback=None)
self.send("""
<iq type='get'
@@ -424,13 +424,13 @@ 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"):
- results.append("rejected");
+ results.append("rejected")
- self.xmpp['xep_0323'].request_data(from_jid="tester@localhost", to_jid="you@google.com", nodeIds=['Device33', 'Device22'], callback=my_callback);
+ self.xmpp['xep_0323'].request_data(from_jid="tester@localhost", to_jid="you@google.com", nodeIds=['Device33', 'Device22'], callback=my_callback)
self.send("""
<iq type='get'
@@ -456,7 +456,7 @@ class TestStreamSensorData(SlixTest):
""")
self.failUnless(results == ["rejected"],
- "Rejected callback was not properly executed");
+ "Rejected callback was not properly executed")
def testRequestAcceptedAPI(self):
@@ -464,12 +464,12 @@ 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);
+ results.append(result)
- self.xmpp['xep_0323'].request_data(from_jid="tester@localhost", to_jid="you@google.com", nodeIds=['Device33', 'Device22'], callback=my_callback);
+ self.xmpp['xep_0323'].request_data(from_jid="tester@localhost", to_jid="you@google.com", nodeIds=['Device33', 'Device22'], callback=my_callback)
self.send("""
<iq type='get'
@@ -493,7 +493,7 @@ class TestStreamSensorData(SlixTest):
""")
self.failUnless(results == ["accepted"],
- "Accepted callback was not properly executed");
+ "Accepted callback was not properly executed")
def testRequestFieldsAPI(self):
@@ -501,17 +501,17 @@ 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);
+ results.append(result)
if result == "fields":
- callback_data["nodeId"] = nodeId;
- callback_data["timestamp"] = timestamp;
- callback_data["error_msg"] = error_msg;
+ callback_data["nodeId"] = nodeId
+ callback_data["timestamp"] = timestamp
+ callback_data["error_msg"] = error_msg
for f in fields:
- callback_data["field_" + f['name']] = f;
+ callback_data["field_" + f['name']] = f
self.xmpp['xep_0323'].request_data(from_jid="tester@localhost",
to_jid="you@google.com",
@@ -560,24 +560,24 @@ class TestStreamSensorData(SlixTest):
</message>
""")
- self.failUnlessEqual(results, ["accepted","fields","done"]);
+ self.failUnlessEqual(results, ["accepted","fields","done"])
# self.assertIn("nodeId", callback_data);
self.assertTrue("nodeId" in callback_data)
- self.failUnlessEqual(callback_data["nodeId"], "Device33");
+ self.failUnlessEqual(callback_data["nodeId"], "Device33")
# self.assertIn("timestamp", callback_data);
- self.assertTrue("timestamp" in callback_data);
- self.failUnlessEqual(callback_data["timestamp"], "2000-01-01T00:01:02");
+ self.assertTrue("timestamp" in callback_data)
+ self.failUnlessEqual(callback_data["timestamp"], "2000-01-01T00:01:02")
#self.assertIn("field_Voltage", callback_data);
- self.assertTrue("field_Voltage" in callback_data);
- self.failUnlessEqual(callback_data["field_Voltage"], {"name": "Voltage", "value": "230.4", "typename": "numeric", "unit": "V", "flags": {"invoiced": "true"}});
+ self.assertTrue("field_Voltage" in callback_data)
+ self.failUnlessEqual(callback_data["field_Voltage"], {"name": "Voltage", "value": "230.4", "typename": "numeric", "unit": "V", "flags": {"invoiced": "true"}})
#self.assertIn("field_TestBool", callback_data);
- self.assertTrue("field_TestBool" in callback_data);
- self.failUnlessEqual(callback_data["field_TestBool"], {"name": "TestBool", "value": "true", "typename": "boolean" });
+ self.assertTrue("field_TestBool" in callback_data)
+ self.failUnlessEqual(callback_data["field_TestBool"], {"name": "TestBool", "value": "true", "typename": "boolean" })
def testServiceDiscoveryClient(self):
self.stream_start(mode='client',
plugins=['xep_0030',
- 'xep_0323']);
+ 'xep_0323'])
self.recv("""
<iq type='get'
@@ -602,7 +602,7 @@ class TestStreamSensorData(SlixTest):
def testServiceDiscoveryComponent(self):
self.stream_start(mode='component',
plugins=['xep_0030',
- 'xep_0323']);
+ 'xep_0323'])
self.recv("""
<iq type='get'
@@ -631,21 +631,20 @@ class TestStreamSensorData(SlixTest):
plugins=['xep_0030',
'xep_0323'])
- results = [];
- callback_data = {};
+ results = []
+ callback_data = {}
def my_callback(from_jid, result, nodeId=None, timestamp=None, error_msg=None):
- results.append(result);
+ results.append(result)
if result == "failure":
- callback_data["nodeId"] = nodeId;
- callback_data["timestamp"] = timestamp;
- callback_data["error_msg"] = error_msg;
+ callback_data["nodeId"] = nodeId
+ callback_data["timestamp"] = timestamp
+ callback_data["error_msg"] = error_msg
self.xmpp['xep_0323'].request_data(from_jid="tester@localhost",
to_jid="you@google.com",
nodeIds=['Device33'],
callback=my_callback)
-
self.send("""
<iq type='get'
from='tester@localhost'
@@ -677,26 +676,26 @@ class TestStreamSensorData(SlixTest):
self.failUnlessEqual(results, ["accepted","failure"]);
# self.assertIn("nodeId", callback_data);
- self.assertTrue("nodeId" in callback_data);
- self.failUnlessEqual(callback_data["nodeId"], "Device33");
+ self.assertTrue("nodeId" in callback_data)
+ self.failUnlessEqual(callback_data["nodeId"], "Device33")
# self.assertIn("timestamp", callback_data);
- self.assertTrue("timestamp" in callback_data);
- self.failUnlessEqual(callback_data["timestamp"], "2013-03-07T17:13:30");
+ self.assertTrue("timestamp" in callback_data)
+ self.failUnlessEqual(callback_data["timestamp"], "2013-03-07T17:13:30")
# self.assertIn("error_msg", callback_data);
- self.assertTrue("error_msg" in callback_data);
- self.failUnlessEqual(callback_data["error_msg"], "Timeout.");
+ self.assertTrue("error_msg" in callback_data)
+ self.failUnlessEqual(callback_data["error_msg"], "Timeout.")
def testDelayedRequest(self):
self.stream_start(mode='component',
plugins=['xep_0030',
'xep_0323'])
- myDevice = Device("Device22");
- myDevice._add_field(name="Temperature", typename="numeric", unit="°C");
+ myDevice = Device("Device22")
+ myDevice._add_field(name="Temperature", typename="numeric", unit="°C")
myDevice._set_momentary_timestamp("2013-03-07T16:24:30")
- myDevice._add_field_momentary_data("Temperature", "23.4", flags={"automaticReadout": "true"});
+ myDevice._add_field_momentary_data("Temperature", "23.4", flags={"automaticReadout": "true"})
- self.xmpp['xep_0323'].register_node(nodeId="Device22", device=myDevice, commTimeout=0.5);
+ self.xmpp['xep_0323'].register_node(nodeId="Device22", device=myDevice, commTimeout=0.5)
dtnow = datetime.datetime.now()
ts_2sec = datetime.timedelta(0,2)
@@ -748,12 +747,12 @@ class TestStreamSensorData(SlixTest):
plugins=['xep_0030',
'xep_0323'])
- myDevice = Device("Device22");
- myDevice._add_field(name="Temperature", typename="numeric", unit="°C");
+ myDevice = Device("Device22")
+ myDevice._add_field(name="Temperature", typename="numeric", unit="°C")
myDevice._set_momentary_timestamp("2013-03-07T16:24:30")
- myDevice._add_field_momentary_data("Temperature", "23.4", flags={"automaticReadout": "true"});
+ myDevice._add_field_momentary_data("Temperature", "23.4", flags={"automaticReadout": "true"})
- self.xmpp['xep_0323'].register_node(nodeId="Device22", device=myDevice, commTimeout=0.5);
+ self.xmpp['xep_0323'].register_node(nodeId="Device22", device=myDevice, commTimeout=0.5)
dtnow = datetime.datetime.now()
ts_2sec = datetime.timedelta(0,2)
@@ -809,13 +808,13 @@ class TestStreamSensorData(SlixTest):
plugins=['xep_0030',
'xep_0323'])
- myDevice = Device("Device44");
- myDevice._add_field(name='Voltage', typename="numeric", unit="V");
- myDevice._add_field_timestamp_data(name="Voltage", value="230.1", timestamp="2000-01-01T00:01:02", flags={"invoiced": "true"});
- myDevice._add_field_timestamp_data(name="Voltage", value="230.2", timestamp="2000-02-01T00:01:02", flags={"invoiced": "true"});
- myDevice._add_field_timestamp_data(name="Voltage", value="230.3", timestamp="2000-03-01T00:01:02", flags={"invoiced": "true"});
+ myDevice = Device("Device44")
+ myDevice._add_field(name='Voltage', typename="numeric", unit="V")
+ myDevice._add_field_timestamp_data(name="Voltage", value="230.1", timestamp="2000-01-01T00:01:02", flags={"invoiced": "true"})
+ myDevice._add_field_timestamp_data(name="Voltage", value="230.2", timestamp="2000-02-01T00:01:02", flags={"invoiced": "true"})
+ myDevice._add_field_timestamp_data(name="Voltage", value="230.3", timestamp="2000-03-01T00:01:02", flags={"invoiced": "true"})
- self.xmpp['xep_0323'].register_node('Device44', myDevice, commTimeout=0.5);
+ self.xmpp['xep_0323'].register_node('Device44', myDevice, commTimeout=0.5)
print("."),
@@ -879,13 +878,13 @@ class TestStreamSensorData(SlixTest):
plugins=['xep_0030',
'xep_0323'])
- myDevice = Device("Device44");
- myDevice._add_field(name='Voltage', typename="numeric", unit="V");
- myDevice._add_field_timestamp_data(name="Voltage", value="230.1", timestamp="2000-01-01T00:01:02", flags={"invoiced": "true"});
- myDevice._add_field_timestamp_data(name="Voltage", value="230.2", timestamp="2000-02-01T00:01:02", flags={"invoiced": "true"});
- myDevice._add_field_timestamp_data(name="Voltage", value="230.3", timestamp="2000-03-01T00:01:02", flags={"invoiced": "true"});
+ myDevice = Device("Device44")
+ myDevice._add_field(name='Voltage', typename="numeric", unit="V")
+ myDevice._add_field_timestamp_data(name="Voltage", value="230.1", timestamp="2000-01-01T00:01:02", flags={"invoiced": "true"})
+ myDevice._add_field_timestamp_data(name="Voltage", value="230.2", timestamp="2000-02-01T00:01:02", flags={"invoiced": "true"})
+ myDevice._add_field_timestamp_data(name="Voltage", value="230.3", timestamp="2000-03-01T00:01:02", flags={"invoiced": "true"})
- self.xmpp['xep_0323'].register_node('Device44', myDevice, commTimeout=0.5);
+ self.xmpp['xep_0323'].register_node('Device44', myDevice, commTimeout=0.5)
print("."),
@@ -949,13 +948,13 @@ class TestStreamSensorData(SlixTest):
plugins=['xep_0030',
'xep_0323'])
- myDevice = Device("Device44");
- myDevice._add_field(name='Voltage', typename="numeric", unit="V");
- myDevice._add_field_timestamp_data(name="Voltage", value="230.1", timestamp="2000-01-01T00:01:02", flags={"invoiced": "true"});
- myDevice._add_field_timestamp_data(name="Voltage", value="230.2", timestamp="2000-02-01T00:01:02", flags={"invoiced": "true"});
- myDevice._add_field_timestamp_data(name="Voltage", value="230.3", timestamp="2000-03-01T00:01:02", flags={"invoiced": "true"});
+ myDevice = Device("Device44")
+ myDevice._add_field(name='Voltage', typename="numeric", unit="V")
+ myDevice._add_field_timestamp_data(name="Voltage", value="230.1", timestamp="2000-01-01T00:01:02", flags={"invoiced": "true"})
+ myDevice._add_field_timestamp_data(name="Voltage", value="230.2", timestamp="2000-02-01T00:01:02", flags={"invoiced": "true"})
+ myDevice._add_field_timestamp_data(name="Voltage", value="230.3", timestamp="2000-03-01T00:01:02", flags={"invoiced": "true"})
- self.xmpp['xep_0323'].register_node('Device44', myDevice, commTimeout=0.5);
+ self.xmpp['xep_0323'].register_node('Device44', myDevice, commTimeout=0.5)
print("."),
@@ -1005,17 +1004,17 @@ 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);
+ results.append(result)
if result == "fields":
- callback_data["nodeId"] = nodeId;
- callback_data["timestamp"] = timestamp;
- callback_data["error_msg"] = error_msg;
+ callback_data["nodeId"] = nodeId
+ callback_data["timestamp"] = timestamp
+ callback_data["error_msg"] = error_msg
for f in fields:
- callback_data["field_" + f['name']] = f;
+ callback_data["field_" + f['name']] = f
self.xmpp['xep_0323'].request_data(from_jid="tester@localhost",
to_jid="you@google.com",
@@ -1073,17 +1072,17 @@ class TestStreamSensorData(SlixTest):
self.failUnlessEqual(results, ["queued","started","fields","done"]);
# self.assertIn("nodeId", callback_data);
- self.assertTrue("nodeId" in callback_data);
- self.failUnlessEqual(callback_data["nodeId"], "Device33");
+ self.assertTrue("nodeId" in callback_data)
+ self.failUnlessEqual(callback_data["nodeId"], "Device33")
# self.assertIn("timestamp", callback_data);
- self.assertTrue("timestamp" in callback_data);
- self.failUnlessEqual(callback_data["timestamp"], "2000-01-01T00:01:02");
+ self.assertTrue("timestamp" in callback_data)
+ self.failUnlessEqual(callback_data["timestamp"], "2000-01-01T00:01:02")
# self.assertIn("field_Voltage", callback_data);
- self.assertTrue("field_Voltage" in callback_data);
- self.failUnlessEqual(callback_data["field_Voltage"], {"name": "Voltage", "value": "230.4", "typename": "numeric", "unit": "V", "flags": {"invoiced": "true"}});
+ self.assertTrue("field_Voltage" in callback_data)
+ self.failUnlessEqual(callback_data["field_Voltage"], {"name": "Voltage", "value": "230.4", "typename": "numeric", "unit": "V", "flags": {"invoiced": "true"}})
# self.assertIn("field_TestBool", callback_data);
- self.assertTrue("field_TestBool" in callback_data);
- self.failUnlessEqual(callback_data["field_TestBool"], {"name": "TestBool", "value": "true", "typename": "boolean" });
+ self.assertTrue("field_TestBool" in callback_data)
+ self.failUnlessEqual(callback_data["field_TestBool"], {"name": "TestBool", "value": "true", "typename": "boolean" })
def testRequestFieldsCancelAPI(self):
@@ -1092,12 +1091,12 @@ 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);
+ results.append(result)
- session = self.xmpp['xep_0323'].request_data(from_jid="tester@localhost", to_jid="you@google.com", nodeIds=['Device33'], callback=my_callback);
+ session = self.xmpp['xep_0323'].request_data(from_jid="tester@localhost", to_jid="you@google.com", nodeIds=['Device33'], callback=my_callback)
self.send("""
<iq type='get'
@@ -1119,7 +1118,7 @@ class TestStreamSensorData(SlixTest):
</iq>
""")
- self.xmpp['xep_0323'].cancel_request(session=session);
+ self.xmpp['xep_0323'].cancel_request(session=session)
self.send("""
<iq type='get'
@@ -1139,19 +1138,19 @@ class TestStreamSensorData(SlixTest):
</iq>
""")
- self.failUnlessEqual(results, ["accepted","cancelled"]);
+ self.failUnlessEqual(results, ["accepted","cancelled"])
def testDelayedRequestCancel(self):
self.stream_start(mode='component',
plugins=['xep_0030',
'xep_0323'])
- myDevice = Device("Device22");
- myDevice._add_field(name="Temperature", typename="numeric", unit="°C");
+ myDevice = Device("Device22")
+ myDevice._add_field(name="Temperature", typename="numeric", unit="°C")
myDevice._set_momentary_timestamp("2013-03-07T16:24:30")
- myDevice._add_field_momentary_data("Temperature", "23.4", flags={"automaticReadout": "true"});
+ myDevice._add_field_momentary_data("Temperature", "23.4", flags={"automaticReadout": "true"})
- self.xmpp['xep_0323'].register_node(nodeId="Device22", device=myDevice, commTimeout=0.5);
+ self.xmpp['xep_0323'].register_node(nodeId="Device22", device=myDevice, commTimeout=0.5)
dtnow = datetime.datetime.now()
ts_2sec = datetime.timedelta(0,2)