Testing a simple Redis messaging server with Python
We need a few packages installed globally for testing.
sudo pip install coverage noseThen we need to set up the environment ready to run.
virtualenv env
source ./env/bin/activate
pip install -r requirements.txtTo exit the virtualenv use deactivate
To use Redis needs to be running (as yet no error checking if the app is started without redis):
# Install package for redis server (e.g. brew install redis)
redis-serverSimply:
python langapp.pyTo send a new message:
curl http://127.0.0.1:8888/in/ -d 'your message'To query a message by id:
curl http://127.0.0.1:8888/messages/<int:id>/To run all the tests:
nosetests -svIf the dependencies for the project change, update the requirements.
pip freeze > requirements.txt