From 26fedee24063fb8a2adeecc912c3a53a0b5b1198 Mon Sep 17 00:00:00 2001 From: Scott Lyons Date: Fri, 3 Feb 2012 22:59:47 -0500 Subject: [PATCH] Fixing up the MongoDB tests from their moving to the funtests module. Fixes a few typos as well. --- funtests/tests/test_mongodb.py | 12 ++++++------ kombu/transport/mongodb.py | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/funtests/tests/test_mongodb.py b/funtests/tests/test_mongodb.py index 83932364..c51e3a5a 100644 --- a/funtests/tests/test_mongodb.py +++ b/funtests/tests/test_mongodb.py @@ -16,14 +16,14 @@ class test_mongodb(transport.TransportCase): def test_fanout(self, name="test_mongodb_fanout"): c = self.connection - e = Exchange(name, type="fanout") - q = Queue(name, exchange=e, routing_key=name) - q2 = Queue(name + "2", exchange=e, routing_key=name + "2") + self.e = Exchange(name, type="fanout") + self.q = Queue(name, exchange=self.e, routing_key=name) + self.q2 = Queue(name + "2", exchange=self.e, routing_key=name + "2") channel = c.default_channel - producer = Producer(channel, e) - consumer1 = Consumer(channel, q) - consumer2 = Consumer(channel, q2) + producer = Producer(channel, self.e) + consumer1 = Consumer(channel, self.q) + consumer2 = Consumer(channel, self.q2) self.q2(channel).declare() for i in xrange(10): diff --git a/kombu/transport/mongodb.py b/kombu/transport/mongodb.py index 367068a0..71c2b6b5 100644 --- a/kombu/transport/mongodb.py +++ b/kombu/transport/mongodb.py @@ -28,7 +28,6 @@ Flavio [FlaPer87] Percoco Premoli ;\ Scott Lyons ;\ """ - class Channel(virtual.Channel): _client = None supports_fanout = True @@ -90,7 +89,7 @@ class Channel(virtual.Channel): def close(self): super(Channel, self).close() if self._client: - self._client.database.connection.end_request() + self._client.connection.end_request() def _open(self): conninfo = self.connection.client @@ -124,6 +123,7 @@ class Channel(virtual.Channel): self.routing.ensure_index([("queue", 1), ("exchange", 1)]) return database + #TODO: Store a more complete exchange metatable in the routing collection def get_table(self, exchange): """Get table of bindings for ``exchange``.""" brokerRoutes = self.client.messages.routing.find({