1
0
mirror of https://github.com/yt-dlp/yt-dlp synced 2025-07-06 22:12:51 -05:00

[cookies] Improve LenientSimpleCookie (#5195)

Closes #5186 
Authored by: Grub4K
This commit is contained in:
Simon Sawicki
2022-10-11 05:39:12 +02:00
committed by GitHub
parent 0468a3b325
commit 36069409ec
2 changed files with 28 additions and 17 deletions

View File

@ -277,9 +277,24 @@ class TestLenientSimpleCookie(unittest.TestCase):
"a=b; invalid; Version=1; c=d",
{"a": "b", "c": "d"},
),
(
"Reset morsel after invalid to not capture attributes",
"a=b; $invalid; $Version=1; c=d",
{"a": "b", "c": "d"},
),
(
"Continue after non-flag attribute without value",
"a=b; path; Version=1; c=d",
{"a": "b", "c": "d"},
),
(
"Allow cookie attributes with `$` prefix",
'Customer="WILE_E_COYOTE"; $Version=1; $Secure; $Path=/acme',
{"Customer": ("WILE_E_COYOTE", {"version": "1", "secure": True, "path": "/acme"})},
),
(
"Invalid Morsel keys should not result in an error",
"Key=Value; [Invalid]=Value; Another=Value",
{"Key": "Value", "Another": "Value"},
),
)