HackIllinois / api

The Official API supporting HackIllinois
https://api.hackillinois.org
Other
23 stars 51 forks source link

Add E2E tests for user qr to event checkin connection #525

Closed Timothy-Gonzalez closed 1 month ago

Timothy-Gonzalez commented 1 year ago

This test encompasses bothGET /user/qr/ and POST /event/staff/checkin/, to verify that they always work together.

Timothy-Gonzalez commented 1 year ago

Decided against having an env variable that would never be used anyways (humans are lazy).

Instead, we now have three tests:

  1. GetUserQR which verifies a token does, and will, expire in a reasonable time.
  2. Pre-existing TestStaffCheckinBadUserTokenExpiredToken which verifies a expired token cannot be used to check in (and there is also a test for invalid params, malformed token, so every other fail case should be covered)
  3. TestStaffCheckinFromGetUserQR which verifies that the full workflow works, by fetching a qr and then using it to checkin

Together, this validates that a generated token will expire (1), an invalid token will not work to checkin (2), and that a valid token is generated normally and will work to checkin (3).

This may be more complicated than waiting 20 seconds, but we'd never want to wait that long anyways, and a test that never gets run is as good as a test that doesn't exist.

Anyways, should be good now.