Use singletons for handlers.
parent
6a581821d7
commit
ef2e79f2d1
|
@ -23,7 +23,7 @@ import pymacaroons
|
||||||
from twisted.python.failure import Failure
|
from twisted.python.failure import Failure
|
||||||
from twisted.web._newclient import ResponseDone
|
from twisted.web._newclient import ResponseDone
|
||||||
|
|
||||||
from synapse.handlers.oidc_handler import OidcError, OidcHandler, OidcMappingProvider
|
from synapse.handlers.oidc_handler import OidcError, OidcMappingProvider
|
||||||
from synapse.handlers.sso import MappingException
|
from synapse.handlers.sso import MappingException
|
||||||
from synapse.types import UserID
|
from synapse.types import UserID
|
||||||
|
|
||||||
|
@ -155,13 +155,14 @@ class OidcHandlerTestCase(HomeserverTestCase):
|
||||||
config=config,
|
config=config,
|
||||||
)
|
)
|
||||||
|
|
||||||
self.handler = OidcHandler(hs)
|
self.handler = hs.get_oidc_handler()
|
||||||
|
sso_handler = hs.get_sso_handler()
|
||||||
# Mock the render error method.
|
# Mock the render error method.
|
||||||
self.render_error = Mock(return_value=None)
|
self.render_error = Mock(return_value=None)
|
||||||
self.handler._sso_handler.render_error = self.render_error
|
sso_handler.render_error = self.render_error
|
||||||
|
|
||||||
# Reduce the number of attempts when generating MXIDs.
|
# Reduce the number of attempts when generating MXIDs.
|
||||||
self.handler._sso_handler._MAP_USERNAME_RETRIES = 3
|
sso_handler._MAP_USERNAME_RETRIES = 3
|
||||||
|
|
||||||
return hs
|
return hs
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,6 @@
|
||||||
|
|
||||||
import attr
|
import attr
|
||||||
|
|
||||||
from synapse.handlers.saml_handler import SamlHandler
|
|
||||||
from synapse.handlers.sso import MappingException
|
from synapse.handlers.sso import MappingException
|
||||||
|
|
||||||
from tests.unittest import HomeserverTestCase
|
from tests.unittest import HomeserverTestCase
|
||||||
|
@ -63,15 +62,14 @@ class SamlHandlerTestCase(HomeserverTestCase):
|
||||||
config["saml2_config"] = saml_config
|
config["saml2_config"] = saml_config
|
||||||
|
|
||||||
hs = self.setup_test_homeserver(
|
hs = self.setup_test_homeserver(
|
||||||
http_client=self.http_client,
|
|
||||||
proxied_http_client=self.http_client,
|
|
||||||
config=config,
|
config=config,
|
||||||
)
|
)
|
||||||
|
|
||||||
self.handler = SamlHandler(hs)
|
self.handler = hs.get_saml_handler()
|
||||||
|
|
||||||
# Reduce the number of attempts when generating MXIDs.
|
# Reduce the number of attempts when generating MXIDs.
|
||||||
self.handler._sso_handler._MAP_USERNAME_RETRIES = 3
|
sso_handler = hs.get_sso_handler()
|
||||||
|
sso_handler._MAP_USERNAME_RETRIES = 3
|
||||||
|
|
||||||
return hs
|
return hs
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue