Simplify test code

This change removes the code that replaces the `ensureAuthenticated` function for testing. Tests now first log the user in by posting the username and password, and the session cookie is used for subsequent requests.