Пример #1
0
def test_from_json():
    rpms = InstalledRpms(context_wrap(RPMS_JSON))
    assert isinstance(rpms.get_max("log4j").source, InstalledRpm)
    assert len(rpms.packages) == len(RPMS_JSON.splitlines())
    assert rpms.get_max("log4j").source.name == "log4j"
    assert rpms.get_max("util-linux").epoch == '0'
    assert rpms.get_max("jboss-servlet-3.0-api").redhat_signed
Пример #2
0
def test_max_min_kernel():
    rpms = InstalledRpms(context_wrap(RPMS_MULTIPLE_KERNEL))
    assert rpms.get_min('kernel').package == 'kernel-3.10.0-327.el7'
    assert rpms.get_max('kernel').package == 'kernel-3.10.0-327.36.1.el7'
    assert rpms.get_min(
        'kernel-devel').package == 'kernel-devel-3.10.0-327.el7'
    assert rpms.get_max(
        'kernel-devel').package == 'kernel-devel-3.10.0-327.36.1.el7'
Пример #3
0
def test_from_line():
    rpms = InstalledRpms(context_wrap(RPMS_LINE))
    assert rpms.get_max("ConsoleKit").arch == 'x86_64'
    assert rpms.get_max("kernel").version == '2.6.32'
    assert rpms.get_max("yum").release == '69.el6'
    assert rpms.get_max("tftp-server").version == '5.2'
    assert rpms.get_max("yum").package == "yum-3.2.29-69.el6"
    assert rpms.corrupt is False
Пример #4
0
def test_from_json():
    rpms = InstalledRpms(context_wrap(RPMS_JSON))
    assert isinstance(rpms.get_max("log4j").source, InstalledRpm)
    assert len(rpms.packages) == len(RPMS_JSON.splitlines())
    assert rpms.get_max("log4j").source.name == "log4j"
    assert rpms.get_max("util-linux").epoch == '0'
    assert rpms.get_max("jboss-servlet-3.0-api").redhat_signed

    assert rpms.newest('libnl').vendor == '(none)'
    assert rpms.newest('crash').vendor == 'Red Hat, Inc.'
    assert rpms.newest('log4j').vendor is None
Пример #5
0
def test_oracleasmrpms():
    # Oracle RPMs have a weird format - fix that in the read process
    ora_rpms = InstalledRpms(context_wrap(ORACLEASM_RPMS))
    assert ora_rpms is not None
    assert 'oracleasm' in ora_rpms.packages
    assert ora_rpms.get_max('oracleasm').version == '2.6.18-164.el5-2.0.5'
    assert ora_rpms.get_max('oracleasm').release == '1.el5'
    assert 'oracleasmlib' in ora_rpms.packages
    assert ora_rpms.get_max('oracleasmlib').version == '2.0.4'
    assert ora_rpms.get_max('oracleasmlib').release == '1.el5'
    assert 'oracleasm-support' in ora_rpms.packages
    assert ora_rpms.get_max('oracleasm-support').version == '2.1.3'
    assert ora_rpms.get_max('oracleasm-support').release == '1.el5'
Пример #6
0
def test_epoch():
    rpms = InstalledRpms(context_wrap(RPMS_PACKAGE))
    # no epoch
    rpm = rpms.get_max('openldap')
    assert rpm.package_with_epoch == 'openldap-0:2.4.23-31.el6'
    assert rpm.nevra == 'openldap-0:2.4.23-31.el6.x86_64'

    rpms = InstalledRpms(context_wrap(RPMS_JSON))
    # epoch 0
    rpm = rpms.get_max('log4j')
    assert rpm.package_with_epoch == 'log4j-0:1.2.17-15.el7'
    assert rpm.nevra == 'log4j-0:1.2.17-15.el7.noarch'
    # epoch (none)
    rpm = rpms.get_max('kbd-misc')
    assert rpm.package_with_epoch == 'kbd-misc-0:1.15.5-11.el7'
    assert rpm.nevra == 'kbd-misc-0:1.15.5-11.el7.noarch'
    # epoch 1
    rpm = rpms.get_max('grub2-tools')
    assert rpm.package_with_epoch == 'grub2-tools-1:2.02-0.34.el7_2'
    assert rpm.nevra == 'grub2-tools-1:2.02-0.34.el7_2.x86_64'
Пример #7
0
def test_from_line():
    rpms = InstalledRpms(context_wrap(RPMS_LINE))
    assert rpms.get_max("ConsoleKit").arch == 'x86_64'
    assert rpms.get_max("kernel").version == '2.6.32'
    assert rpms.get_max("yum").release == '69.el6'
    assert rpms.get_max("tftp-server").version == '5.2'
    assert rpms.get_max("yum").package == "yum-3.2.29-69.el6"
    assert rpms.get_max("tftp-server").redhat_signed is None
    assert rpms.get_max("yum").redhat_signed
    assert rpms.corrupt is False

    assert rpms.newest('BESAgent').vendor == 'IBM Corp.'
    assert rpms.newest('yum').vendor == 'Red Hat, Inc.'
    assert rpms.newest('kernel').vendor is None
