summaryrefslogtreecommitdiff
path: root/python/tests/spec010.py
diff options
context:
space:
mode:
authorRafael H. Schloming <rhs@apache.org>2008-03-10 19:12:09 +0000
committerRafael H. Schloming <rhs@apache.org>2008-03-10 19:12:09 +0000
commit713c0c114f8d344beb58d5f99d0cb602485399cf (patch)
treeda91f2d82f9bce5f5939d18db3526851ffd2ff95 /python/tests/spec010.py
parentaeb6df01fad88c3202c9e30205ec60801d672d9c (diff)
downloadqpid-python-713c0c114f8d344beb58d5f99d0cb602485399cf.tar.gz
renamed datatypes.Struct.type -> datatypes.Struct._type; this avoids naming conflicts with metadata-driven fields; moved argument validation -> datatypes.Struct and improved error checking; improved datatypes.Struct.__repr__
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@635660 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'python/tests/spec010.py')
-rw-r--r--python/tests/spec010.py18
1 files changed, 11 insertions, 7 deletions
diff --git a/python/tests/spec010.py b/python/tests/spec010.py
index 1c520ee323..4161dc060f 100644
--- a/python/tests/spec010.py
+++ b/python/tests/spec010.py
@@ -31,11 +31,11 @@ class SpecTest(TestCase):
def testSessionHeader(self):
hdr = self.spec["session.header"]
sc = StringCodec(self.spec)
- hdr.encode(sc, Struct({"sync": True}))
+ hdr.encode(sc, Struct(hdr, sync=True))
assert sc.encoded == "\x01\x01"
sc = StringCodec(self.spec)
- hdr.encode(sc, Struct({"sync": False}))
+ hdr.encode(sc, Struct(hdr, sync=False))
assert sc.encoded == "\x01\x00"
def encdec(self, type, value):
@@ -45,16 +45,20 @@ class SpecTest(TestCase):
return decoded
def testMessageProperties(self):
- props = Struct({"content_length": 0xDEADBEEF,
- "reply_to":
- Struct({"exchange": "the exchange name", "routing_key": "the routing key"})})
- dec = self.encdec(self.spec["message.message_properties"], props)
+ mp = self.spec["message.message_properties"]
+ rt = self.spec["message.reply_to"]
+
+ props = Struct(mp, content_length=0xDEADBEEF,
+ reply_to=Struct(rt, exchange="the exchange name",
+ routing_key="the routing key"))
+ dec = self.encdec(mp, props)
assert props.content_length == dec.content_length
assert props.reply_to.exchange == dec.reply_to.exchange
assert props.reply_to.routing_key == dec.reply_to.routing_key
def testMessageSubscribe(self):
- cmd = Struct({"exclusive": True, "destination": "this is a test"})
+ ms = self.spec["message.subscribe"]
+ cmd = Struct(ms, exclusive=True, destination="this is a test")
dec = self.encdec(self.spec["message.subscribe"], cmd)
assert cmd.exclusive == dec.exclusive
assert cmd.destination == dec.destination