a573ed78a4
- Redesigned the supervisor overview page to include a header card with supervisor details and trainee statistics. - Implemented a tabbed interface for viewing trainees and their recent attempts. - Improved the trainee detail page with a profile card and a table for displaying attempt history. - Added a new view for supervisors to provide feedback on case collections, including outstanding feedback items and previous conversations. - Updated URL routing to support new feedback functionality. - Enhanced backend logic to ensure proper sharing permissions for exam attempts and case collections. - Added comprehensive tests for supervisor access to trainee data and feedback functionalities.
39 lines
1.5 KiB
Python
39 lines
1.5 KiB
Python
from django.test import TestCase
|
|
|
|
import pytest
|
|
from django.urls import reverse
|
|
|
|
from bs4 import BeautifulSoup
|
|
|
|
from generic.models import ExamCollection
|
|
|
|
import datetime
|
|
|
|
class TestExamCollections:
|
|
def test_list_url(self, db, client):
|
|
from django.contrib.auth.models import User
|
|
user = User.objects.create_user(username="test_list_user", password="password")
|
|
client.force_login(user)
|
|
# Test with no content
|
|
response = client.get(reverse("generic:examcollection_list"))
|
|
assert response.status_code == 200
|
|
soup = BeautifulSoup(response.content, "html.parser")
|
|
assert "No exam collections yet" in soup.text
|
|
|
|
# No content yet so this should fail
|
|
response = client.get(reverse("generic:examcollection_detail", args=( 1, )))
|
|
assert response.status_code == 404
|
|
|
|
collection = ExamCollection.objects.create(name="test collection", date=datetime.date.today())
|
|
collection.author.add(user)
|
|
|
|
response = client.get(reverse("generic:examcollection_list"))
|
|
assert response.status_code == 200
|
|
soup = BeautifulSoup(response.content, "html.parser")
|
|
assert collection.name in soup.find("a", class_="stretched-link").text
|
|
|
|
|
|
response = client.get(reverse("generic:examcollection_detail", args=( collection.pk, )))
|
|
assert response.status_code == 200
|
|
soup = BeautifulSoup(response.content, "html.parser")
|
|
assert collection.name in soup.find("h1").text |