summaryrefslogtreecommitdiff
path: root/python/tests/spec.py
diff options
context:
space:
mode:
authorRafael H. Schloming <rhs@apache.org>2007-08-09 19:57:10 +0000
committerRafael H. Schloming <rhs@apache.org>2007-08-09 19:57:10 +0000
commit921cf9ab4c5a43f898065e875c3120152d4e81e5 (patch)
treee3f6b7f7e95e10958daa4c1711f94c9eb26b6b85 /python/tests/spec.py
parent66578b1a1d6d54e0335a0a105eabe74e60e8e4c7 (diff)
downloadqpid-python-921cf9ab4c5a43f898065e875c3120152d4e81e5.tar.gz
added support for parsing structs and results into the spec metadata
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@564362 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'python/tests/spec.py')
-rw-r--r--python/tests/spec.py56
1 files changed, 56 insertions, 0 deletions
diff --git a/python/tests/spec.py b/python/tests/spec.py
new file mode 100644
index 0000000000..c70e4f9c4b
--- /dev/null
+++ b/python/tests/spec.py
@@ -0,0 +1,56 @@
+from unittest import TestCase
+from qpid.spec import load
+
+
+class SpecTest(TestCase):
+
+ def check_load(self, *urls):
+ spec = load(*urls)
+ qdecl = spec.method("queue_declare")
+ assert qdecl != None
+ assert not qdecl.content
+
+ queue = qdecl.fields.byname["queue"]
+ assert queue != None
+ assert queue.domain.name == "queue_name"
+ assert queue.type == "shortstr"
+
+ qdecl_ok = spec.method("queue_declare_ok")
+
+ # 0-8 is actually 8-0
+ if (spec.major == 8 and spec.minor == 0 or
+ spec.major == 0 and spec.minor == 9):
+ assert qdecl_ok != None
+
+ assert len(qdecl.responses) == 1
+ assert qdecl_ok in qdecl.responses
+
+ publish = spec.method("basic_publish")
+ assert publish != None
+ assert publish.content
+
+ if (spec.major == 0 and spec.minor == 10):
+ assert qdecl_ok == None
+ reply_to = spec.domains.byname["reply_to"]
+ assert reply_to.type.size == "short"
+ assert reply_to.type.pack == "short"
+ assert len(reply_to.type.fields) == 2
+
+ qq = spec.method("queue_query")
+ assert qq != None
+ assert qq.result.size == "long"
+ assert qq.result.type != None
+ args = qq.result.fields.byname["arguments"]
+ assert args.type == "table"
+
+ def test_load_0_8(self):
+ self.check_load("../specs/amqp.0-8.xml")
+
+ def test_load_0_9(self):
+ self.check_load("../specs/amqp.0-9.xml")
+
+ def test_load_0_9_errata(self):
+ self.check_load("../specs/amqp.0-9.xml", "../specs/amqp-errata.0-9.xml")
+
+ def test_load_0_10(self):
+ self.check_load("../specs/amqp.0-10-preview.xml")