def test_idempotence_no_md_file(mode): reset_tmp() try: galerie.main('--idem tmp') return False except SystemExit as exception: return exception.args[0] == galerie.errorcode('File not found')
def test_sourcedir_not_found(mode): # test image source not found try: galerie.main('--gallery tmp --source foobar') return False except SystemExit as exception: return exception.args[0] == galerie.errorcode('Directory not found')
def test_07_gallery(mode): # test diary file not found reset_tmp() try: galerie.main('--gallery tmp --diary true') return False except SystemExit as exception: return exception.args[0] == galerie.errorcode('File not found')
def test_update_incorrect_parameter(mode): # test --update with incorrect parameter reset_tmp() try: galerie.main('--update tmp --bydir true') return False except SystemExit as exception: return exception.args[0] == galerie.errorcode('Incorrect parameters:')
def test_15_gallery(mode): if mode == 'ref': return None else: populate_tmp() galerie.createconfig('tmp/.config.ini') galerie.setconfig('tmp/.config.ini', 'photobox', 'time', 'abc') try: galerie.main('--gallery tmp --source subdir/deeper1 --bydir true') return False except SystemExit as exception: return exception.args[0] == galerie.errorcode( 'Missing or incorrect config value:')
def test_diary_date_incorrect(mode): # test for incorrect date in diary reset_tmp() diary = '''\ [2020/02/30] ______ ''' with open('tmp/index.md', 'wt') as f: f.write(diary) try: galerie.main('--gallery tmp --diary true') return False except SystemExit as exception: return exception.args[0] == galerie.errorcode('Incorrect date value:')
def test_diary_date_missing(mode): # test for date missing in diary reset_tmp() diary = '''\ ______ ''' with open('tmp/index.md', 'wt') as f: f.write(diary) try: galerie.main('--gallery tmp --diary true') return False except SystemExit as exception: return exception.args[0] == galerie.errorcode('No date in post')
def test_diary_dates_not_ordered(mode): # test for post not ordered by dates in diary reset_tmp() diary = '''\ [2020/01/02] ______ [2020/01/01] ______ ''' with open('tmp/index.md', 'wt') as f: f.write(diary) try: galerie.main('--gallery tmp --diary true') return False except SystemExit as exception: return exception.args[0] == galerie.errorcode('Posts are not ordered')
def test_blogger_url_not_read(mode): try: galerie.main('--blogger . --url foobar') return False except SystemExit as exception: return exception.args[0] == galerie.errorcode('Unable to read url')
def test_blogger_url_not_given(mode): try: galerie.main('--blogger .') return False except SystemExit as exception: return exception.args[0] == galerie.errorcode('No blogger url (--url)')
def test_dates_3(mode): try: galerie.main('--create tmp --dates diary') return False except SystemExit as exception: return exception.args[0] == galerie.errorcode('Incorrect date format')
def test_dates_2(mode): try: galerie.main('--gallery tmp --source . --dates foobar') return False except SystemExit as exception: return exception.args[0] == galerie.errorcode('Incorrect date format')