Compare commits
No commits in common. "609529019532f56633aeebb82e85d20fde86038d" and "59f8adf8609ffaa4b97ec4cfc623828534a46dbf" have entirely different histories.
6095290195
...
59f8adf860
|
@ -3,7 +3,6 @@ Manga checker and downloader
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import os
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
parser = argparse.ArgumentParser(
|
parser = argparse.ArgumentParser(
|
||||||
|
@ -20,10 +19,3 @@ if __name__ == '__main__':
|
||||||
)
|
)
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
destination = os.path.abspath(args.destination)
|
|
||||||
|
|
||||||
if not os.path.exists(destination):
|
|
||||||
print(f'Destination {destination} does not exist.')
|
|
||||||
if not os.path.isdir(destination):
|
|
||||||
print(f'Destination {destination} is not a directory.')
|
|
|
@ -1,29 +1,12 @@
|
||||||
from subprocess import CalledProcessError
|
from subprocess import CalledProcessError
|
||||||
import unittest
|
import unittest
|
||||||
import subprocess
|
|
||||||
import os
|
|
||||||
|
|
||||||
|
class FirstTestClass(unittest.TestCase):
|
||||||
class ArgumentTestClass(unittest.TestCase):
|
|
||||||
|
|
||||||
def setUp(self):
|
|
||||||
import tempfile
|
|
||||||
self.existing_dir = tempfile.mkdtemp()
|
|
||||||
|
|
||||||
def test_argument_required(self):
|
def test_argument_required(self):
|
||||||
|
import subprocess
|
||||||
with self.assertRaises(CalledProcessError):
|
with self.assertRaises(CalledProcessError):
|
||||||
subprocess.check_output(['python', 'manga_up'])
|
subprocess.check_output(['python', 'manga_up'])
|
||||||
|
|
||||||
def test_destination_exists(self):
|
|
||||||
result = subprocess.check_output(['python', 'manga_up', '--destination', 'nonexistent'])
|
|
||||||
self.assertIn('does not exist', str(result))
|
|
||||||
|
|
||||||
def test_destination_is_not_directory(self):
|
|
||||||
result = subprocess.check_output(['python', 'manga_up', '--destination', self.existing_file])
|
|
||||||
self.assertIn('not a directory', str(result))
|
|
||||||
|
|
||||||
def tearDown(self) -> None:
|
|
||||||
os.rmdir(self.existing_dir)
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
Loading…
Reference in New Issue