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

Commit c817c63

Browse files
committed
tests/url_preview: fixed paths for URL preview tests
Signed-off-by: Sumner Evans <sumner@beeper.com>
1 parent 281e5f0 commit c817c63

File tree

1 file changed

+32
-32
lines changed

1 file changed

+32
-32
lines changed

tests/rest/media/v1/test_url_preview.py

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ def test_cache_returns_correct_type(self) -> None:
162162

163163
channel = self.make_request(
164164
"GET",
165-
"preview_url?url=http://matrix.org",
165+
"v3/preview_url?url=http://matrix.org",
166166
shorthand=False,
167167
await_result=False,
168168
)
@@ -186,7 +186,7 @@ def test_cache_returns_correct_type(self) -> None:
186186

187187
# Check the cache returns the correct response
188188
channel = self.make_request(
189-
"GET", "preview_url?url=http://matrix.org", shorthand=False
189+
"GET", "v3/preview_url?url=http://matrix.org", shorthand=False
190190
)
191191

192192
# Check the cache response has the same content
@@ -202,7 +202,7 @@ def test_cache_returns_correct_type(self) -> None:
202202

203203
# Check the database cache returns the correct response
204204
channel = self.make_request(
205-
"GET", "preview_url?url=http://matrix.org", shorthand=False
205+
"GET", "v3/preview_url?url=http://matrix.org", shorthand=False
206206
)
207207

208208
# Check the cache response has the same content
@@ -224,7 +224,7 @@ def test_non_ascii_preview_httpequiv(self) -> None:
224224

225225
channel = self.make_request(
226226
"GET",
227-
"preview_url?url=http://matrix.org",
227+
"v3/preview_url?url=http://matrix.org",
228228
shorthand=False,
229229
await_result=False,
230230
)
@@ -254,7 +254,7 @@ def test_video_rejected(self) -> None:
254254

255255
channel = self.make_request(
256256
"GET",
257-
"preview_url?url=http://matrix.org",
257+
"v3/preview_url?url=http://matrix.org",
258258
shorthand=False,
259259
await_result=False,
260260
)
@@ -290,7 +290,7 @@ def test_audio_rejected(self) -> None:
290290

291291
channel = self.make_request(
292292
"GET",
293-
"preview_url?url=http://matrix.org",
293+
"v3/preview_url?url=http://matrix.org",
294294
shorthand=False,
295295
await_result=False,
296296
)
@@ -331,7 +331,7 @@ def test_non_ascii_preview_content_type(self) -> None:
331331

332332
channel = self.make_request(
333333
"GET",
334-
"preview_url?url=http://matrix.org",
334+
"v3/preview_url?url=http://matrix.org",
335335
shorthand=False,
336336
await_result=False,
337337
)
@@ -366,7 +366,7 @@ def test_overlong_title(self) -> None:
366366

367367
channel = self.make_request(
368368
"GET",
369-
"preview_url?url=http://matrix.org",
369+
"v3/preview_url?url=http://matrix.org",
370370
shorthand=False,
371371
await_result=False,
372372
)
@@ -399,7 +399,7 @@ def test_ipaddr(self) -> None:
399399

400400
channel = self.make_request(
401401
"GET",
402-
"preview_url?url=http://example.com",
402+
"v3/preview_url?url=http://example.com",
403403
shorthand=False,
404404
await_result=False,
405405
)
@@ -428,7 +428,7 @@ def test_blacklisted_ip_specific(self) -> None:
428428
self.lookups["example.com"] = [(IPv4Address, "192.168.1.1")]
429429

430430
channel = self.make_request(
431-
"GET", "preview_url?url=http://example.com", shorthand=False
431+
"GET", "v3/preview_url?url=http://example.com", shorthand=False
432432
)
433433

434434
# No requests made.
@@ -449,7 +449,7 @@ def test_blacklisted_ip_range(self) -> None:
449449
self.lookups["example.com"] = [(IPv4Address, "1.1.1.2")]
450450

451451
channel = self.make_request(
452-
"GET", "preview_url?url=http://example.com", shorthand=False
452+
"GET", "v3/preview_url?url=http://example.com", shorthand=False
453453
)
454454

