示例#1
0
async def test_can_get_info_for_a_single_project(aiohttp_client,
                                                 repodata_response):
    app = spackle.create_app()
    app.service.organize_packages(repodata_response, "main", '')
    client = await aiohttp_client(app)
    resp = await client.get("/project?project_name=aiohttp")
    assert resp.status == 200
    text = await resp.text()
    project_info = json.loads(text)
    assert project_info == {
        'packages': [{
            "aiohttp-0.0.00-abcd": {
                "build": "0",
                "build_number": 0,
                "date": "0000-00-00",
                "depends": [],
                "license_family": "other",
                "md5": "abcd",
                "name": "aiohttp",
                "size": 0,
                "subdir": "linux-64",
                "channel": "main",
                "version": "0.0.00"
            }
        }]
    }
示例#2
0
async def test_can_get_channel_data(aiohttp_client, repodata_response):
    app = spackle.create_app()
    app.service.organize_packages(repodata_response, "main", 'url')
    client = await aiohttp_client(app)
    resp = await client.get("/channels")
    assert resp.status == 200
    text = await resp.text()
    channel_info = json.loads(text)
    assert list(channel_info["channels"][0].keys()) == ["main"]
示例#3
0
async def test_can_get_the_list_of_project_names(aiohttp_client,
                                                 repodata_response):
    app = spackle.create_app()
    app.service.organize_packages(repodata_response, 'main', '')
    client = await aiohttp_client(app)
    resp = await client.get("/project_names")
    assert resp.status == 200
    project_list = await resp.json()
    project_names = project_list['projects']
    assert "aiohttp" in project_names
示例#4
0
async def test_can_get_static_content(aiohttp_client):
    app = spackle.create_app()
    client = await aiohttp_client(app)
    resp = await client.get("/tests/index.html")
    assert resp.status == 200