Skip to content

Added unit tests for Contact verification codes

Daniel Wysocki requested to merge daniel.wysocki/gracedb-server:master into master

This adds 2 new unit tests (multiplied by the 4 contact method options) for the alerts.models.Contact verification process.

The first set of tests, test_verification_process_*, verifies a mock user using RequestVerificationCodeView and VerifyContactView, checking for the correct redirects and verification statuses along the way.

The second set of tests, test_contact_already_verified_*, creates an already-verified mock user, and checks that RequestVerificationCodeView performs the correct redirect, and that no verification code was sent.

unittests.mock.patch was used to replace all calls to Twilio with mock calls, avoiding the need to send actual calls and texts.

Note that nothing special was done to handle Email, which seems to fail quietly. This may need to be expanded upon.

Merge request reports

Loading