-
Notifications
You must be signed in to change notification settings - Fork 1k
move all record_event instances to send a request #13744
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -288,6 +288,7 @@ def test_post_validate_redirects( | |
pretend.call( | ||
tag=EventTag.Account.LoginSuccess, | ||
ip_address=pyramid_request.remote_addr, | ||
request=pyramid_request, | ||
additional={"two_factor_method": None, "two_factor_label": None}, | ||
) | ||
] | ||
|
@@ -351,6 +352,7 @@ def test_post_validate_no_redirects( | |
pretend.call( | ||
tag=EventTag.Account.LoginSuccess, | ||
ip_address=pyramid_request.remote_addr, | ||
request=pyramid_request, | ||
additional={"two_factor_method": None, "two_factor_label": None}, | ||
) | ||
] | ||
|
@@ -714,6 +716,7 @@ def test_totp_auth( | |
pretend.call( | ||
tag=EventTag.Account.LoginSuccess, | ||
ip_address=pyramid_request.remote_addr, | ||
request=pyramid_request, | ||
additional={"two_factor_method": "totp", "two_factor_label": "totp"}, | ||
) | ||
] | ||
|
@@ -1157,6 +1160,7 @@ def test_recovery_code_auth(self, monkeypatch, pyramid_request, redirect_url): | |
pretend.call( | ||
tag=EventTag.Account.LoginSuccess, | ||
ip_address=pyramid_request.remote_addr, | ||
request=pyramid_request, | ||
additional={ | ||
"two_factor_method": "recovery-code", | ||
"two_factor_label": None, | ||
|
@@ -1165,6 +1169,7 @@ def test_recovery_code_auth(self, monkeypatch, pyramid_request, redirect_url): | |
pretend.call( | ||
tag=EventTag.Account.RecoveryCodesUsed, | ||
ip_address=pyramid_request.remote_addr, | ||
request=pyramid_request, | ||
), | ||
] | ||
assert pyramid_request.session.flash.calls == [ | ||
|
@@ -1411,11 +1416,13 @@ def _find_service(service=None, name=None, context=None): | |
pretend.call( | ||
tag=EventTag.Account.AccountCreate, | ||
ip_address=db_request.remote_addr, | ||
request=db_request, | ||
additional={"email": "[email protected]"}, | ||
), | ||
pretend.call( | ||
tag=EventTag.Account.LoginSuccess, | ||
ip_address=db_request.remote_addr, | ||
request=db_request, | ||
additional={"two_factor_method": None, "two_factor_label": None}, | ||
), | ||
] | ||
|
@@ -1524,6 +1531,7 @@ def test_request_password_reset( | |
pretend.call( | ||
tag=EventTag.Account.PasswordResetRequest, | ||
ip_address=pyramid_request.remote_addr, | ||
request=pyramid_request, | ||
) | ||
] | ||
|
||
|
@@ -1588,6 +1596,7 @@ def test_request_password_reset_with_email( | |
pretend.call( | ||
tag=EventTag.Account.PasswordResetRequest, | ||
ip_address=pyramid_request.remote_addr, | ||
request=pyramid_request, | ||
) | ||
] | ||
assert user_service.ratelimiters["password.reset"].test.calls == [ | ||
|
@@ -1663,6 +1672,7 @@ def test_request_password_reset_with_non_primary_email( | |
pretend.call( | ||
tag=EventTag.Account.PasswordResetRequest, | ||
ip_address=pyramid_request.remote_addr, | ||
request=pyramid_request, | ||
) | ||
] | ||
assert user_service.ratelimiters["password.reset"].test.calls == [ | ||
|
@@ -1762,6 +1772,7 @@ def test_password_reset_prohibited( | |
pretend.call( | ||
tag=EventTag.Account.PasswordResetAttempt, | ||
ip_address=pyramid_request.remote_addr, | ||
request=pyramid_request, | ||
) | ||
] | ||
|
||
|
@@ -3569,6 +3580,7 @@ def test_add_pending_github_oidc_publisher(self, monkeypatch, db_request): | |
pretend.call( | ||
tag=EventTag.Account.PendingOIDCPublisherAdded, | ||
ip_address="1.2.3.4", | ||
request=db_request, | ||
additional={ | ||
"project": "some-project-name", | ||
"publisher": pending_publisher.publisher_name, | ||
|
@@ -3802,6 +3814,7 @@ def test_delete_pending_oidc_publisher(self, monkeypatch, db_request): | |
pretend.call( | ||
tag=EventTag.Account.PendingOIDCPublisherRemoved, | ||
ip_address="1.2.3.4", | ||
request=db_request, | ||
additional={ | ||
"project": "some-project-name", | ||
"publisher": "GitHub", | ||
|
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -308,10 +308,11 @@ class FakeUser: | |
def __init__(self): | ||
self.events = [] | ||
|
||
def record_event(self, tag, ip_address, additional): | ||
def record_event(self, tag, ip_address, request=None, additional=None): | ||
self.events.append( | ||
{ | ||
"ip_address": ip_address, | ||
"request": request, | ||
"tag": tag, | ||
"additional": additional, | ||
} | ||
|
@@ -382,6 +383,7 @@ def get_user(self, user_id): | |
assert user_service.user.events == [ | ||
{ | ||
"tag": "account:email:sent", | ||
"request": request, | ||
"ip_address": request.remote_addr, | ||
"additional": { | ||
"from_": "[email protected]", | ||
|
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.