Skip to content

test: say what the run membership case in RemoveStudentRunControllerTest asserts - #346

Open
Isaries wants to merge 1 commit into
WISE-Community:developfrom
Isaries:test/remove-student-run-membership-name
Open

test: say what the run membership case in RemoveStudentRunControllerTest asserts#346
Isaries wants to merge 1 commit into
WISE-Community:developfrom
Isaries:test/remove-student-run-membership-name

Conversation

@Isaries

@Isaries Isaries commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #333, which is merged. No production code changes.

removeStudent_StudentNotInRun_RemoveStudentFromRun does not set up the state its name describes. APIControllerTest.createWorkgroups() builds

workgroup2 = createWorkgroup(workgroup2Id, run1, run1Period1, student2)

so student2 is a member of a workgroup belonging to run1. What the fixture does model is the state the doc comment names as the reason not to reject: still in a workgroup, no longer in a period, since run1Period1's own member list holds only student1. Renamed to removeStudent_StudentInWorkgroupButNotInPeriod_RemoveStudentFromRun.

The doc comment also claimed the test showed that both steps of removeStudentFromRun are scoped to the run. studentService is mocked here, so nothing about that is exercised and the test would pass identically for a fully enrolled student. What it does assert is that this controller adds no run membership check of its own, which is a deliberate decision worth keeping locked in, and the comment now says that and nothing more.

The comment is explicit that the role check is the only thing asked about the target user, and points at removeStudent_NoWritePermission_ThrowAccessDenied for the write-permission half, so that "the only check" cannot be read as the endpoint being unguarded against a teacher acting on someone else's run.

The test was named removeStudent_StudentNotInRun_RemoveStudentFromRun, but
APIControllerTest.createWorkgroups builds workgroup2 under run1 with student2 as
its member, so student2 is in the run. What the fixture does model is the state
the doc comment names as the reason not to reject: in a workgroup, no longer in
the period, since run1Period1 holds only student1.

The comment also claimed the test showed both steps of removeStudentFromRun are
scoped to the run. studentService is mocked here, so nothing about that is
exercised and the test would pass identically for a fully enrolled student. It
asserts the controller's delegation and the comment now says so.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant