mirror of
https://github.com/Hopiu/linkchecker.git
synced 2026-03-16 22:10:26 +00:00
Add tests for missing and empty FILENAMEs
This commit is contained in:
parent
73b099ad4c
commit
ac8495cb18
4 changed files with 21 additions and 0 deletions
0
tests/configuration/data/config.empty
Normal file
0
tests/configuration/data/config.empty
Normal file
|
|
@ -191,3 +191,13 @@ class TestConfig(TestBase):
|
|||
# blacklist logger section
|
||||
self.assertEqual(config["failures"]["filename"], "blacklist")
|
||||
self.assertEqual(config["failures"]["encoding"], "utf-8")
|
||||
|
||||
def test_confparse_empty(self):
|
||||
config = linkcheck.configuration.Configuration()
|
||||
files = [get_file("config.empty")]
|
||||
self.assertRaises(linkcheck.LinkCheckerError, config.read, files)
|
||||
|
||||
def test_confparse_missing(self):
|
||||
config = linkcheck.configuration.Configuration()
|
||||
files = [get_file("no_such_config")]
|
||||
self.assertRaises(linkcheck.LinkCheckerError, config.read, files)
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ Test cookie routines.
|
|||
"""
|
||||
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
import linkcheck.cookies
|
||||
import linkcheck.configuration
|
||||
|
|
@ -80,3 +81,10 @@ class TestCookies(TestBase):
|
|||
aggregate.add_request_session()
|
||||
session = aggregate.get_request_session()
|
||||
self.assertEqual({c.name for c in session.cookies}, {"om", "multiple", "are"})
|
||||
|
||||
def test_empty_cookie_file(self):
|
||||
self.assertRaises(
|
||||
linkcheck.LinkCheckerError,
|
||||
linkcheck.cookies.from_file,
|
||||
Path(__file__).parent / "configuration/data/config.empty",
|
||||
)
|
||||
|
|
|
|||
|
|
@ -40,3 +40,6 @@ class TestLinkchecker(unittest.TestCase):
|
|||
run_with_options([option])
|
||||
# unknown option
|
||||
self.assertRaises(OSError, run_with_options, ["--imadoofus"])
|
||||
# non-existent FILENAMEs
|
||||
self.assertRaises(OSError, run_with_options, ["--config", "no_such_file"])
|
||||
self.assertRaises(OSError, run_with_options, ["--cookiefile", "no_such_file"])
|
||||
|
|
|
|||
Loading…
Reference in a new issue