def test_add_listener(self):
    self.patch_object(self.c, '_validate_not_existing_listener', name='mock__validate_not_existing_listener')
    self.patch_object(self.c, '_get_address', name='mock__get_address')
    self.mock__get_address.return_value = '1.2.3.4'
    self.patch_object(self.c, 'add_listener_spec', name='mock_add_listener_spec')
    self.c.add_listener('udp', 1024, space='default', cidr='cidr')
    self.mock__validate_not_existing_listener.assert_called_once_with('udp', 1024)
    self.mock__get_address('default', 'cidr')
    self.mock_add_listener_spec.assert_called_once_with('udp', 1024, '1.2.3.4', reply_size=1024)
def test_add_listener(self):
    self.patch_object(self.c, '_validate_not_existing_listener', name='mock__validate_not_existing_listener')
    self.patch_object(self.c, '_get_address', name='mock__get_address')
    self.mock__get_address.return_value = '1.2.3.4'
    self.patch_object(self.c, 'add_listener_spec', name='mock_add_listener_spec')
    self.c.add_listener('udp', 1024, space='default', cidr='cidr')
    self.mock__validate_not_existing_listener.assert_called_once_with('udp', 1024)
    self.mock__get_address('default', 'cidr')
    self.mock_add_listener_spec.assert_called_once_with('udp', 1024, '1.2.3.4', reply_size=1024)