455455
self.assertEqual(channel.code, 502)
@@ -466,7 +466,7 @@ def test_blacklisted_ip_specific_direct(self) -> None:
466466
Blacklisted IP addresses, accessed directly, are not spidered.
467467
"""
468468
channel = self.make_request(
469-
"GET", "preview_url?url=http://192.168.1.1", shorthand=False
469+
"GET", "v3/preview_url?url=http://192.168.1.1", shorthand=False
470470
)
471471

472472
# No requests made.
@@ -485,7 +485,7 @@ def test_blacklisted_ip_range_direct(self) -> None:
485485
Blacklisted IP ranges, accessed directly, are not spidered.
486486
"""
487487
channel = self.make_request(
488-
"GET", "preview_url?url=http://1.1.1.2", shorthand=False
488+
"GET", "v3/preview_url?url=http://1.1.1.2", shorthand=False
489489
)
490490

491491
self.assertEqual(channel.code, 403)
@@ -506,7 +506,7 @@ def test_blacklisted_ip_range_whitelisted_ip(self) -> None:
506506

507507
channel = self.make_request(
508508
"GET",
509-
"preview_url?url=http://example.com",
509+
"v3/preview_url?url=http://example.com",
510510
shorthand=False,
511511
await_result=False,
512512
)
@@ -542,7 +542,7 @@ def test_blacklisted_ip_with_external_ip(self) -> None:
542542
]
543543

544544
channel = self.make_request(
545-
"GET", "preview_url?url=http://example.com", shorthand=False
545+
"GET", "v3/preview_url?url=http://example.com", shorthand=False
546546
)
547547
self.assertEqual(channel.code, 502)
548548
self.assertEqual(
@@ -562,7 +562,7 @@ def test_blacklisted_ipv6_specific(self) -> None:
562562
]
563563

564564
channel = self.make_request(
565-
"GET", "preview_url?url=http://example.com", shorthand=False
565+
"GET", "v3/preview_url?url=http://example.com", shorthand=False
566566
)
567567

568568
# No requests made.
@@ -583,7 +583,7 @@ def test_blacklisted_ipv6_range(self) -> None:
583583
self.lookups["example.com"] = [(IPv6Address, "2001:800::1")]
584584

585585
channel = self.make_request(
586-
"GET", "preview_url?url=http://example.com", shorthand=False
586+
"GET", "v3/preview_url?url=http://example.com", shorthand=False
587587
)
588588

