test_well_known.py 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. # -*- coding: utf-8 -*-
  2. # Copyright 2018 New Vector
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. from synapse.rest.well_known import WellKnownResource
  16. from tests import unittest
  17. class WellKnownTests(unittest.HomeserverTestCase):
  18. def create_test_resource(self):
  19. # replace the JsonResource with a WellKnownResource
  20. return WellKnownResource(self.hs)
  21. def test_well_known(self):
  22. self.hs.config.public_baseurl = "https://tesths"
  23. self.hs.config.default_identity_server = "https://testis"
  24. channel = self.make_request(
  25. "GET", "/.well-known/matrix/client", shorthand=False
  26. )
  27. self.assertEqual(channel.code, 200)
  28. self.assertEqual(
  29. channel.json_body,
  30. {
  31. "m.homeserver": {"base_url": "https://tesths"},
  32. "m.identity_server": {"base_url": "https://testis"},
  33. },
  34. )