Merge "Failure of test case"
diff --git a/tests/dmaap_adaptor/test_config.conf b/tests/dmaap_adaptor/test_config.conf
new file mode 100644
index 0000000..f72ba0a
--- /dev/null
+++ b/tests/dmaap_adaptor/test_config.conf
@@ -0,0 +1,22 @@
+# Copyright 2021 Xoriant Corporation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#------------------------------------------------------------------------------
+# This is a config file for the dmaap-adapter.
+#
+
+[default]
+log_file = dmaap.log
+log_level = error
+kafka_broker = kafka
+enable_assert =
diff --git a/tests/dmaap_adaptor/test_consumer.py b/tests/dmaap_adaptor/test_consumer.py
index 1fca142..fa7340d 100644
--- a/tests/dmaap_adaptor/test_consumer.py
+++ b/tests/dmaap_adaptor/test_consumer.py
@@ -62,32 +62,10 @@
def get_config_path():
project_path = get_path()
- config_path = os.path.join(project_path, "dmaapadapter/adapter/config/adapter.conf")
+ config_path = os.path.join(project_path, "tests/dmaap_adaptor/test_config.conf")
return config_path
-# test __init__ of TpoicConsumer
-@mock.patch("app_config.AppConfig.setLogger")
-@mock.patch(
- "argparse.ArgumentParser.parse_args",
- return_value=argparse.Namespace(config=get_config_path(), section="default"),
-)
-def test_init_consumer(parser, mock_setLogger):
- TopicConsumer.__init__(TopicConsumer)
- mock_setLogger.assert_called_with("dmaap.log", "error")
-
-
-# test __init__ of EventConsumer
-@mock.patch("app_config.AppConfig.setLogger")
-@mock.patch(
- "argparse.ArgumentParser.parse_args",
- return_value=argparse.Namespace(config=get_config_path(), section="default"),
-)
-def test_init_event(parser, mock_setLogger):
- EventConsumer.__init__(EventConsumer)
- mock_setLogger.assert_called_with("dmaap.log", "error")
-
-
@mock.patch("confluent_kafka.Consumer")
def test_consumeEvents(mock_consumer, prepareResponse, topic, resCode):
consumergroup = "test"
@@ -105,6 +83,28 @@
assert resMsg == prepareResponse.getResponseMsg()
+# test __init__()function of TpoicConsumer
+@mock.patch("app_config.AppConfig.setLogger")
+@mock.patch(
+ "argparse.ArgumentParser.parse_args",
+ return_value=argparse.Namespace(config=get_config_path(), section="default"),
+)
+def test_init_consumer(parser, mock_setLogger):
+ TopicConsumer.__init__(TopicConsumer)
+ mock_setLogger.assert_called_with("dmaap.log", "error")
+
+
+# test __init__() function of EventConsumer
+@mock.patch("app_config.AppConfig.setLogger")
+@mock.patch(
+ "argparse.ArgumentParser.parse_args",
+ return_value=argparse.Namespace(config=get_config_path(), section="default"),
+)
+def test_init_event(parser, mock_setLogger):
+ EventConsumer.__init__(EventConsumer)
+ mock_setLogger.assert_called_with("dmaap.log", "error")
+
+
# test consumeEvents for break
@mock.patch("confluent_kafka.Consumer")
def test_consumeEvents_break(mock_consumer, prepareResponse, topic, resCode):