summary refs log tree commit diff
path: root/tests/unittest.py
diff options
context:
space:
mode:
authorAndrew Morgan <1342360+anoadragon453@users.noreply.github.com>2022-08-19 17:17:10 +0100
committerGitHub <noreply@github.com>2022-08-19 16:17:10 +0000
commitf9f03426de338ae1879e174f63adf698bbfc3a4b (patch)
tree06baecf934226ff51b1f2fe91634a5fe8b762ffa /tests/unittest.py
parentRegister homeserver modules when creating test homeserver (#13558) (diff)
downloadsynapse-f9f03426de338ae1879e174f63adf698bbfc3a4b.tar.xz
Implement MSC3852: Expose `last_seen_user_agent` to users for their own devices; also expose to Admin API (#13549)
Diffstat (limited to 'tests/unittest.py')
-rw-r--r--tests/unittest.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/unittest.py b/tests/unittest.py
index bec4a3d023..975b0a23a7 100644
--- a/tests/unittest.py
+++ b/tests/unittest.py
@@ -677,14 +677,29 @@ class HomeserverTestCase(TestCase):
         username: str,
         password: str,
         device_id: Optional[str] = None,
+        additional_request_fields: Optional[Dict[str, str]] = None,
         custom_headers: Optional[Iterable[CustomHeaderType]] = None,
     ) -> str:
         """
         Log in a user, and get an access token. Requires the Login API be registered.
+
+        Args:
+            username: The localpart to assign to the new user.
+            password: The password to assign to the new user.
+            device_id: An optional device ID to assign to the new device created during
+                login.
+            additional_request_fields: A dictionary containing any additional /login
+                request fields and their values.
+            custom_headers: Custom HTTP headers and values to add to the /login request.
+
+        Returns:
+            The newly registered user's Matrix ID.
         """
         body = {"type": "m.login.password", "user": username, "password": password}
         if device_id:
             body["device_id"] = device_id
+        if additional_request_fields:
+            body.update(additional_request_fields)
 
         channel = self.make_request(
             "POST",