edulinq / autograder-server

A server to automatically grading coding assignments.
MIT License
4 stars 5 forks source link

Improvements to the testing infrastructure. #93

Closed Lucas-Ellenberger closed 2 months ago

Lucas-Ellenberger commented 2 months ago

This PR improves the testing infrastructure in 3 ways.

The PR removes test user role ambiguity by prefixing all test data users with "server-" or "course-". This change ensures test cases are clearly testing server or course role permissions.

The SendTestAPIRequestFull() requires a user email is provided instead of a role. This allows test cases to easily test the API with any of our test users. If an email for a known user passed to SendTestAPIRequestFull(), the function automatically unpacks their password via the users name. Callers are still able to overwrite the user-email and user-pass that are sent to the API via the fields parameter. The default user for testing API requests is "course-admin@test.edulinq.org" which is used by SendTestAPIRequest.

Test cases are expanded to test role escalation for many CourseUserContext and AssignmentContext APIs. In cases where perm errors are expected, test cases include the expected locator to differentiate between invalid role escalation and invalid course role permissions.