summaryrefslogtreecommitdiff
path: root/test/test_producer.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_producer.py')
-rw-r--r--test/test_producer.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/test_producer.py b/test/test_producer.py
index caf8fe3..f6b3d6a 100644
--- a/test/test_producer.py
+++ b/test/test_producer.py
@@ -7,6 +7,7 @@ from . import unittest
from kafka.producer.base import Producer
+
class TestKafkaProducer(unittest.TestCase):
def test_producer_message_types(self):
@@ -25,3 +26,17 @@ class TestKafkaProducer(unittest.TestCase):
# This should not raise an exception
producer.send_messages(topic, partition, m)
+ def test_topic_message_types(self):
+ from kafka.producer.simple import SimpleProducer
+
+ client = MagicMock()
+
+ def partitions(topic):
+ return [0, 1]
+
+ client.get_partition_ids_for_topic = partitions
+
+ producer = SimpleProducer(client, random_start=False)
+ topic = b"test-topic"
+ producer.send_messages(topic, b'hi')
+ assert client.send_produce_request.called