'Ensure that the user is logged in and out appropriately at the beginning
and end of the current test.'

@contextmanager
def _logged_in_session(self, staff=False):

    self.logout_page.visit()
    try:
        if staff:
            auto_auth(self.browser, 'STAFF_TESTER', 'staff101@example.com', True, self.course_id)
        else:
            auto_auth(self.browser, self.USERNAME, self.EMAIL, False, self.course_id)
        (yield)
    finally:
        self.logout_page.visit()
