DASSL / ClassDB

An open-source system to let students experiment with relational data
https://dassl.github.io/ClassDB/
Other
7 stars 2 forks source link

Add privilege and userMgmt function tests #108

Closed afig closed 7 years ago

afig commented 7 years ago

Two main things are accomplished with this PR: Refactoring of the existing tests for userMgmt functions (old prepareClassDB functions), and the addition of tests for effective user privileges.

testAddUserMgmt.sql:

These could more or less be considered unit tests. Tests for most of the functions in addUserMgmt.sql are present. (Only resetUserPassword and dropAllStudents() are not tested) Most of the functionality is automatically tested, however, it is not possible to test actual login capabilities or passwords from a single script. After running testAddUserMgmt.sql, the tester is asked to attempt to log into the database with several roles. Instructions are located in testAddUserMgmtREADME.txt.

Privilege tests:

These tests are split into separate files for each type of user, and for statements should succeed, and those that should fail. Unfortunately, each script must be run as a separate user, which means that roles have to be switched a total of 8-9 times. It might be possible to automate the first 4 scripts using a batch file. However, the results of the remaining scripts need to be examined to make sure no statements succeeded. Instructions are located in testPrivilegesREADME.txt.

Through the testing of these tests, I discovered several issues that I have already logged: #104, #105, #106, and #107. Otherwise, the tests have shown that most of our code is working as planned.

Fixes #2