Esempio n. 1
0
def test_listAllTopics(mocker, prepareResponse, topic_list, resCode):
    mocker.patch('confluent_kafka.admin.AdminClient.list_topics',
                 return_value=topic_list)
    TopicConsumer.listAllTopics(TopicConsumer, prepareResponse)
    resMsg = '{"topics": [{"topicName": "test1", "owner": "", "txenabled": false}, {"topicName": "test2", "owner": "", "txenabled": false}]}'
    assert resCode == prepareResponse.getResponseCode()
    assert resMsg == prepareResponse.getResponseMsg()
Esempio n. 2
0
def listall_topics():
    prepareResponse = PrepareResponse()
    topicConsumer = TopicConsumer()
    topicConsumer.listAllTopics(prepareResponse)
    response = app.response_class(response=prepareResponse.getResponseMsg(),
                                  status=prepareResponse.getResponseCode(),
                                  mimetype='application/json')
    return response