コード例 #1
0
ファイル: test_publish.py プロジェクト: jopela/publish
def test_archive_filename():
    expected = '/data/guide/lol/pics.zip'
    arg = '/data/guide/lol/result.json'

    result = archive_filename(arg)

    assert result == expected
    return
コード例 #2
0
ファイル: test_publish.py プロジェクト: jopela/publish
def test_remove_zip():
    """
    must remove the given filenames from the archive
    """

    guide_name = '/tmp/test_archive/result.json'
    removed_pic_name = ['hello.txt']

    # call the function.
    remove_from_zip(guide_name, removed_pic_name)

    # now get the content of the archive and make sure it only contains
    # world.txt
    archive_name = archive_filename(guide_name)
    content = None
    with ZipFile(archive_name, 'r') as z:
        content = z.namelist()

    assert content == ['world.txt']
    return