Added a test login method to accomodate unittest

Occasionally it is not possible to post to /login to login in unittest.
Therefore, a test_login_user and test_logout_user method is added so we
can log users in in tests.

I realize I need tests.. but I don't know how to write them just yet.