589589
self.assertEqual(channel.code, 502)
@@ -600,7 +600,7 @@ def test_OPTIONS(self) -> None:
600600
OPTIONS returns the OPTIONS.
601601
"""
602602
channel = self.make_request(
603-
"OPTIONS", "preview_url?url=http://example.com", shorthand=False
603+
"OPTIONS", "v3/preview_url?url=http://example.com", shorthand=False
604604
)
605605
self.assertEqual(channel.code, 200)
606606
self.assertEqual(channel.json_body, {})
@@ -614,7 +614,7 @@ def test_accept_language_config_option(self) -> None:
614614
# Build and make a request to the server
615615
channel = self.make_request(
616616
"GET",
617-
"preview_url?url=http://example.com",
617+
"v3/preview_url?url=http://example.com",
618618
shorthand=False,
619619
await_result=False,
620620
)
@@ -672,7 +672,7 @@ def test_data_url(self) -> None:
672672

673673
channel = self.make_request(
674674
"GET",
675-
f"preview_url?{query_params}",
675+
f"v3/preview_url?{query_params}",
676676
shorthand=False,
677677
)
678678
self.pump()
@@ -693,7 +693,7 @@ def test_inline_data_url(self) -> None:
693693

694694
channel = self.make_request(
695695
"GET",
696-
"preview_url?url=http://matrix.org",
696+
"v3/preview_url?url=http://matrix.org",
697697
shorthand=False,
698698
await_result=False,
699699
)
@@ -730,7 +730,7 @@ def test_oembed_photo(self) -> None:
730730

731731
channel = self.make_request(
732732
"GET",
733-
"preview_url?url=http://twitter.com/matrixdotorg/status/12345",
733+
"v3/preview_url?url=http://twitter.com/matrixdotorg/status/12345",
734734
shorthand=False,
735735
await_result=False,
736736
)
@@ -790,7 +790,7 @@ def test_oembed_rich(self) -> None:
790790

791791
channel = self.make_request(
792792
"GET",
793-
"preview_url?url=http://twitter.com/matrixdotorg/status/12345",
793+
"v3/preview_url?url=http://twitter.com/matrixdotorg/status/12345",
794794
shorthand=False,
795795
await_result=False,
796796
)
@@ -834,7 +834,7 @@ def test_oembed_format(self) -> None:
834834

835835
channel = self.make_request(
836836
"GET",
837-
"preview_url?url=http://www.hulu.com/watch/12345",
837+
"v3/preview_url?url=http://www.hulu.com/watch/12345",
838838
shorthand=False,
839839
await_result=False,
840840
)
@@ -892,7 +892,7 @@ def test_oembed_autodiscovery(self) -> None:
892892

893893
channel = self.make_request(
894894
"GET",
895-
"preview_url?url=http://www.twitter.com/matrixdotorg/status/12345",
895+
"v3/preview_url?url=http://www.twitter.com/matrixdotorg/status/12345",
896896
shorthand=False,
897897
await_result=False,
898898
)
@@ -975,7 +975,7 @@ def _download_image(self) -> Tuple[str, str]:
975975

976976
channel = self.make_request(
977977
"GET",
978-
"preview_url?url=http://cdn.twitter.com/matrixdotorg",
978+
"v3/preview_url?url=http://cdn.twitter.com/matrixdotorg",
979979
shorthand=False,
980980
await_result=False,
981981
)
@@ -1017,7 +1017,7 @@ def test_storage_providers_exclude_files(self) -> None:
10171017
# Check fetching
10181018
channel = self.make_request(
10191019
"GET",
1020-
f"download/{host}/{media_id}",
1020+
f"v3/download/{host}/{media_id}",
10211021
shorthand=False,
10221022
await_result=False,
10231023
)
@@ -1030,7 +1030,7 @@ def test_storage_providers_exclude_files(self) -> None:
10301030

10311031
channel = self.make_request(
10321032
"GET",
1033-
f"download/{host}/{media_id}",
1033+
f"v3/download/{host}/{media_id}",
10341034
shorthand=False,
10351035
await_result=False,
10361036
)
@@ -1065,7 +1065,7 @@ def test_storage_providers_exclude_thumbnails(self) -> None:
10651065
# Check fetching
10661066
channel = self.make_request(
10671067
"GET",
1068-
f"thumbnail/{host}/{media_id}?width=32&height=32&method=scale",
1068+
f"v3/thumbnail/{host}/{media_id}?width=32&height=32&method=scale",
10691069
shorthand=False,
10701070
await_result=False,
10711071
)
@@ -1083,7 +1083,7 @@ def test_storage_providers_exclude_thumbnails(self) -> None:
10831083

10841084
channel = self.make_request(
10851085
"GET",
1086-
f"thumbnail/{host}/{media_id}?width=32&height=32&method=scale",
1086+
f"v3/thumbnail/{host}/{media_id}?width=32&height=32&method=scale",
10871087
shorthand=False,
10881088
await_result=False,
10891089
)
@@ -1135,7 +1135,7 @@ def test_blacklist_port(self) -> None:
11351135

11361136
channel = self.make_request(
11371137
"GET",
1138-
"preview_url?url=" + bad_url,
1138+
"v3/preview_url?url=" + bad_url,
11391139
shorthand=False,
11401140
await_result=False,
11411141
)
@@ -1144,7 +1144,7 @@ def test_blacklist_port(self) -> None:
11441144

11451145
channel = self.make_request(
11461146
"GET",
1147-
"preview_url?url=" + good_url,
1147+
"v3/preview_url?url=" + good_url,
11481148
shorthand=False,
11491149
await_result=False,
11501150
)

0 commit comments

Comments
 (0)