summary refs log tree commit diff
path: root/tests/unittest.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2019-06-11 17:25:16 +0100
committerErik Johnston <erik@matrix.org>2019-06-11 17:25:16 +0100
commit7e68691ce947cac0a470d8b8df3332958686ccc1 (patch)
tree75987c8c6556edf9d14dd5878c1c63a5fae2e5fb /tests/unittest.py
parentMerge branch 'release-v1.0.0' of github.com:matrix-org/synapse into develop (diff)
parent1.0.0 (diff)
downloadsynapse-7e68691ce947cac0a470d8b8df3332958686ccc1.tar.xz
Merge branch 'master' of github.com:matrix-org/synapse into develop
Diffstat (limited to 'tests/unittest.py')
-rw-r--r--tests/unittest.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/unittest.py b/tests/unittest.py
index 26204470b1..7dbb64af59 100644
--- a/tests/unittest.py
+++ b/tests/unittest.py
@@ -441,3 +441,15 @@ class HomeserverTestCase(TestCase):
 
         access_token = channel.json_body["access_token"]
         return access_token
+
+    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}
+
+        request, channel = self.make_request(
+            "POST", "/_matrix/client/r0/login", json.dumps(body).encode('utf8')
+        )
+        self.render(request)
+        self.assertEqual(channel.code, 403, channel.result)