Exemplo n.º 1
0
def test_validate_logo(requests_mock, app_metadata_json, app_metadata_url, apps_json, categories_json):
    """Test whether exception is raised in case that logo URL location does not exist."""
    # Manipulate metadata.json endpoint to point logo to non-existant location.
    app_metadata_json['logo'] = 'path/to/file/that/does/not/exist.png'
    requests_mock.get(app_metadata_url, text=json.dumps(app_metadata_json))

    # Attempt to create the apps_meta.json file.
    with pytest.raises(exceptions.MissingLogo):
        apps_meta = make_pages.generate_apps_meta(apps_json, categories_json)
Exemplo n.º 2
0
def test_generate_apps_meta(apps_json, categories_json):
    apps_meta = make_pages.generate_apps_meta(apps_json, categories_json)
    # Very basic validation here, the apps_meta.json file is already validated via the schema:
    assert 'apps' in apps_meta
    assert 'categories' in apps_meta

    # Check that the test app metadata is present.
    assert 'test' in apps_meta['apps']
    assert apps_meta['apps']['test']['git_url'] == apps_json['test']['git_url']
    assert all(cat in apps_meta['categories'] for cat in apps_meta['apps']['test']['categories'])
Exemplo n.º 3
0
def test_get_logo_url(apps_json, categories_json, app_logo_url):
    """Test whether the logo url is correctly resolved."""
    apps_meta = make_pages.generate_apps_meta(apps_json, categories_json)
    assert apps_meta['apps']['test']['logo'] == app_logo_url
    r = requests.get(app_logo_url)
    assert r.status_code == 200