Skip to content

Commit ec8f633

Browse files
ANKUR DWIVEDIANKUR DWIVEDI
authored andcommitted
update test cases
1 parent e88c32f commit ec8f633

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

tests/test_generate_url.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -327,12 +327,13 @@ def test_url_signed_with_expire_in_seconds(self):
327327
self.assertIn("ik-t", url)
328328

329329
def test_url_signed_with_diacritic_in_filename(self):
330-
encodedUrl = Url.encode_string_if_required("https://test-domain.com/test-endpoint/test_é_path_alt.jpg")
330+
url = "https://test-domain.com/test-endpoint/test_é_path_alt.jpg"
331+
encodedUrl = Url.encode_string_if_required(url)
331332
self.assertEqual(
332333
encodedUrl,
333334
"https://test-domain.com/test-endpoint/test_%C3%A9_path_alt.jpg",
334335
)
335-
signature = Url.get_signature("private_key_test", encodedUrl,"https://test-domain.com/test-endpoint", 9999999999)
336+
signature = Url.get_signature("private_key_test", url, "https://test-domain.com/test-endpoint", 9999999999)
336337
options = {
337338
"path": "/test_é_path_alt.jpg",
338339
"signed": True,
@@ -345,12 +346,13 @@ def test_url_signed_with_diacritic_in_filename(self):
345346
self.assertIn("ik-s="+signature, url)
346347

347348
def test_url_signed_with_diacritic_in_filename_and_path(self):
348-
encodedUrl = Url.encode_string_if_required("https://test-domain.com/test-endpoint/aéb/test_é_path_alt.jpg")
349+
url = "https://test-domain.com/test-endpoint/aéb/test_é_path_alt.jpg"
350+
encodedUrl = Url.encode_string_if_required(url)
349351
self.assertEqual(
350352
encodedUrl,
351353
"https://test-domain.com/test-endpoint/a%C3%A9b/test_%C3%A9_path_alt.jpg",
352354
)
353-
signature = Url.get_signature("private_key_test", encodedUrl,"https://test-domain.com/test-endpoint", 9999999999)
355+
signature = Url.get_signature("private_key_test", url, "https://test-domain.com/test-endpoint", 9999999999)
354356
options = {
355357
"path": "/aéb/test_é_path_alt.jpg",
356358
"signed": True,
@@ -363,12 +365,13 @@ def test_url_signed_with_diacritic_in_filename_and_path(self):
363365
self.assertIn("ik-s="+signature, url)
364366

365367
def test_url_signed_with_diacritic_in_filename_path_transforamtion_in_path(self):
366-
encodedUrl = Url.encode_string_if_required("https://test-domain.com/test-endpoint/tr:l-text,i-Imagekité,fs-50,l-end/aéb/test_é_path_alt.jpg")
368+
url = "https://test-domain.com/test-endpoint/tr:l-text,i-Imagekité,fs-50,l-end/aéb/test_é_path_alt.jpg"
369+
encodedUrl = Url.encode_string_if_required(url)
367370
self.assertEqual(
368371
encodedUrl,
369372
"https://test-domain.com/test-endpoint/tr:l-text,i-Imagekit%C3%A9,fs-50,l-end/a%C3%A9b/test_%C3%A9_path_alt.jpg",
370373
)
371-
signature = Url.get_signature("private_key_test", encodedUrl,"https://test-domain.com/test-endpoint", 9999999999)
374+
signature = Url.get_signature("private_key_test", url, "https://test-domain.com/test-endpoint", 9999999999)
372375
options = {
373376
"path": "/aéb/test_é_path_alt.jpg",
374377
"transformation": [
@@ -387,12 +390,13 @@ def test_url_signed_with_diacritic_in_filename_path_transforamtion_in_path(self)
387390
self.assertIn("ik-s="+signature, url)
388391

389392
def test_url_signed_with_diacritic_in_filename_path_transforamtion_in_query(self):
390-
encodedUrl = Url.encode_string_if_required("https://test-domain.com/test-endpoint/aéb/test_é_path_alt.jpg?tr=l-text%2Ci-Imagekité%2Cfs-50%2Cl-end")
393+
url = "https://test-domain.com/test-endpoint/aéb/test_é_path_alt.jpg?tr=l-text%2Ci-Imagekité%2Cfs-50%2Cl-end"
394+
encodedUrl = Url.encode_string_if_required(url)
391395
self.assertEqual(
392396
encodedUrl,
393397
"https://test-domain.com/test-endpoint/a%C3%A9b/test_%C3%A9_path_alt.jpg?tr=l-text%2Ci-Imagekit%C3%A9%2Cfs-50%2Cl-end",
394398
)
395-
signature = Url.get_signature("private_key_test", encodedUrl,"https://test-domain.com/test-endpoint", 9999999999)
399+
signature = Url.get_signature("private_key_test", url, "https://test-domain.com/test-endpoint", 9999999999)
396400
options = {
397401
"path": "/aéb/test_é_path_alt.jpg",
398402
"transformation": [

0 commit comments

Comments
 (0)