This repository has been archived by the owner on Apr 26, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Add final type hint to tests.unittest. #15072
Merged
Merged
Changes from 1 commit
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
66db8a6
Add final type hint to tests.unittest.
clokep 0208946
Remove a very broken test.
clokep 3c9491e
Fix-up errors in tests/handlers.
clokep 8aead86
Fix-up errors in tests/replication.
clokep b8127a5
Fix-up errors in tests/rest.
clokep 7a699ff
Fix-up errors in tests/federation.
clokep f9f0561
Fix-up errors in tests/push.
clokep 00127cd
Fix-up errors in tests/storage.
clokep 898d1d1
Finish up.
clokep abd1e91
Newsfragment
clokep 0b4632d
Revert "Remove a very broken test."
clokep bd95154
Adapt test.
clokep 0dc1a35
Lint
clokep 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 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 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 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 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 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 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 |
---|---|---|
|
@@ -151,7 +151,7 @@ def test_POST_disabled_registration(self) -> None: | |
self.assertEqual(channel.json_body["errcode"], "M_FORBIDDEN") | ||
|
||
def test_POST_guest_registration(self) -> None: | ||
self.hs.config.key.macaroon_secret_key = "test" | ||
self.hs.config.key.macaroon_secret_key = b"test" | ||
self.hs.config.registration.allow_guest_access = True | ||
|
||
channel = self.make_request(b"POST", self.url + b"?kind=guest", b"{}") | ||
|
@@ -1166,12 +1166,15 @@ def test_background_job(self) -> None: | |
""" | ||
user_id = self.register_user("kermit_delta", "user") | ||
|
||
self.hs.config.account_validity.startup_job_max_delta = self.max_delta | ||
self.hs.config.account_validity.account_validity_startup_job_max_delta = ( | ||
self.max_delta | ||
) | ||
Comment on lines
-1169
to
+1171
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Was this just broken before? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think so. (Which makes me wonder why we care...) |
||
|
||
now_ms = self.hs.get_clock().time_msec() | ||
self.get_success(self.store._set_expiration_date_when_missing()) | ||
|
||
res = self.get_success(self.store.get_expiration_ts_for_user(user_id)) | ||
assert res is not None | ||
|
||
self.assertGreaterEqual(res, now_ms + self.validity_period - self.max_delta) | ||
self.assertLessEqual(res, now_ms + self.validity_period) | ||
|
This file contains 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 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 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 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
General comment: how well does mypy detect out-of-date mocks like these? If we changed the signature of check_username in
synapse
but not intests
, would we notice it here?(Not worth blocking this PR on)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems to sometimes pick-up that the signature is wrong, I'm not sure how consistently it does it though.
(Note that this isn't a mock though.)