Move single-use methods out of TestCase (#12348)

These methods are only used by a single testcase, so they shouldn't be
cluttering up the base `TestCase` class.
This commit is contained in:
Richard van der Hoff 2022-04-01 13:48:08 +01:00 committed by GitHub
parent f871222880
commit b7762b0c9f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 28 additions and 27 deletions

View file

@ -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"