Regression test for --cookiefile bug

This commit is contained in:
Marius Gedminas 2018-03-16 10:23:04 +02:00
parent 6becc08284
commit 01b5dd619e
2 changed files with 14 additions and 0 deletions

3
tests/cookies.txt Normal file
View file

@ -0,0 +1,3 @@
Host: example.org
Path: /hello
Set-cookie: om="nomnom"

View file

@ -18,8 +18,12 @@
Test cookie routines.
"""
import os
import unittest
import linkcheck.cookies
import linkcheck.configuration
import linkcheck.director
class TestCookies (unittest.TestCase):
@ -66,3 +70,10 @@ class TestCookies (unittest.TestCase):
]
from_headers = linkcheck.cookies.from_headers
self.assertRaises(ValueError, from_headers, "\r\n".join(lines))
def test_cookie_file (self):
config = linkcheck.configuration.Configuration()
here = os.path.dirname(__file__)
config['cookiefile'] = os.path.join(here, 'cookies.txt')
aggregate = linkcheck.director.get_aggregate(config)
aggregate.add_request_session()