@@ -97,19 +97,20 @@ def test_producer_async_queue_overfilled(self, mock):
97
97
def test_producer_sync_fail_on_error (self ):
98
98
error = FailedPayloadsError ('failure' )
99
99
with patch .object (KafkaClient , 'load_metadata_for_topics' ):
100
- with patch .object (KafkaClient , 'get_partition_ids_for_topic' , return_value = [0 , 1 ]):
101
- with patch .object (KafkaClient , '_send_broker_aware_request' , return_value = [error ]):
100
+ with patch .object (KafkaClient , 'ensure_topic_exists' ):
101
+ with patch .object (KafkaClient , 'get_partition_ids_for_topic' , return_value = [0 , 1 ]):
102
+ with patch .object (KafkaClient , '_send_broker_aware_request' , return_value = [error ]):
102
103
103
- client = KafkaClient (MagicMock ())
104
- producer = SimpleProducer (client , async = False , sync_fail_on_error = False )
104
+ client = KafkaClient (MagicMock ())
105
+ producer = SimpleProducer (client , async = False , sync_fail_on_error = False )
105
106
106
- # This should not raise
107
- (response ,) = producer .send_messages ('foobar' , b'test message' )
108
- self .assertEqual (response , error )
107
+ # This should not raise
108
+ (response ,) = producer .send_messages ('foobar' , b'test message' )
109
+ self .assertEqual (response , error )
109
110
110
- producer = SimpleProducer (client , async = False , sync_fail_on_error = True )
111
- with self .assertRaises (FailedPayloadsError ):
112
- producer .send_messages ('foobar' , b'test message' )
111
+ producer = SimpleProducer (client , async = False , sync_fail_on_error = True )
112
+ with self .assertRaises (FailedPayloadsError ):
113
+ producer .send_messages ('foobar' , b'test message' )
113
114
114
115
def test_cleanup_is_not_called_on_stopped_producer (self ):
115
116
producer = Producer (MagicMock (), async = True )
0 commit comments