Use default_config method.

pull/8800/head
Patrick Cloke 2020-12-01 12:56:01 -05:00
parent ef2e79f2d1
commit 1ab9ad13e2
2 changed files with 16 additions and 13 deletions

View File

@ -127,13 +127,8 @@ async def get_json(url):
class OidcHandlerTestCase(HomeserverTestCase): class OidcHandlerTestCase(HomeserverTestCase):
def make_homeserver(self, reactor, clock): def default_config(self):
config = super().default_config()
self.http_client = Mock(spec=["get_json"])
self.http_client.get_json.side_effect = get_json
self.http_client.user_agent = "Synapse Test"
config = self.default_config()
config["public_baseurl"] = BASE_URL config["public_baseurl"] = BASE_URL
oidc_config = { oidc_config = {
"enabled": True, "enabled": True,
@ -149,10 +144,17 @@ class OidcHandlerTestCase(HomeserverTestCase):
oidc_config.update(config.get("oidc_config", {})) oidc_config.update(config.get("oidc_config", {}))
config["oidc_config"] = oidc_config config["oidc_config"] = oidc_config
return config
def make_homeserver(self, reactor, clock):
self.http_client = Mock(spec=["get_json"])
self.http_client.get_json.side_effect = get_json
self.http_client.user_agent = "Synapse Test"
hs = self.setup_test_homeserver( hs = self.setup_test_homeserver(
http_client=self.http_client, http_client=self.http_client,
proxied_http_client=self.http_client, proxied_http_client=self.http_client,
config=config,
) )
self.handler = hs.get_oidc_handler() self.handler = hs.get_oidc_handler()

View File

@ -50,8 +50,8 @@ class TestMappingProvider:
class SamlHandlerTestCase(HomeserverTestCase): class SamlHandlerTestCase(HomeserverTestCase):
def make_homeserver(self, reactor, clock): def default_config(self):
config = self.default_config() config = super().default_config()
config["public_baseurl"] = BASE_URL config["public_baseurl"] = BASE_URL
saml_config = { saml_config = {
"sp_config": {"metadata": {}}, "sp_config": {"metadata": {}},
@ -61,9 +61,10 @@ class SamlHandlerTestCase(HomeserverTestCase):
} }
config["saml2_config"] = saml_config config["saml2_config"] = saml_config
hs = self.setup_test_homeserver( return config
config=config,
) def make_homeserver(self, reactor, clock):
hs = self.setup_test_homeserver()
self.handler = hs.get_saml_handler() self.handler = hs.get_saml_handler()