Many OAuth integration tests prove that a user can complete the happy path. They create an account, receive an email, follow a link, and assert success.
That is necessary, but it leaves the most important security question mostly untested: does the system reliably deny the wrong email, the late email, and the email from another test run?
An inbox used by a test is an untrusted input. Treating it as trusted makes a green test less meaningful. A safer approach is to design the deny path first, then add the success assertion around it. This is especially useful when teams generate disposable email addresses for repeatable authentication checks.
Why the deny path is the real OAuth test
The callback can look correct while accepting the wrong message.…