Added a test_cosmosim.py to cosmosim/tests.
Fixed up the login logic. Should work nicely with both scripts and interactive sessions.