diff --git a/tests/rest/media/v1/test_url_preview.py b/tests/rest/media/v1/test_url_preview.py index dcde20651f9a..88754ef09107 100644 --- a/tests/rest/media/v1/test_url_preview.py +++ b/tests/rest/media/v1/test_url_preview.py @@ -162,7 +162,7 @@ def test_cache_returns_correct_type(self) -> None: channel = self.make_request( "GET", - "preview_url?url=http://matrix.org", + "v3/preview_url?url=http://matrix.org", shorthand=False, await_result=False, ) @@ -186,7 +186,7 @@ def test_cache_returns_correct_type(self) -> None: # Check the cache returns the correct response channel = self.make_request( - "GET", "preview_url?url=http://matrix.org", shorthand=False + "GET", "v3/preview_url?url=http://matrix.org", shorthand=False ) # Check the cache response has the same content @@ -202,7 +202,7 @@ def test_cache_returns_correct_type(self) -> None: # Check the database cache returns the correct response channel = self.make_request( - "GET", "preview_url?url=http://matrix.org", shorthand=False + "GET", "v3/preview_url?url=http://matrix.org", shorthand=False ) # Check the cache response has the same content @@ -224,7 +224,7 @@ def test_non_ascii_preview_httpequiv(self) -> None: channel = self.make_request( "GET", - "preview_url?url=http://matrix.org", + "v3/preview_url?url=http://matrix.org", shorthand=False, await_result=False, ) @@ -254,7 +254,7 @@ def test_video_rejected(self) -> None: channel = self.make_request( "GET", - "preview_url?url=http://matrix.org", + "v3/preview_url?url=http://matrix.org", shorthand=False, await_result=False, ) @@ -290,7 +290,7 @@ def test_audio_rejected(self) -> None: channel = self.make_request( "GET", - "preview_url?url=http://matrix.org", + "v3/preview_url?url=http://matrix.org", shorthand=False, await_result=False, ) @@ -331,7 +331,7 @@ def test_non_ascii_preview_content_type(self) -> None: channel = self.make_request( "GET", - "preview_url?url=http://matrix.org", + "v3/preview_url?url=http://matrix.org", shorthand=False, await_result=False, ) @@ -366,7 +366,7 @@ def test_overlong_title(self) -> None: channel = self.make_request( "GET", - "preview_url?url=http://matrix.org", + "v3/preview_url?url=http://matrix.org", shorthand=False, await_result=False, ) @@ -399,7 +399,7 @@ def test_ipaddr(self) -> None: channel = self.make_request( "GET", - "preview_url?url=http://example.com", + "v3/preview_url?url=http://example.com", shorthand=False, await_result=False, ) @@ -428,7 +428,7 @@ def test_blacklisted_ip_specific(self) -> None: self.lookups["example.com"] = [(IPv4Address, "192.168.1.1")] channel = self.make_request( - "GET", "preview_url?url=http://example.com", shorthand=False + "GET", "v3/preview_url?url=http://example.com", shorthand=False ) # No requests made. @@ -449,7 +449,7 @@ def test_blacklisted_ip_range(self) -> None: self.lookups["example.com"] = [(IPv4Address, "1.1.1.2")] channel = self.make_request( - "GET", "preview_url?url=http://example.com", shorthand=False + "GET", "v3/preview_url?url=http://example.com", shorthand=False ) self.assertEqual(channel.code, 502) @@ -466,7 +466,7 @@ def test_blacklisted_ip_specific_direct(self) -> None: Blacklisted IP addresses, accessed directly, are not spidered. """ channel = self.make_request( - "GET", "preview_url?url=http://192.168.1.1", shorthand=False + "GET", "v3/preview_url?url=http://192.168.1.1", shorthand=False ) # No requests made. @@ -485,7 +485,7 @@ def test_blacklisted_ip_range_direct(self) -> None: Blacklisted IP ranges, accessed directly, are not spidered. """ channel = self.make_request( - "GET", "preview_url?url=http://1.1.1.2", shorthand=False + "GET", "v3/preview_url?url=http://1.1.1.2", shorthand=False ) self.assertEqual(channel.code, 403) @@ -506,7 +506,7 @@ def test_blacklisted_ip_range_whitelisted_ip(self) -> None: channel = self.make_request( "GET", - "preview_url?url=http://example.com", + "v3/preview_url?url=http://example.com", shorthand=False, await_result=False, ) @@ -542,7 +542,7 @@ def test_blacklisted_ip_with_external_ip(self) -> None: ] channel = self.make_request( - "GET", "preview_url?url=http://example.com", shorthand=False + "GET", "v3/preview_url?url=http://example.com", shorthand=False ) self.assertEqual(channel.code, 502) self.assertEqual( @@ -562,7 +562,7 @@ def test_blacklisted_ipv6_specific(self) -> None: ] channel = self.make_request( - "GET", "preview_url?url=http://example.com", shorthand=False + "GET", "v3/preview_url?url=http://example.com", shorthand=False ) # No requests made. @@ -583,7 +583,7 @@ def test_blacklisted_ipv6_range(self) -> None: self.lookups["example.com"] = [(IPv6Address, "2001:800::1")] channel = self.make_request( - "GET", "preview_url?url=http://example.com", shorthand=False + "GET", "v3/preview_url?url=http://example.com", shorthand=False ) self.assertEqual(channel.code, 502) @@ -600,7 +600,7 @@ def test_OPTIONS(self) -> None: OPTIONS returns the OPTIONS. """ channel = self.make_request( - "OPTIONS", "preview_url?url=http://example.com", shorthand=False + "OPTIONS", "v3/preview_url?url=http://example.com", shorthand=False ) self.assertEqual(channel.code, 200) self.assertEqual(channel.json_body, {}) @@ -614,7 +614,7 @@ def test_accept_language_config_option(self) -> None: # Build and make a request to the server channel = self.make_request( "GET", - "preview_url?url=http://example.com", + "v3/preview_url?url=http://example.com", shorthand=False, await_result=False, ) @@ -672,7 +672,7 @@ def test_data_url(self) -> None: channel = self.make_request( "GET", - f"preview_url?{query_params}", + f"v3/preview_url?{query_params}", shorthand=False, ) self.pump() @@ -693,7 +693,7 @@ def test_inline_data_url(self) -> None: channel = self.make_request( "GET", - "preview_url?url=http://matrix.org", + "v3/preview_url?url=http://matrix.org", shorthand=False, await_result=False, ) @@ -730,7 +730,7 @@ def test_oembed_photo(self) -> None: channel = self.make_request( "GET", - "preview_url?url=http://twitter.com/matrixdotorg/status/12345", + "v3/preview_url?url=http://twitter.com/matrixdotorg/status/12345", shorthand=False, await_result=False, ) @@ -790,7 +790,7 @@ def test_oembed_rich(self) -> None: channel = self.make_request( "GET", - "preview_url?url=http://twitter.com/matrixdotorg/status/12345", + "v3/preview_url?url=http://twitter.com/matrixdotorg/status/12345", shorthand=False, await_result=False, ) @@ -834,7 +834,7 @@ def test_oembed_format(self) -> None: channel = self.make_request( "GET", - "preview_url?url=http://www.hulu.com/watch/12345", + "v3/preview_url?url=http://www.hulu.com/watch/12345", shorthand=False, await_result=False, ) @@ -892,7 +892,7 @@ def test_oembed_autodiscovery(self) -> None: channel = self.make_request( "GET", - "preview_url?url=http://www.twitter.com/matrixdotorg/status/12345", + "v3/preview_url?url=http://www.twitter.com/matrixdotorg/status/12345", shorthand=False, await_result=False, ) @@ -975,7 +975,7 @@ def _download_image(self) -> Tuple[str, str]: channel = self.make_request( "GET", - "preview_url?url=http://cdn.twitter.com/matrixdotorg", + "v3/preview_url?url=http://cdn.twitter.com/matrixdotorg", shorthand=False, await_result=False, ) @@ -1017,7 +1017,7 @@ def test_storage_providers_exclude_files(self) -> None: # Check fetching channel = self.make_request( "GET", - f"download/{host}/{media_id}", + f"v3/download/{host}/{media_id}", shorthand=False, await_result=False, ) @@ -1030,7 +1030,7 @@ def test_storage_providers_exclude_files(self) -> None: channel = self.make_request( "GET", - f"download/{host}/{media_id}", + f"v3/download/{host}/{media_id}", shorthand=False, await_result=False, ) @@ -1065,7 +1065,7 @@ def test_storage_providers_exclude_thumbnails(self) -> None: # Check fetching channel = self.make_request( "GET", - f"thumbnail/{host}/{media_id}?width=32&height=32&method=scale", + f"v3/thumbnail/{host}/{media_id}?width=32&height=32&method=scale", shorthand=False, await_result=False, ) @@ -1083,7 +1083,7 @@ def test_storage_providers_exclude_thumbnails(self) -> None: channel = self.make_request( "GET", - f"thumbnail/{host}/{media_id}?width=32&height=32&method=scale", + f"v3/thumbnail/{host}/{media_id}?width=32&height=32&method=scale", shorthand=False, await_result=False, ) @@ -1135,7 +1135,7 @@ def test_blacklist_port(self) -> None: channel = self.make_request( "GET", - "preview_url?url=" + bad_url, + "v3/preview_url?url=" + bad_url, shorthand=False, await_result=False, ) @@ -1144,7 +1144,7 @@ def test_blacklist_port(self) -> None: channel = self.make_request( "GET", - "preview_url?url=" + good_url, + "v3/preview_url?url=" + good_url, shorthand=False, await_result=False, )