コード例 #1
0
def test_checksum(tmpdir_ch):
    call_cmd('ia --insecure download nasa nasa_meta.xml')
    assert files_downloaded('nasa') == {'nasa_meta.xml'}

    stdout, stderr = call_cmd('ia --insecure download --checksum nasa nasa_meta.xml')
    assert files_downloaded('nasa') == {'nasa_meta.xml'}
    assert 'nasa:\n skipping nasa/nasa_meta.xml, file already exists based on checksum.' == stderr
コード例 #2
0
def test_checksum(tmpdir_ch):
    call_cmd('ia --insecure download nasa nasa_meta.xml')
    assert files_downloaded('nasa') == set(['nasa_meta.xml'])

    stdout, stderr = call_cmd('ia --insecure download --checksum nasa nasa_meta.xml')
    assert files_downloaded('nasa') == set(['nasa_meta.xml'])

    assert 'nasa: . - success' == stdout
コード例 #3
0
def test_clobber(tmpdir_ch):
    cmd = "ia --insecure download nasa nasa_meta.xml"
    call_cmd(cmd)
    assert files_downloaded("nasa") == set(["nasa_meta.xml"])

    stdout, stderr = call_cmd(cmd)
    assert files_downloaded("nasa") == set(["nasa_meta.xml"])
    assert "nasa: . - success" == stdout
コード例 #4
0
def test_checksum(tmpdir_ch):
    call_cmd("ia --insecure download nasa nasa_meta.xml")
    assert files_downloaded("nasa") == set(["nasa_meta.xml"])

    stdout, stderr = call_cmd("ia --insecure download --checksum nasa nasa_meta.xml")
    assert files_downloaded("nasa") == set(["nasa_meta.xml"])

    assert "nasa: . - success" == stdout
コード例 #5
0
def test_clobber(tmpdir_ch):
    cmd = 'ia --insecure download nasa nasa_meta.xml'
    call_cmd(cmd)
    assert files_downloaded('nasa') == set(['nasa_meta.xml'])

    stdout, stderr = call_cmd(cmd)
    assert files_downloaded('nasa') == set(['nasa_meta.xml'])
    assert 'nasa: . - success' == stdout
コード例 #6
0
def test_checksum(tmpdir_ch):
    call_cmd('ia --insecure download nasa nasa_meta.xml')
    assert files_downloaded('nasa') == set(['nasa_meta.xml'])

    stdout, stderr = call_cmd('ia --insecure download --checksum nasa nasa_meta.xml')
    assert files_downloaded('nasa') == set(['nasa_meta.xml'])

    assert 'nasa: . - success' == stdout
コード例 #7
0
def test_clobber(tmpdir_ch):
    cmd = 'ia --insecure download nasa nasa_meta.xml'
    call_cmd(cmd)
    assert files_downloaded('nasa') == set(['nasa_meta.xml'])

    stdout, stderr = call_cmd(cmd)
    assert files_downloaded('nasa') == set(['nasa_meta.xml'])
    assert 'nasa: . - success' == stdout
コード例 #8
0
def test_clobber(tmpdir_ch):
    cmd = 'ia --insecure download nasa nasa_meta.xml'
    call_cmd(cmd)
    assert files_downloaded('nasa') == {'nasa_meta.xml'}

    stdout, stderr = call_cmd(cmd)
    assert files_downloaded('nasa') == {'nasa_meta.xml'}
    expected_stderr = ('nasa:\n'
                       ' skipping nasa/nasa_meta.xml, file already exists based on length and date.')
    assert expected_stderr == stderr
コード例 #9
0
def test_destdir(tmpdir_ch):
    cmd = "ia --insecure download --destdir=thisdirdoesnotexist/ nasa nasa_meta.xml"
    stdout, stderr = call_cmd(cmd, expected_exit_code=1)

    assert "--destdir must be a valid path to a directory." in stderr

    tmpdir_ch.mkdir("thisdirdoesnotexist/")
    call_cmd(cmd)
    assert files_downloaded("thisdirdoesnotexist/nasa") == set(["nasa_meta.xml"])

    tmpdir_ch.mkdir("dir2/")
    cmd = "ia --insecure download --no-directories --destdir=dir2/ " "nasa nasa_meta.xml"
    call_cmd(cmd)
    assert files_downloaded("dir2") == set(["nasa_meta.xml"])
コード例 #10
0
def test_destdir(tmpdir_ch):
    cmd = 'ia --insecure download --destdir=thisdirdoesnotexist/ nasa nasa_meta.xml'
    stdout, stderr = call_cmd(cmd, expected_exit_code=1)

    assert '--destdir must be a valid path to a directory.' in stderr

    tmpdir_ch.mkdir('thisdirdoesnotexist/')
    call_cmd(cmd)
    assert files_downloaded('thisdirdoesnotexist/nasa') == set(['nasa_meta.xml'])

    tmpdir_ch.mkdir('dir2/')
    cmd = ('ia --insecure download --no-directories --destdir=dir2/ '
           'nasa nasa_meta.xml')
    call_cmd(cmd)
    assert files_downloaded('dir2') == set(['nasa_meta.xml'])
