Exemplo n.º 1
0
def test_erased():
    yl = YumLog(context_wrap(OKAY))
    assert any(e.pkg.name == "redhat-access-insights-batch"
               for e in yl) is True
    assert any(e.pkg.name == "katello-agent" for e in yl) is True

    yl2 = YumLog(context_wrap(OKAY2))
    assert any(e.pkg.name == "systemd" for e in yl2) is True
Exemplo n.º 2
0
def test_present():
    yl = YumLog(context_wrap(OKAY))

    e = yl.present_packages.get('wget')
    assert e.pkg.name == 'wget'
    assert e.pkg.version == '1.14'

    e = yl.present_packages.get('openssl-libs')
    assert e.pkg.name == 'openssl-libs'
    assert e.pkg.version == '1.0.1e'
Exemplo n.º 3
0
def test_error():
    yl = YumLog(context_wrap(ERROR))

    e = yl.present_packages.get('wget')
    assert e.pkg.name == 'wget'
    assert e.pkg.version == '1.14'

    e = yl.present_packages.get('openssl-libs')
    assert e.pkg.name == 'openssl-libs'
    assert e.pkg.version == '1.0.1e'

    assert len(yl) == 8
Exemplo n.º 4
0
def test_exception_throwing():
    with pytest.raises(ParseException) as e_info:
        YumLog(context_wrap(THROWS_PARSEEXCEPTION))
    assert "YumLog could not parse" in str(e_info.value)
Exemplo n.º 5
0
def test_len():
    yl = YumLog(context_wrap(OKAY))
    assert len(yl) == 9
Exemplo n.º 6
0
def test_iteration():
    yl = YumLog(context_wrap(OKAY))
    indices = [i.idx for i in yl]
    assert indices == list(range(len(yl)))