summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDana Powers <dana.powers@rd.io>2015-12-04 17:15:49 -0800
committerDana Powers <dana.powers@rd.io>2015-12-04 17:15:49 -0800
commitfb024355f07735d148c035dfd51b279d1b8e59df (patch)
treed73466c9960d7a4386d023928e7872fe9e878bb4
parent7dec992a4ebd4d98008aaa1e65a32f46db1b064a (diff)
downloadkafka-python-async_producer_connect_errors.tar.gz
Cleanup new producer tests...async_producer_connect_errors
-rw-r--r--test/test_producer.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/test/test_producer.py b/test/test_producer.py
index 3c026e8..31282bf 100644
--- a/test/test_producer.py
+++ b/test/test_producer.py
@@ -111,19 +111,19 @@ class TestKafkaProducer(unittest.TestCase):
with self.assertRaises(FailedPayloadsError):
producer.send_messages('foobar', b'test message')
- def test_cleanup_stop_is_called_on_not_stopped_object(self):
+ def test_cleanup_is_not_called_on_stopped_producer(self):
producer = Producer(MagicMock(), async=True)
producer.stopped = True
- with patch('kafka.producer.base.Producer.stop') as base_stop:
+ with patch.object(producer, 'stop') as mocked_stop:
producer._cleanup_func(producer)
- self.assertEqual(base_stop.call_count, 0)
+ self.assertEqual(mocked_stop.call_count, 0)
- def test_cleanup_stop_is_not_called_on_stopped_object(self):
+ def test_cleanup_is_called_on_running_producer(self):
producer = Producer(MagicMock(), async=True)
producer.stopped = False
- with patch('kafka.producer.base.Producer.stop') as base_stop:
+ with patch.object(producer, 'stop') as mocked_stop:
producer._cleanup_func(producer)
- self.assertEqual(base_stop.call_count, 1)
+ self.assertEqual(mocked_stop.call_count, 1)
class TestKafkaProducerSendUpstream(unittest.TestCase):