コード例 #1
0
def _check_all_architectures_and_api_levels_are_present(apks_metadata_per_paths):
    single_metadata = list(apks_metadata_per_paths.values())[0]
    firefox_version = single_metadata['firefox_version']

    expected_combos = get_expected_combos(firefox_version)

    current_combos = set([
        (metadata['architecture'], metadata['api_level'])
        for metadata in apks_metadata_per_paths.values()
    ])

    missing_combos = expected_combos - current_combos
    if missing_combos:
        raise BadSetOfApks('One or several APKs are missing for Firefox {}: {}'.format(
            firefox_version, craft_combos_pretty_names(missing_combos)
        ))

    extra_combos = current_combos - expected_combos
    if extra_combos:
        raise BadSetOfApks('One or several APKs are not allowed for Firefox {}: {}. \
Please make sure mozapkpublisher has allowed them to be uploaded.'.format(
            firefox_version, craft_combos_pretty_names(extra_combos)
        ))

    logger.info('Every expected APK was found!')
コード例 #2
0
def test_get_expected_combos(firefox_version, package_name, expected):
    assert get_expected_combos(firefox_version, package_name) == expected
コード例 #3
0
def test_empty_get_expected_combos():
    with pytest.raises(ValueError):
        get_expected_combos('8.0', 'some.package.name')
コード例 #4
0
def test_empty_get_expected_combos():
    with pytest.raises(ValueError):
        get_expected_combos('8.0')