Converted session unit tests to py.test fixtures

This also required a few fixes to the session handling.
Extended entity_creator and app_creator fixtures
Small simplification in the views base class.