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
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'
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
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)
def test_len(): yl = YumLog(context_wrap(OKAY)) assert len(yl) == 9
def test_iteration(): yl = YumLog(context_wrap(OKAY)) indices = [i.idx for i in yl] assert indices == list(range(len(yl)))