Fixing up the MongoDB tests from their moving to the funtests module. Fixes a few typos as well.

This commit is contained in:
Scott Lyons 2012-02-03 22:59:47 -05:00
parent 2b140266c5
commit 26fedee240
2 changed files with 8 additions and 8 deletions

View File

@ -16,14 +16,14 @@ class test_mongodb(transport.TransportCase):
def test_fanout(self, name="test_mongodb_fanout"): def test_fanout(self, name="test_mongodb_fanout"):
c = self.connection c = self.connection
e = Exchange(name, type="fanout") self.e = Exchange(name, type="fanout")
q = Queue(name, exchange=e, routing_key=name) self.q = Queue(name, exchange=self.e, routing_key=name)
q2 = Queue(name + "2", exchange=e, routing_key=name + "2") self.q2 = Queue(name + "2", exchange=self.e, routing_key=name + "2")
channel = c.default_channel channel = c.default_channel
producer = Producer(channel, e) producer = Producer(channel, self.e)
consumer1 = Consumer(channel, q) consumer1 = Consumer(channel, self.q)
consumer2 = Consumer(channel, q2) consumer2 = Consumer(channel, self.q2)
self.q2(channel).declare() self.q2(channel).declare()
for i in xrange(10): for i in xrange(10):

View File

@ -28,7 +28,6 @@ Flavio [FlaPer87] Percoco Premoli <flaper87@flaper87.org>;\
Scott Lyons <scottalyons@gmail.com>;\ Scott Lyons <scottalyons@gmail.com>;\
""" """
class Channel(virtual.Channel): class Channel(virtual.Channel):
_client = None _client = None
supports_fanout = True supports_fanout = True
@ -90,7 +89,7 @@ class Channel(virtual.Channel):
def close(self): def close(self):
super(Channel, self).close() super(Channel, self).close()
if self._client: if self._client:
self._client.database.connection.end_request() self._client.connection.end_request()
def _open(self): def _open(self):
conninfo = self.connection.client conninfo = self.connection.client
@ -124,6 +123,7 @@ class Channel(virtual.Channel):
self.routing.ensure_index([("queue", 1), ("exchange", 1)]) self.routing.ensure_index([("queue", 1), ("exchange", 1)])
return database return database
#TODO: Store a more complete exchange metatable in the routing collection
def get_table(self, exchange): def get_table(self, exchange):
"""Get table of bindings for ``exchange``.""" """Get table of bindings for ``exchange``."""
brokerRoutes = self.client.messages.routing.find({ brokerRoutes = self.client.messages.routing.find({