def installed_removed(self, base): try: base.build_transaction() except dnf.exceptions.DepsolveError: self.fail() installed = base._transaction.install_set removed = base._transaction.remove_set return installed, removed
def test_build_transaction(self): base = support.MockYumBase("updates") base.update(pattern="pepper") self.assertTrue(base.build_transaction()) base.ds_callback.assert_has_calls(mock.call.start()) base.ds_callback.assert_has_calls(mock.call.pkg_added(mock.ANY, 'ud')) base.ds_callback.assert_has_calls(mock.call.pkg_added(mock.ANY, 'u')) self.assertLength(base.transaction, 1)
def assertResult(self, base, pkgs): """Check whether the system contains the given pkgs. pkgs must be present. Any other pkgs result in an error. Pkgs are present if they are in the rpmdb and are not REMOVEd or they are INSTALLed. """ try: base.build_transaction() except dnf.exceptions.DepsolveError: self.fail() installed = set(dnf.queries.installed_by_name(base.sack, None)) map(installed.remove, base._transaction.remove_set) installed.update(base._transaction.install_set) self.assertItemsEqual(installed, pkgs)
def installed_removed(self, base): (rcode, rstring) = base.build_transaction() self.assertNotEqual(rcode, 1) installed = base._transaction.install_set removed = base._transaction.remove_set return installed, removed