fix(integration-test): run the OAuth, notification and revocation tests without a GitHub account - #242
Merged
Conversation
…ts without a GitHub account The OAuth login, notification and token revocation tests signed in to github.com as a CI account with a password and a TOTP code, and failed or were skipped whenever GitHub answered with a two-factor prompt or a checkup page. They now build GithubAPIService and ConfigController with a mocked HTTP client and assert the requests the app sends: the OAuth code exchange and user lookup, a rejected state mismatch, the notification filter, and the token revocation. The HTML scraping helpers are removed, and the integration workflow no longer passes the CI_* secrets. Signed-off-by: Oleksander Piskun <oleksandr2088@icloud.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Following #241: the last four integration tests, the OAuth login, the two notification tests and the token revocation test, still signed in to github.com as a CI account with its password and a TOTP code. They failed or were skipped whenever GitHub answered that login with a two-factor prompt or a checkup page.
These tests run against a mocked GitHub
A new
MockedGithubApiTraitbuildsGithubAPIServiceandConfigControllerwith a mocked HTTP client, and resets the test user's settings and the OAuth app credentials around each test. The OAuth test checks the code exchange, the/userrequest and what gets stored, and that a mismatching state is rejected before any request is sent. The notification tests cover every branch of thegetNotifications()filter, the default two-weeksincewindow and the result limit. The revocation tests check the request sent when an OAuth token is disconnected, and that disconnecting a personal token does not call GitHub. The revocation test no longer has to run last, so it drops theZfrom its name.The login scraping is removed
GitHubHtml.phpandTotp.phpare deleted, and the integration workflow no longer passes theCI_*secrets.🤖 AI (if applicable)