Adds tests for brokers

* test for redis and django-redis
* test for disque

TODO add disque to Travis
This commit is contained in:
Ilan Steemers
2015-08-30 20:26:30 +02:00
parent 4f39062785
commit d6b9b10e3e
3 changed files with 67 additions and 3 deletions
+3 -3
View File
@@ -6,7 +6,7 @@ class Broker(object):
def __init__(self, list_key=Conf.Q_LIST):
self.connection = self.get_connection()
self.list_key = list_key
self.cache=self.get_cache()
self.cache = self.get_cache()
def enqueue(self, task):
pass
@@ -27,7 +27,7 @@ class Broker(object):
pass
def set_stat(self, key, value, timeout):
key_list=self.cache.get(Conf.Q_STAT, [])
key_list = self.cache.get(Conf.Q_STAT, [])
if key not in key_list:
key_list.append(key)
self.cache.set(Conf.Q_STAT, key_list)
@@ -47,7 +47,7 @@ class Broker(object):
stats.append(stat)
else:
key_list.remove(key)
self.cache.set(Conf.Q_STAT,key_list)
self.cache.set(Conf.Q_STAT, key_list)
return stats
@staticmethod
+3
View File
@@ -22,6 +22,9 @@ class Disque(Broker):
def ping(self):
return self.connection.ping()
def delete_queue(self, list_key=None):
raise NotImplementedError
@staticmethod
def get_connection():
for node in Conf.DISQUE: