Skip to content

Commit c2d5d6c

Browse files
mahdirahimi1999mgrdcm
authored andcommitted
test: improve Vimeo thumbnail URL assertion by ignoring query params
1 parent b9e6997 commit c2d5d6c

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

embed_video/tests/backends/tests_vimeo.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from unittest import TestCase
22
from unittest.mock import patch
3+
import urllib.parse
34

45
import requests
56

@@ -39,9 +40,17 @@ def test_vimeo_get_info_exception(self):
3940

4041
def test_get_thumbnail_url(self):
4142
backend = VimeoBackend("https://vimeo.com/72304002")
43+
expected_url = "https://i.vimeocdn.com/video/446150690-9621b882540b53788eaa36ef8e303d4e06fc40af3d27918b7f561bb44ed971dc-d_640"
44+
actual_url = backend.get_thumbnail_url()
45+
46+
# Parse URLs and compare without query parameters
47+
expected_parts = urllib.parse.urlparse(expected_url)
48+
actual_parts = urllib.parse.urlparse(actual_url)
49+
50+
# Compare scheme, netloc, and path only
4251
self.assertEqual(
43-
backend.get_thumbnail_url(),
44-
"https://i.vimeocdn.com/video/446150690-9621b882540b53788eaa36ef8e303d4e06fc40af3d27918b7f561bb44ed971dc-d_640?region=us",
52+
(expected_parts.scheme, expected_parts.netloc, expected_parts.path),
53+
(actual_parts.scheme, actual_parts.netloc, actual_parts.path)
4554
)
4655

4756
@patch("embed_video.backends.EMBED_VIDEO_TIMEOUT", 0.000001)

0 commit comments

Comments
 (0)