From 11aec527cb47bf4b1dd63e06939eaeeeab64b46c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Piotr=20Ma=C5=9Blanka?= <piotr.maslanka@henrietta.com.pl>
Date: Thu, 22 Dec 2016 13:42:33 +0100
Subject: [PATCH] passes

---
 coolamqp/handler.py   |  3 ++-
 tests/test_cluster.py | 18 ++++++++++++++++++
 2 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/coolamqp/handler.py b/coolamqp/handler.py
index 7b07bff..58a8610 100644
--- a/coolamqp/handler.py
+++ b/coolamqp/handler.py
@@ -1,6 +1,7 @@
 #coding=UTF-8
 import threading
 import six.moves.queue as Queue
+import six
 import logging
 import collections
 import time
@@ -47,7 +48,7 @@ class ClusterHandlerThread(threading.Thread):
                 self.backend = None
 
             self.connect_id += 1
-            node = self.cluster.node_to_connect_to.next()
+            node = six.next(self.cluster.node_to_connect_to)
             logger.info('Connecting to %s', node)
 
             try:
diff --git a/tests/test_cluster.py b/tests/test_cluster.py
index 3b93354..a9ee173 100644
--- a/tests/test_cluster.py
+++ b/tests/test_cluster.py
@@ -15,6 +15,24 @@ class MyTestCase(unittest.TestCase):
     def tearDown(self):
         self.amqp.shutdown()
 
+    def test_nacknowledge(self):
+        myq = Queue('myqueue', exclusive=True)
+
+        self.amqp.consume(myq)
+        self.amqp.send(Message(b'what the fuck'), '', routing_key='myqueue')
+
+        p = self.amqp.drain(wait=10)
+        self.assertIsInstance(p, MessageReceived)
+        self.assertEquals(p.message.body, b'what the fuck')
+        p.message.nack()
+
+        p = self.amqp.drain(wait=10)
+        self.assertIsInstance(p, MessageReceived)
+        self.assertEquals(p.message.body, b'what the fuck')
+
+        self.amqp.delete_queue(myq)
+
+
     def test_send_and_receive(self):
         myq = Queue('myqueue', exclusive=True)
 
-- 
GitLab