Create a PasswordProvider wrapper object (#8849)

The idea here is to abstract out all the conditional code which tests which
methods a given password provider has, to provide a consistent interface.
This commit is contained in:
Richard van der Hoff 2020-12-02 10:38:50 +00:00 committed by GitHub
parent edb3d3f827
commit d3ed93504b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 152 additions and 57 deletions

View file

@ -266,8 +266,9 @@ class PasswordAuthProviderTests(unittest.HomeserverTestCase):
# first delete should give a 401
channel = self._delete_device(tok1, "dev2")
self.assertEqual(channel.code, 401)
# there are no valid flows here!
self.assertEqual(channel.json_body["flows"], [])
# m.login.password UIA is permitted because the auth provider allows it,
# even though the localdb does not.
self.assertEqual(channel.json_body["flows"], [{"stages": ["m.login.password"]}])
session = channel.json_body["session"]
mock_password_provider.check_password.assert_not_called()