diff options
author | Richard van der Hoff <1389908+richvdh@users.noreply.github.com> | 2020-12-15 20:56:10 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-15 20:56:10 +0000 |
commit | 01333681bc3db22541b49c194f5121a5415731c6 (patch) | |
tree | 981ef761d171545ec4d31f078bce355d819a4085 /tests/handlers/test_oidc.py | |
parent | Fix handling of stream tokens for push. (#8943) (diff) | |
download | synapse-01333681bc3db22541b49c194f5121a5415731c6.tar.xz |
Preparatory refactoring of the SamlHandlerTestCase (#8938)
* move simple_async_mock to test_utils ... so that it can be re-used * Remove references to `SamlHandler._map_saml_response_to_user` from tests This method is going away, so we can no longer use it as a test point. Instead, factor out a higher-level method which takes a SAML object, and verify correct behaviour by mocking out `AuthHandler.complete_sso_login`. * changelog
Diffstat (limited to 'tests/handlers/test_oidc.py')
-rw-r--r-- | tests/handlers/test_oidc.py | 12 |
1 files changed, 1 insertions, 11 deletions
diff --git a/tests/handlers/test_oidc.py b/tests/handlers/test_oidc.py index 9878527bab..464e569ac8 100644 --- a/tests/handlers/test_oidc.py +++ b/tests/handlers/test_oidc.py @@ -23,7 +23,7 @@ from synapse.handlers.oidc_handler import OidcError, OidcMappingProvider from synapse.handlers.sso import MappingException from synapse.types import UserID -from tests.test_utils import FakeResponse +from tests.test_utils import FakeResponse, simple_async_mock from tests.unittest import HomeserverTestCase, override_config # These are a few constants that are used as config parameters in the tests. @@ -82,16 +82,6 @@ class TestMappingProviderFailures(TestMappingProvider): } -def simple_async_mock(return_value=None, raises=None) -> Mock: - # AsyncMock is not available in python3.5, this mimics part of its behaviour - async def cb(*args, **kwargs): - if raises: - raise raises - return return_value - - return Mock(side_effect=cb) - - async def get_json(url): # Mock get_json calls to handle jwks & oidc discovery endpoints if url == WELL_KNOWN: |