Unit testing and code improvements

This pull request introduces unit testing of the code (with a coverage near
100% except for OpenNebula related code) and fixes some bugs that have been
spotted when running the tests. 

Also, Flake8 will be executed to ensure that the code adheres to PEP8.

These tests are integrated with travis-ci.