コード例 #1
0
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')
コード例 #2
0
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')
コード例 #3
0
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')
コード例 #4
0
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:')
コード例 #5
0
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:')
コード例 #6
0
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:')
コード例 #7
0
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')
コード例 #8
0
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')
コード例 #9
0
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')
コード例 #10
0
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)')
コード例 #11
0
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')
コード例 #12
0
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')