Пример #1
0
def test_tar_repo(tmpdir):
    create_test_repo()
    tarball = join(tmpdir, "up.tar")
    dt.write_reference(dt.mirror_dir)
    create_test_repo("win-32")
    dt.tar_repo(dt.mirror_dir, tarball)
    assert isfile(tarball)
Пример #2
0
def test_write_and_read_reference_with_target(tmpdir):
    create_test_repo()
    dt.write_reference(join(tmpdir, "repo"),
                       join(tmpdir, "reference_target.json"))
    ref = dt.read_reference(join(tmpdir, "reference_target.json"))
    assert ref[join(dt.mirror_dir,
                    "linux-64")]["a-1.0-0.tar.bz2"]["md5"] == EMPTY_MD5
Пример #3
0
def test_tar_repo_with_target(tmpdir):
    create_test_repo()
    tarball = join(tmpdir, "updates_target.tar")
    reference = join(tmpdir, "reference_target.json")
    dt.write_reference(dt.mirror_dir, reference)
    create_test_repo("win-32")
    dt.tar_repo(dt.mirror_dir, reference, tarball)
    assert isfile(tarball)
Пример #4
0
def test_get_updates(tmpdir):
    create_test_repo()
    dt.write_reference(join(tmpdir, 'repo'))
    assert list(dt.get_updates(dt.mirror_dir)) == []

    create_test_repo('win-32')
    lst = sorted(dt.get_updates(dt.mirror_dir))
    assert lst == ['win-32/a-1.0-0.tar.bz2',
                   'win-32/repodata.json',
                   'win-32/repodata.json.bz2']
Пример #5
0
def test_get_updates(tmpdir):
    create_test_repo()
    dt.write_reference(join(tmpdir, "repo"))
    assert list(dt.get_updates(dt.mirror_dir)) == []

    create_test_repo("win-32")
    lst = sorted(dt.get_updates(dt.mirror_dir))
    assert lst == [
        "win-32/a-1.0-0.tar.bz2",
        "win-32/repodata.json",
        "win-32/repodata.json.bz2",
    ]
Пример #6
0
def test_get_updates_with_target(tmpdir):
    create_test_repo()
    dt.write_reference(join(tmpdir, "repo"),
                       join(tmpdir, "reference_target.json"))
    assert list(
        dt.get_updates(dt.mirror_dir, join(tmpdir,
                                           "reference_target.json"))) == []

    create_test_repo("win-32")
    lst = sorted(
        pathlib.Path(f) for f in dt.get_updates(
            dt.mirror_dir, join(tmpdir, "reference_target.json")))
    assert lst == [
        pathlib.Path("win-32/a-1.0-0.tar.bz2"),
        pathlib.Path("win-32/repodata.json"),
        pathlib.Path("win-32/repodata.json.bz2"),
    ]
Пример #7
0
def test_tar_repo(tmpdir):
    create_test_repo()
    dt.write_reference(dt.mirror_dir)
    create_test_repo("win-32")
    dt.tar_repo(dt.mirror_dir)
    assert isfile(dt.DEFAULT_UPDATE_PATH)
Пример #8
0
def test_write_and_read_reference(tmpdir):
    create_test_repo()
    dt.write_reference(join(tmpdir, 'repo'))
    ref = dt.read_reference()
    assert ref[join(dt.mirror_dir, 'linux-64')]['a-1.0-0.tar.bz2']['md5'] == \
        EMPTY_MD5