def main_nogui_bad_args_test(self): print("--------------") sys.argv = [ sys.argv[0], '--nogui'] with self.assertRaises(SystemExit) as cm: main() self.assertEqual(cm.exception.code, 2) # missing --url print("--------------") sys.argv = [ sys.argv[0], '--nogui', '--url', self.mangatraders_series_url ] with self.assertRaises(SystemExit) as cm: main() self.assertEqual(cm.exception.code, 2) # missing --list or --range print("--------------") sys.argv = [ sys.argv[0], '--nogui', '--url', 'asdf', '--list' ] with self.assertRaises(SystemExit) as cm: main() self.assertEqual(cm.exception.code, 2) # bad url print("--------------") sys.argv = [ sys.argv[0], '--nogui', '--url', self.mangatraders_series_url, '--range', '0', '1', '2' ] with self.assertRaises(SystemExit) as cm: main() self.assertEqual(cm.exception.code, 2) # too many range arguments
#!/usr/bin/env python3 # encoding: utf-8 """ This file is part of OMAD. OMAD is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version. OMAD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OMAD. If not, see <http://www.gnu.org/licenses/>. """ from omad.omad_app import main main()
def main_nogui_download_test(self): sys.argv = [ sys.argv[0], '--nogui', '--url', self.mangatraders_series_url, '--range', '0', '0'] with self.assertRaises(SystemExit) as cm: main() self.assertEqual(cm.exception.code, 0)
def main_logfile_test(self): sys.argv = [ sys.argv[0], '--nogui', '--logfile', '--debug'] with self.assertRaises(SystemExit) as cm: main() self.assertEqual(cm.exception.code, 2)
def main_nogui_list_test(self): sys.argv = [ sys.argv[0], '--nogui', '--url', self.series_url, '--list'] with self.assertRaises(SystemExit) as cm: main() self.assertEqual(cm.exception.code, 0)