Fix dosage tests
This commit is contained in:
parent
bb18295798
commit
365fd17802
1 changed files with 25 additions and 23 deletions
|
@ -28,39 +28,41 @@ def run_with_options(options, cmd=dosage_cmd):
|
||||||
class TestDosage (unittest.TestCase):
|
class TestDosage (unittest.TestCase):
|
||||||
"""Test the dosage commandline client."""
|
"""Test the dosage commandline client."""
|
||||||
|
|
||||||
def setUp(self):
|
def test_dosage(self):
|
||||||
# create a temporary directory for images
|
# list comics
|
||||||
self.tmpdir = tempfile.mkdtemp()
|
|
||||||
|
|
||||||
def tearDown(self):
|
|
||||||
shutil.rmtree(self.tmpdir)
|
|
||||||
|
|
||||||
def test_list_comics(self):
|
|
||||||
for option in ("-l", "--list", "--singlelist"):
|
for option in ("-l", "--list", "--singlelist"):
|
||||||
run_with_options([option])
|
run_with_options([option])
|
||||||
|
# display version
|
||||||
def test_version(self):
|
|
||||||
run_with_options(["--version"])
|
run_with_options(["--version"])
|
||||||
|
# display help
|
||||||
def test_help(self):
|
|
||||||
for option in ("-h", "--help"):
|
for option in ("-h", "--help"):
|
||||||
run_with_options([option])
|
run_with_options([option])
|
||||||
# module help
|
# module help
|
||||||
run_with_options(["-m", "calvinandhobbes"])
|
run_with_options(["-m", "calvinandhobbes"])
|
||||||
|
|
||||||
def test_error(self):
|
|
||||||
# no comics specified
|
# no comics specified
|
||||||
self.assertRaises(OSError, run_with_options, [])
|
self.assertRaises(OSError, run_with_options, [])
|
||||||
# unknown option
|
# unknown option
|
||||||
self.assertRaises(OSError, run_with_options, ['--imadoofus'])
|
self.assertRaises(OSError, run_with_options, ['--imadoofus'])
|
||||||
# multiple comics match
|
# multiple comics match
|
||||||
self.assertRaises(OSError, run_with_options, ['Garfield'])
|
self.assertRaises(OSError, run_with_options, ['Garfield'])
|
||||||
|
# create a temporary directory for images
|
||||||
def test_fetch_html(self):
|
tmpdir = tempfile.mkdtemp()
|
||||||
run_with_options(["-n", "2", "-v", "-b", self.tmpdir, "-o", "html", "-o", "rss", "calvinandhobbes"])
|
try:
|
||||||
|
# fetch html and rss
|
||||||
def test_fetch_rss(self):
|
run_with_options(["-n", "2", "-v", "-b", tmpdir, "-o", "html", "-o", "rss", "calvinandhobbes"])
|
||||||
run_with_options(["--numstrips", "2", "--baseurl", "bla", "--basepath", self.tmpdir, "--output", "rss", "--output", "html", "--adult", "sexyloser"])
|
finally:
|
||||||
|
shutil.rmtree(tmpdir)
|
||||||
def test_fetch_indexed(self):
|
# create a temporary directory for images
|
||||||
run_with_options(["-n", "2", "-v", "-b", self.tmpdir, "calvinandhobbes:2012/02/02"])
|
tmpdir = tempfile.mkdtemp()
|
||||||
|
try:
|
||||||
|
# fetch html and rss 2
|
||||||
|
run_with_options(["--numstrips", "2", "--baseurl", "bla", "--basepath", tmpdir, "--output", "rss", "--output", "html", "--adult", "sexyloser"])
|
||||||
|
finally:
|
||||||
|
shutil.rmtree(tmpdir)
|
||||||
|
# create a temporary directory for images
|
||||||
|
tmpdir = tempfile.mkdtemp()
|
||||||
|
try:
|
||||||
|
# fetch indexed
|
||||||
|
run_with_options(["-n", "2", "-v", "-b", tmpdir, "calvinandhobbes:2012/02/02"])
|
||||||
|
finally:
|
||||||
|
shutil.rmtree(tmpdir)
|
||||||
|
|
Loading…
Reference in a new issue