Add receiving college review to approvals

This commit is contained in:
biss committed 2026-12-01 10:17:26 +08:00
1 parent 784b5b76f2
commit 3ce77d9cd9
3 files changed
+27 -3

No files matched your search

@@ -1395,9 +1395,18 @@ public sealed class ApprovalsControllerTests
var page = Assert.IsType<StudentStatusChangePage>(Assert.IsType<OkObjectResult>(pageResponse.Result).Value);
Assert.Single(page.Items);
Assert.Equal(1, page.ActionableTotal);
var receivingPending = await new ApprovalsController(fixture.Db, new CollegeDataScope(college.Id)).GetPending(1, 20, CancellationToken.None, type: "StudentStatusChange");
var receivingPage = Assert.IsType<ApprovalPendingResult>(Assert.IsType<OkObjectResult>(receivingPending.Result).Value);
Assert.Equal("receivingCollege", Assert.Single(receivingPage.Items).Stage);
var finalPending = await new ApprovalsController(fixture.Db, new ManagerDataScope()).GetPending(1, 20, CancellationToken.None, type: "StudentStatusChange");
Assert.Empty(Assert.IsType<ApprovalPendingResult>(Assert.IsType<OkObjectResult>(finalPending.Result).Value).Items);
var wrongCollegePending = await new ApprovalsController(fixture.Db, new CollegeDataScope(fixture.CurrentCourse.CollegeId)).GetPending(1, 20, CancellationToken.None, type: "StudentStatusChange");
Assert.Empty(Assert.IsType<ApprovalPendingResult>(Assert.IsType<OkObjectResult>(wrongCollegePending.Result).Value).Items);
Assert.IsType<ForbidResult>(await originalCollege.ReviewReceivingCollege(change.Id, new StudentStatusReviewRequest(true, null), CancellationToken.None));
Assert.IsType<ConflictObjectResult>(await reviewer.Review(change.Id, new StudentStatusReviewRequest(true, null), CancellationToken.None));
Assert.IsType<NoContentResult>(await receivingCollege.ReviewReceivingCollege(change.Id, new StudentStatusReviewRequest(true, "同意接收"), CancellationToken.None));
finalPending = await new ApprovalsController(fixture.Db, new ManagerDataScope()).GetPending(1, 20, CancellationToken.None, type: "StudentStatusChange");
Assert.Equal("final", Assert.Single(Assert.IsType<ApprovalPendingResult>(Assert.IsType<OkObjectResult>(finalPending.Result).Value).Items).Stage);
Assert.IsType<NoContentResult>(await reviewer.Review(change.Id, new StudentStatusReviewRequest(true, null), CancellationToken.None));
Assert.Equal(target.Id, (await fixture.Db.Students.FindAsync(fixture.Student.Id))!.AdministrativeClassId);
Assert.Equal(college.Id, (await fixture.Db.StudentStatusChanges.SingleAsync()).ReceivingCollegeId);