test.helpers Class
Various test helpers for the server-side puavo-ticket tests. This should be the first module loaded in each *_test.js file because it setups the proper environment.
Item Index
Methods
- clearTestDatabase static
- deleteAndReset static
- fetchTestUser static
- insertTestTickets static
- loginAsUser static
Properties
Methods
deleteAndReset
-
tables
Delete all rows from given tables in series.
The rows must have an id sequence which will be restarted
Parameters:
-
tablesArrayTables names
fetchTestUser
()
Object
static
Fetch test user
Returns:
insertTestTickets
-
user
Create two test tickets
Parameters:
-
usermodels.server.UserUser who creates the tickets
Returns:
loginAsUser
-
userData
Create a stateful supertest request object (aka agent) which is logged into the puavo-ticket test server. It can access the puavo-ticket rest apis using the permissions it has.
Parameters:
-
userDataObject
Returns:
supertest agent instance wrapped in a promise
Properties
user
Object
Various Opinsys SSO user JWT tokens
user.manager
Object
Manager user from managertesting.opinsys.net organisation
user.teacher
Object
User with teacher permissions in testing.opinsys.fi organisation
user.teacher2
Object
Another user with teacher permissions in testing.opinsys.fi organisation
user.teacher3
Object
Third user with teacher permissions in testing.opinsys.fi organisation
