summaryrefslogtreecommitdiff
path: root/qpid/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
commit6d57872baf835acfd17a9e6a185299a5bf4f6fd5 (patch)
treebc7fe7d573c9f994b3f74a9dfff0c5a024a1b04e /qpid/python/tests/spec.py
parent19646b54c118683edd6adfdd44fad92e86f0522f (diff)
downloadqpid-python-6d57872baf835acfd17a9e6a185299a5bf4f6fd5.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@564362 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/python/tests/spec.py')
-rw-r--r--qpid/python/tests/spec.py56
1 files changed, 56 insertions, 0 deletions
diff --git a/qpid/python/tests/spec.py b/qpid/python/tests/spec.py
new file mode 100644
index 0000000000..c70e4f9c4b
--- /dev/null
+++ b/qpid/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")