Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
tests/url_preview: fixed paths for URL preview tests
Browse files Browse the repository at this point in the history
Signed-off-by: Sumner Evans <[email protected]>
  • Loading branch information
sumnerevans committed Apr 16, 2022
1 parent 281e5f0 commit c817c63
Showing 1 changed file with 32 additions and 32 deletions.
64 changes: 32 additions & 32 deletions tests/rest/media/v1/test_url_preview.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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,
)
Expand Down Expand Up @@ -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,
)
Expand Down Expand Up @@ -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,
)
Expand Down Expand Up @@ -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,
)
Expand Down Expand Up @@ -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,
)
Expand Down Expand Up @@ -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,
)
Expand Down Expand Up @@ -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.
Expand All @@ -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)
Expand All @@ -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.
Expand All @@ -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)
Expand All @@ -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,
)
Expand Down Expand Up @@ -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(
Expand All @@ -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.
Expand All @@ -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)
Expand All @@ -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, {})
Expand All @@ -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,
)
Expand Down Expand Up @@ -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()
Expand All @@ -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,
)
Expand Down Expand Up @@ -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,
)
Expand Down Expand Up @@ -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,
)
Expand Down Expand Up @@ -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,
)
Expand Down Expand Up @@ -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,
)
Expand Down Expand Up @@ -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,
)
Expand Down Expand Up @@ -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,
)
Expand All @@ -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,
)
Expand Down Expand Up @@ -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,
)
Expand All @@ -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,
)
Expand Down Expand Up @@ -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,
)
Expand All @@ -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,
)
Expand Down

0 comments on commit c817c63

Please sign in to comment.