A command-line-driven program that allows message exchange. Uses kafka as a message broker.
With one instance of the program, you can run the command:
python main.py send --channel test-topic --server “localhost:9092”
With a second instance of the same program
python main.py receive --channel test-topic --_from start --server “localhost:9092”
You can run both instances at the same time in different terminals to test producing and receiving the messages
Mock testing was applied since a third party service - kafka is involved and to dictate values so as to increase code coverage by touching all decision points of the code.
- Install coverage
pip install coverage
- Run this:
coverage run -m unittest
- To check code coverage:
coverage report