[Telepathy-commits] [telepathy-gabble/master] test-muc-offer-dbus-private-tube.py: use ns.py

Guillaume Desmottes guillaume.desmottes at collabora.co.uk
Tue Feb 3 03:36:20 PST 2009


---
 .../tubes/test-muc-offer-dbus-private-tube.py      |   26 +++++++-------------
 1 files changed, 9 insertions(+), 17 deletions(-)

diff --git a/tests/twisted/tubes/test-muc-offer-dbus-private-tube.py b/tests/twisted/tubes/test-muc-offer-dbus-private-tube.py
index e7cee94..8e428b2 100644
--- a/tests/twisted/tubes/test-muc-offer-dbus-private-tube.py
+++ b/tests/twisted/tubes/test-muc-offer-dbus-private-tube.py
@@ -10,7 +10,7 @@ from servicetest import call_async, EventPattern, tp_name_prefix
 from gabbletest import exec_test, make_result_iq, acknowledge_iq, sync_stream
 
 from twisted.words.xish import domish, xpath
-from ns import DISCO_INFO
+from ns import DISCO_INFO, TUBES, SI, FEATURE_NEG, IBB, MUC_BYTESTREAM, X_DATA
 
 sample_parameters = dbus.Dictionary({
     's': 'hello',
@@ -19,14 +19,6 @@ sample_parameters = dbus.Dictionary({
     'i': dbus.Int32(-123),
     }, signature='sv')
 
-# FIXME: use ns.py
-NS_TUBES = 'http://telepathy.freedesktop.org/xmpp/tubes'
-NS_SI = 'http://jabber.org/protocol/si'
-NS_FEATURE_NEG = 'http://jabber.org/protocol/feature-neg'
-NS_IBB = 'http://jabber.org/protocol/ibb'
-NS_MUC_BYTESTREAM = 'http://telepathy.freedesktop.org/xmpp/protocol/muc-bytestream'
-NS_X_DATA = 'jabber:x:data'
-
 HT_CONTACT = 1
 
 # FIXME: stolen from jingletest.py. Should be shared by all tests
@@ -78,7 +70,7 @@ def test(q, bus, conn, stream):
 
     # reply to disco query
     event = q.expect('stream-iq', to='alice at localhost/Test', query_ns=DISCO_INFO)
-    stream.send(make_caps_disco_reply(stream, event.stanza, [NS_TUBES]))
+    stream.send(make_caps_disco_reply(stream, event.stanza, [TUBES]))
 
     sync_stream(q, stream)
 
@@ -132,7 +124,7 @@ def test(q, bus, conn, stream):
     iq = iq_event.stanza
 
     tube_nodes = xpath.queryForNodes('/iq/si/tube[@xmlns="%s"]'
-        % NS_TUBES, iq)
+        % TUBES, iq)
     assert len(tube_nodes) == 1
     tube = tube_nodes[0]
     tube['type'] = 'dbus'
@@ -170,19 +162,19 @@ def test(q, bus, conn, stream):
     result = make_result_iq(stream, iq)
     result['from'] = 'alice at localhost/Test'
     si = result.firstChildElement()
-    feature = si.addElement((NS_FEATURE_NEG, 'feature'))
-    x = feature.addElement((NS_X_DATA, 'x'))
+    feature = si.addElement((FEATURE_NEG, 'feature'))
+    x = feature.addElement((X_DATA, 'x'))
     x['type'] = 'submit'
     field = x.addElement((None, 'field'))
     field['var'] = 'stream-method'
     value = field.addElement((None, 'value'))
-    value.addContent(NS_IBB)
-    si.addElement((NS_TUBES, 'tube'))
+    value.addContent(IBB)
+    si.addElement((TUBES, 'tube'))
     stream.send(result)
 
     # wait IBB init IQ
     event = q.expect('stream-iq', to='alice at localhost/Test',
-        query_name='open', query_ns=NS_IBB)
+        query_name='open', query_ns=IBB)
     iq = event.stanza
     open = xpath.queryForNodes('/iq/open', iq)[0]
     assert open['sid'] == dbus_stream_id
@@ -204,7 +196,7 @@ def test(q, bus, conn, stream):
     event = q.expect('stream-message', to='alice at localhost/Test')
     message = event.stanza
 
-    data_nodes = xpath.queryForNodes('/message/data[@xmlns="%s"]' % NS_IBB,
+    data_nodes = xpath.queryForNodes('/message/data[@xmlns="%s"]' % IBB,
         message)
     assert data_nodes is not None
     assert len(data_nodes) == 1
-- 
1.5.6.5




More information about the telepathy-commits mailing list