Facilities for Automated Testing of Web Application

I and @armse have set up the facilities for automated testing of web application, this includes:

* Saving and restoring database tables and data.
* Seeding database for testing purposes.
* Running tests.

This pull request also contains some bug fixes to the software to make testing possible.