示例#1
0
def test_firefox_version_ensures_it_does_not_have_multiple_type(
        monkeypatch, version_string):
    # Let's make sure the sanity checks detect a broken regular expression
    monkeypatch.setattr(mozilla_version.firefox, '_VALID_VERSION_PATTERN',
                        _SUPER_PERMISSIVE_PATTERN)

    with pytest.raises(TooManyTypesError):
        FirefoxVersion(version_string)
示例#2
0
def _check_version_matches_package_name(version, package_name):
    sanitized_version = FirefoxVersion(version)

    if (
        (package_name == 'org.mozilla.firefox' and sanitized_version.is_release) or
        # Due to project Dawn, Nightly is now using the Aurora package name. See bug 1357351.
        (package_name == 'org.mozilla.fennec_aurora' and sanitized_version.is_nightly) or
        (
            # XXX Betas aren't following the regular XX.0bY format. Instead they follow XX.0
            # (which looks like release). Therefore, we can't use sanitized_version.is_beta
            package_name == 'org.mozilla.firefox_beta'
            and sanitized_version.is_release
            and sanitized_version.minor_number == 0
            # We ensure the patch_number is undefined. Calling sanitized_version.patch_number
            # directly raises an (expected) AttributeError
            and getattr(sanitized_version, 'patch_number', None) is None
        )
    ):
        logger.info('Firefox version "{}" matches package name "{}"'.format(version, package_name))

    else:
        raise BadApk('Wrong version number "{}" for package name "{}"'.format(version, package_name))
示例#3
0
def test_firefox_version_implements_remaining_comparision_operators():
    assert FirefoxVersion('32.0') <= FirefoxVersion('32.0')
    assert FirefoxVersion('32.0') <= FirefoxVersion('33.0')

    assert FirefoxVersion('33.0') >= FirefoxVersion('32.0')
    assert FirefoxVersion('33.0') >= FirefoxVersion('33.0')

    assert FirefoxVersion('33.0') > FirefoxVersion('32.0')
    assert not FirefoxVersion('33.0') > FirefoxVersion('33.0')

    assert not FirefoxVersion('32.0') < FirefoxVersion('32.0')

    assert FirefoxVersion('33.0') != FirefoxVersion('32.0')
示例#4
0
def test_firefox_version_implements_eq_operator(equivalent_version_string):
    assert FirefoxVersion('32.0') == FirefoxVersion(equivalent_version_string)
示例#5
0
def test_firefox_version_implements_lt_operator(previous, next):
    assert FirefoxVersion(previous) < FirefoxVersion(next)
示例#6
0
def test_firefox_version_is_of_a_defined_type(version_string, expected_type):
    release = FirefoxVersion(version_string)
    assert getattr(release, 'is_{}'.format(expected_type))
示例#7
0
def test_firefox_version_raises_when_invalid_version_is_given(version_string):
    with pytest.raises(InvalidVersionError):
        FirefoxVersion(version_string)
示例#8
0
def test_firefox_version_implements_str_operator(version_string):
    assert str(FirefoxVersion(version_string)) == version_string