diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/rest/client/test_account.py | 11 | ||||
-rw-r--r-- | tests/storage/test_cleanup_extrems.py | 16 | ||||
-rw-r--r-- | tests/unittest.py | 27 |
3 files changed, 27 insertions, 27 deletions
diff --git a/tests/rest/client/test_account.py b/tests/rest/client/test_account.py index 27946febff..e00b5c171c 100644 --- a/tests/rest/client/test_account.py +++ b/tests/rest/client/test_account.py @@ -89,6 +89,17 @@ class PasswordResetTestCase(unittest.HomeserverTestCase): self.store = hs.get_datastores().main self.submit_token_resource = PasswordResetSubmitTokenResource(hs) + def attempt_wrong_password_login(self, username: str, password: str) -> None: + """Attempts to login as the user with the given password, asserting + that the attempt *fails*. + """ + body = {"type": "m.login.password", "user": username, "password": password} + + channel = self.make_request( + "POST", "/_matrix/client/r0/login", json.dumps(body).encode("utf8") + ) + self.assertEqual(channel.code, 403, channel.result) + def test_basic_password_reset(self) -> None: """Test basic password reset flow""" old_password = "monkey" diff --git a/tests/storage/test_cleanup_extrems.py b/tests/storage/test_cleanup_extrems.py index ce89c96912..fe91c3fed8 100644 --- a/tests/storage/test_cleanup_extrems.py +++ b/tests/storage/test_cleanup_extrems.py @@ -68,6 +68,22 @@ class CleanupExtremBackgroundUpdateStoreTestCase(HomeserverTestCase): self.wait_for_background_updates() + def add_extremity(self, room_id: str, event_id: str) -> None: + """ + Add the given event as an extremity to the room. + """ + self.get_success( + self.hs.get_datastores().main.db_pool.simple_insert( + table="event_forward_extremities", + values={"room_id": room_id, "event_id": event_id}, + desc="test_add_extremity", + ) + ) + + self.hs.get_datastores().main.get_latest_event_ids_in_room.invalidate( + (room_id,) + ) + def test_soft_failed_extremities_handled_correctly(self): """Test that extremities are correctly calculated in the presence of soft failed events. diff --git a/tests/unittest.py b/tests/unittest.py index 326895f4c9..cbe215ee83 100644 --- a/tests/unittest.py +++ b/tests/unittest.py @@ -717,33 +717,6 @@ class HomeserverTestCase(TestCase): return event.event_id - def add_extremity(self, room_id, event_id): - """ - Add the given event as an extremity to the room. - """ - self.get_success( - self.hs.get_datastores().main.db_pool.simple_insert( - table="event_forward_extremities", - values={"room_id": room_id, "event_id": event_id}, - desc="test_add_extremity", - ) - ) - - self.hs.get_datastores().main.get_latest_event_ids_in_room.invalidate( - (room_id,) - ) - - def attempt_wrong_password_login(self, username, password): - """Attempts to login as the user with the given password, asserting - that the attempt *fails*. - """ - body = {"type": "m.login.password", "user": username, "password": password} - - channel = self.make_request( - "POST", "/_matrix/client/r0/login", json.dumps(body).encode("utf8") - ) - self.assertEqual(channel.code, 403, channel.result) - def inject_room_member(self, room: str, user: str, membership: Membership) -> None: """ Inject a membership event into a room. |