"""Run from the supplied project's lessons folder; data is temporary.""" from pathlib import Path import sys lesson_folder = Path(__file__).resolve().parent # A lesson filename must not shadow an installed package such as whitenoise. sys.path = [entry for entry in sys.path if Path(entry or ".").resolve() != lesson_folder] sys.path.insert(0, str(lesson_folder.parent)) from lab_support import start start() from workshops.models import Venue, Workshop, Reservation from django.test import Client, RequestFactory, override_settings # Lesson code: the shared lab is ready, with three fictional workshops. from django.contrib.auth import get_user_model client = Client() client.force_login(get_user_model().objects.get(username="alex")) print(client.get("/accounts/logout/").status_code) print(client.post("/accounts/logout/").status_code) print("_auth_user_id" in client.session)