[cookies] return loaded cookies as list

don't set_cookie() them immediately into a CookieJar
also, give some more consistent names to chrome/chromium functions
This commit is contained in:
Mike Fährmann
2024-10-12 16:32:29 +02:00
parent 39b7d748f6
commit 3946fe5ac4
4 changed files with 115 additions and 104 deletions

View File

@@ -205,9 +205,8 @@ class TestCookiesTxt(unittest.TestCase):
def test_cookiestxt_load(self):
def _assert(content, expected):
jar = http.cookiejar.CookieJar()
util.cookiestxt_load(io.StringIO(content, None), jar)
for c, e in zip(jar, expected):
cookies = util.cookiestxt_load(io.StringIO(content, None))
for c, e in zip(cookies, expected):
self.assertEqual(c.__dict__, e.__dict__)
_assert("", [])
@@ -253,8 +252,7 @@ class TestCookiesTxt(unittest.TestCase):
)
with self.assertRaises(ValueError):
util.cookiestxt_load("example.org\tTRUE\t/\tTRUE\t0\tname",
http.cookiejar.CookieJar())
util.cookiestxt_load("example.org\tTRUE\t/\tTRUE\t0\tname")
def test_cookiestxt_store(self):