Skip to content

Commit

Permalink
removed unknown user test in remove submission and grouped error checks
Browse files Browse the repository at this point in the history
  • Loading branch information
OliverLok committed Dec 18, 2023
1 parent fb6ebab commit ee51a52
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 6 deletions.
1 change: 0 additions & 1 deletion api/submission/remove_submission.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ func HandleRemoveSubmission(request *RemoveSubmissionRequest) (*RemoveSubmission
response.FoundUser = true;

doesExist, err := db.RemoveSubmission(request.Assignment, request.TargetUser.Email, request.TargetSubmission);

if (err != nil) {
return nil, core.NewInternalError("-418", &request.APIRequestCourseUserContext, "Failed to remove the submission.").
Err(err).Add("user", request.TargetUser.Email).Add("submission", request.TargetSubmission);
Expand Down
4 changes: 0 additions & 4 deletions api/submission/remove_submission_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ func TestRemoveSubmission(test *testing.T) {
// Roles below grader, other, recent.
{model.RoleStudent, "[email protected]", "", false, false, true},
{model.RoleOther, "[email protected]", "", false, false, true},
{model.RoleUnknown, "[email protected]", "", false, false, true},

// Roles above grader, other, recent
{model.RoleAdmin, "[email protected]", "", true, true, false},
Expand All @@ -63,9 +62,6 @@ func TestRemoveSubmission(test *testing.T) {
response := core.SendTestAPIRequestFull(test, core.NewEndpoint(`submission/remove`), fields, nil, testCase.role);

if (!response.Success) {
if (testCase.role == model.RoleUnknown) {
continue;
}
if (testCase.permError) {
expectedLocator := "-306";
if (response.Locator != expectedLocator) {
Expand Down
1 change: 0 additions & 1 deletion db/submission_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ func (this *DBTests) DBTestRemoveSubmission(test *testing.T) {
assignment := MustGetTestAssignment();

isRemoved, err := RemoveSubmission(assignment, testCase.targetEmail, testCase.targetSubmission);

if (err != nil) {
test.Errorf("Case %d: Submission removal failed: '%v'.", i, err);
continue;
Expand Down

0 comments on commit ee51a52

Please sign in to comment.