Esempio n. 1
0
def test_get_version_project():
    assert Project.query.all() == []
    p = add_project('FooBar')
    add_version('FooBar', '1.0')
    for version in ['1', '1.0', '1.0.0']:
        v = get_version(p, version)
        assert v.project == p
        assert v.name == '1'
        assert v.display_name == '1.0'
        assert v.wheels == []
    assert get_version(p, '2.0') is None
Esempio n. 2
0
def test_get_version_project():
    assert Project.query.all() == []
    p = add_project("FooBar")
    add_version("FooBar", "1.0")
    for version in ["1", "1.0", "1.0.0"]:
        v = get_version(p, version)
        assert v.project == p
        assert v.name == "1"
        assert v.display_name == "1.0"
        assert v.wheels == []
    assert get_version(p, "2.0") is None
Esempio n. 3
0
def test_get_version_str():
    assert Project.query.all() == []
    add_project("FooBar")
    add_version("FooBar", "1.0")
    for project in ["foobar", "FooBar", "FOOBAR"]:
        for version in ["1", "1.0", "1.0.0"]:
            v = get_version(project, version)
            assert v.project.name == "foobar"
            assert v.name == "1"
            assert v.display_name == "1.0"
            assert v.wheels == []
    assert get_version("foobar", "2.0") is None
    assert get_version("quux", "2.0") is None
Esempio n. 4
0
def test_get_version_str():
    assert Project.query.all() == []
    add_project('FooBar')
    add_version('FooBar', '1.0')
    for project in ['foobar', 'FooBar', 'FOOBAR']:
        for version in ['1', '1.0', '1.0.0']:
            v = get_version(project, version)
            assert v.project.name == 'foobar'
            assert v.name == '1'
            assert v.display_name == '1.0'
            assert v.wheels == []
    assert get_version('foobar', '2.0') is None
    assert get_version('quux', '2.0') is None
Esempio n. 5
0
def test_remove_version():
    assert Project.query.all() == []
    p = add_project("FooBar")
    v1 = add_version(p, "1.0")
    whl1 = add_wheel(version=v1, **FOOBAR_1_WHEEL)
    v2 = add_version(p, "2.0")
    add_wheel(version=v2, **FOOBAR_2_WHEEL)
    remove_version("FooBar", "2.0")
    assert Project.query.all() == [p]
    assert get_version("foobar", "1.0") is not None
    assert get_version("foobar", "2.0") is None
    assert Version.query.all() == [v1]
    assert p.latest_version == v1
    assert Wheel.query.all() == [whl1]
    assert p.has_wheels
Esempio n. 6
0
def test_add_wheel():
    assert Wheel.query.all() == []
    p = add_project("FooBar")
    assert not p.has_wheels
    v1 = add_version(p, "1.0")
    whl1 = add_wheel(version=v1, **FOOBAR_1_WHEEL)
    assert Wheel.query.all() == [whl1]
    assert p.has_wheels
    v2 = add_version(p, "2.0")
    whl2 = add_wheel(version=v2, **FOOBAR_2_WHEEL)
    assert sort_wheels(Wheel.query.all()) == [whl1, whl2]
    assert v1.wheels == [whl1]
    assert v2.wheels == [whl2]
    assert get_version(p, "1.0").wheels == [whl1]
    assert get_version(p, "2.0").wheels == [whl2]
Esempio n. 7
0
def test_remove_project():
    assert Project.query.all() == []
    p = add_project("FooBar")
    v1 = add_version(p, "1.0")
    add_wheel(version=v1, **FOOBAR_1_WHEEL)
    v2 = add_version(p, "2.0")
    add_wheel(version=v2, **FOOBAR_2_WHEEL)
    q = add_project("quux")
    v3 = add_version(q, "1.5")
    whl3 = add_wheel(version=v3, **QUUX_1_5_WHEEL)
    remove_project("FooBar")
    assert Project.query.all() in ([p, q], [q, p])
    assert Version.query.all() == [v3]
    assert get_version("foobar", "1.0") is None
    assert get_version("foobar", "2.0") is None
    assert Wheel.query.all() == [whl3]
    assert p.latest_version is None
    assert not p.has_wheels
Esempio n. 8
0
def test_remove_project():
    assert Project.query.all() == []
    p = add_project('FooBar')
    v1 = add_version(p, '1.0')
    add_wheel(version=v1, **FOOBAR_1_WHEEL)
    v2 = add_version(p, '2.0')
    add_wheel(version=v2, **FOOBAR_2_WHEEL)
    q = add_project('quux')
    v3 = add_version(q, '1.5')
    whl3 = add_wheel(version=v3, **QUUX_1_5_WHEEL)
    remove_project('FooBar')
    assert Project.query.all() in ([p, q], [q, p])
    assert Version.query.all() == [v3]
    assert get_version('foobar', '1.0') is None
    assert get_version('foobar', '2.0') is None
    assert Wheel.query.all() == [whl3]
    assert p.latest_version is None
    assert not p.has_wheels