def test_getTopicDetails(mocker, prepareResponse, topic, topic_list, resCode): mocker.patch('confluent_kafka.admin.AdminClient.list_topics', return_value=topic_list) TopicConsumer.getTopicDetails(TopicConsumer, prepareResponse, topic) resMsg = '{"name": "test1", "owner": "", "description": "", "readerAcl": {"enabled": true, "users": []}, "writerAcl": {"enabled": true, "users": []}}' assert resCode == prepareResponse.getResponseCode() assert resMsg == prepareResponse.getResponseMsg()
def topic_details(topic): topic == request.view_args['topic'] prepareResponse = PrepareResponse() topicConsumer = TopicConsumer() topicConsumer.getTopicDetails(prepareResponse, topic) response = app.response_class(response=prepareResponse.getResponseMsg(), status=prepareResponse.getResponseCode(), mimetype='application/json') return response