Пример #8
0
def test_vmaas():
    rpms = InstalledRpms(context_wrap(RPMS_VMAAS))
    rpm = rpms.get_max("compat-libstdc++-296")
    assert isinstance(rpm, InstalledRpm)
    assert rpm.version == "2.96"
    assert rpm.release == "144.el6"

    rpm = rpms.get_max("compat-libstdc++-33")
    assert isinstance(rpm, InstalledRpm)
    assert rpm.version == "3.2.3"
    assert rpm.release == "72.el7"

    rpm = rpms.get_max("flash-plugin")
    assert isinstance(rpm, InstalledRpm)
    assert rpm.version == "32.0.0.171"
    assert rpm.release == "1.el6_10"

    rpm = rpms.get_max("glibc")
    assert isinstance(rpm, InstalledRpm)
    assert rpm.version == "2.12"
    assert rpm.release == "1.149.el6_6.5"

    rpm = rpms.get_max("infinipath-psm")
    assert isinstance(rpm, InstalledRpm)
    assert rpm.version == "3.3"
    assert rpm.release == "19_g67c0807_open.el6"

    rpm = rpms.get_max("kmod-fnic")
    assert isinstance(rpm, InstalledRpm)
    assert rpm.version == "1.6.0.12b"
    assert rpm.release == "rhel6u6.el6"

    rpm = rpms.get_max("krb5-libs")
    assert isinstance(rpm, InstalledRpm)
    assert rpm.version == "1.10.3"
    assert rpm.release == "65.el6"

    rpm = rpms.get_max("libaio-devel")
    assert isinstance(rpm, InstalledRpm)
    assert rpm.version == "0.3.107"
    assert rpm.release == "10.el6"

    rpm = rpms.get_max("mdadm")
    assert isinstance(rpm, InstalledRpm)
    assert rpm.version == "4.1"
    assert rpm.release == "rc1_2.el7"

    rpm = rpms.get_max("nagios-plugins-disk")
    assert isinstance(rpm, InstalledRpm)
    assert rpm.version == "2.2.1"
    assert rpm.release == "16.20180725git3429dad.el7"

    rpm = rpms.get_max("TaniumClient")
    assert isinstance(rpm, InstalledRpm)
    assert rpm.version == "7.2.314.3211"
    assert rpm.release == "1.rhe7"

    rpm = rpms.get_max("xymon")
    assert isinstance(rpm, InstalledRpm)
    assert rpm.version == "4.3.25"
    assert rpm.release == "1.el6"

    rpm = rpms.get_max("xz")
    assert isinstance(rpm, InstalledRpm)
    assert rpm.version == "5.2.2"
    assert rpm.release == "1.el7"

    rpm = rpms.get_max("xz-libs")
    assert isinstance(rpm, InstalledRpm)
    assert rpm.version == "5.2.2"
    assert rpm.release == "1.el7"
Пример #9
0
def test_gpgkey():
    rpms = InstalledRpms(context_wrap(RPMS_GPG_PUBKEY))
    assert isinstance(rpms.get_max("gpg-pubkey"), InstalledRpm)
    assert len(rpms.packages) == 1
    assert rpms.get_max("gpg-pubkey").name == "gpg-pubkey"
Пример #10
0
def test_unicode_char_in_rpms():
    rpms = InstalledRpms(context_wrap(RPMS_PACKAGE_WITH_UNICODE))
    assert u"openobex\u018e" in rpms.packages
    rpm = rpms.get_max(u'openobex\u018e')
    assert rpm.package == u'openobex\u018e-1.4-7.el6'
Пример #11
0
def test_max_min_not_found():
    rpms = InstalledRpms(context_wrap(RPMS_MULTIPLE_KERNEL))
    assert rpms.get_min('abc') is None
    assert rpms.get_max('abc') is None
Пример #12
0
def test_max_min():
    rpms = InstalledRpms(context_wrap(RPMS_MULTIPLE))
    assert rpms.get_min('yum').package == 'yum-3.4.2-132.el7'
    assert rpms.get_max('yum').package == 'yum-3.4.3-132.el7'
Пример #13
0
def test_package_property_aliases():
    rpms = InstalledRpms(context_wrap(RPMS_JSON))
    rpm = rpms.get_max("grub2-tools")
    assert rpm.package == "grub2-tools-2.02-0.34.el7_2"
    assert rpm.nvr == "grub2-tools-2.02-0.34.el7_2"
    assert rpm.nvra == "grub2-tools-2.02-0.34.el7_2.x86_64"
def test_from_json():
    rpms = InstalledRpms(context_wrap(RPMS_JSON))
    assert isinstance(rpms.get_max("log4j").source, InstalledRpm)
    assert len(rpms.packages) == len(RPMS_JSON.splitlines())
    assert rpms.get_max("log4j").source.name == "log4j"