コード例 #11
0
def test_destdir(tmpdir_ch):
    cmd = 'ia --insecure download --destdir=thisdirdoesnotexist/ nasa nasa_meta.xml'
    stdout, stderr = call_cmd(cmd, expected_exit_code=1)

    assert '--destdir must be a valid path to a directory.' in stderr

    tmpdir_ch.mkdir('thisdirdoesnotexist/')
    call_cmd(cmd)
    assert files_downloaded('thisdirdoesnotexist/nasa') == set(['nasa_meta.xml'])

    tmpdir_ch.mkdir('dir2/')
    cmd = ('ia --insecure download --no-directories --destdir=dir2/ '
           'nasa nasa_meta.xml')
    call_cmd(cmd)
    assert files_downloaded('dir2') == set(['nasa_meta.xml'])
コード例 #12
0
def test_https(tmpdir_ch):
    if sys.version_info < (2, 7, 9):
        stdout, stderr = call_cmd('ia download nasa', expected_exit_code=1)
        assert 'You are attempting to make an HTTPS' in stderr
    else:
        call_cmd('ia download nasa')
        assert files_downloaded(path='nasa') == NASA_EXPECTED_FILES
コード例 #13
0
def test_https(tmpdir_ch):
    if sys.version_info < (2, 7, 9):
        stdout, stderr = call_cmd('ia download nasa', expected_exit_code=1)
        assert 'You are attempting to make an HTTPS' in stderr
    else:
        call_cmd('ia download nasa')
        assert files_downloaded(path='nasa') == NASA_EXPECTED_FILES
コード例 #14
0
def test_glob(tmpdir_ch):
    expected_files = set([
        'globe_west_540.jpg',
        'NASAarchiveLogo.jpg',
        'globe_west_540_thumb.jpg'
    ])

    call_cmd('ia --insecure download --glob="*jpg" nasa')
    assert files_downloaded(path='nasa') == expected_files
コード例 #15
0
def test_glob(tmpdir_ch):
    expected_files = {
        'globe_west_540.jpg',
        'globe_west_540_thumb.jpg',
        'nasa_itemimage.jpg',
        '__ia_thumb.jpg',
    }

    call_cmd('ia --insecure download --glob="*jpg" nasa')
    assert files_downloaded(path='nasa') == expected_files
コード例 #16
0
def test_glob(tmpdir_ch):
    expected_files = set([
        'globe_west_540.jpg',
        'NASAarchiveLogo.jpg',
        'globe_west_540_thumb.jpg',
        '__ia_thumb.jpg',
    ])

    call_cmd('ia --insecure download --glob="*jpg" nasa')
    assert files_downloaded(path='nasa') == expected_files
コード例 #17
0
def test_no_directories(tmpdir_ch):
    call_cmd('ia --insecure download --no-directories nasa nasa_meta.xml')
    assert files_downloaded('.') == set(['nasa_meta.xml'])
コード例 #18
0
def test_no_directories(tmpdir_ch):
    call_cmd('ia --insecure download --no-directories nasa nasa_meta.xml')
    assert files_downloaded('.') == set(['nasa_meta.xml'])
コード例 #19
0
def test_no_directories(tmpdir_ch):
    call_cmd("ia --insecure download --no-directories nasa nasa_meta.xml")
    assert files_downloaded(".") == set(["nasa_meta.xml"])
コード例 #20
0
def test_no_args(tmpdir_ch):
    call_cmd('ia --insecure download nasa')
    assert files_downloaded(path='nasa') == NASA_EXPECTED_FILES
コード例 #21
0
def test_https(tmpdir_ch):
    call_cmd('ia download nasa')
    assert files_downloaded(path='nasa') == NASA_EXPECTED_FILES
コード例 #22
0
def test_format(tmpdir_ch):
    call_cmd('ia --insecure download --format="Archive BitTorrent" nasa')
    assert files_downloaded(path='nasa') == set(['nasa_archive.torrent'])
コード例 #23
0
def test_no_args(tmpdir_ch):
    call_cmd('ia --insecure download nasa')
    assert files_downloaded(path='nasa') == NASA_EXPECTED_FILES
コード例 #24
0
def test_format(tmpdir_ch):
    call_cmd('ia --insecure download --format="Archive BitTorrent" nasa')
    assert files_downloaded(path='nasa') == set(['nasa_archive.torrent'])