From 921cf9ab4c5a43f898065e875c3120152d4e81e5 Mon Sep 17 00:00:00 2001 From: "Rafael H. Schloming" Date: Thu, 9 Aug 2007 19:57:10 +0000 Subject: 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 --- python/tests/spec.py | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 python/tests/spec.py (limited to 'python/tests/spec.py') 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") -- cgit v1.2.1