Integration tests

Initial integration tests and fixes on issues that they uncovered.

Resolves #87. Resolves #69. 

The tests currently only test login scenarios. The setup for message testing is not there yet.