def test_addMultipleVersions(self): manager = PackageManager(MagicMock()) manager.checkIfPackageCanUpdate = MagicMock(return_value=True) manager.addAvailablePackageVersion("beep", Version("1.2.0")) manager.addAvailablePackageVersion("beep", Version("1.0.0")) assert manager.packagesWithUpdate == {"beep"}
def test_newerVersionIsInstalled(self): manager = PackageManager(MagicMock()) manager.addAvailablePackageVersion("beep", Version("1.0.0")) manager._installed_package_dict = { "beep": { "package_info": { "package_version": "1.9.1" } } } assert manager.checkIfPackageCanUpdate("beep") is False
def test_olderVersionIsBundled(self): manager = PackageManager(MagicMock()) manager.addAvailablePackageVersion("beep", Version("1.0.0")) manager._bundled_package_dict = { "beep": { "package_info": { "package_version": "0.9.0" } } } assert manager.checkIfPackageCanUpdate("beep") is True
def test_availableVersionNotInstalledOrBundled(self): manager = PackageManager(MagicMock()) manager.addAvailablePackageVersion("beep", Version("1.0.0")) # Even though we have a known package version, it's not installed / bundled, so we cant update assert manager.checkIfPackageCanUpdate("beep") is False
def test_addNewVersionThatCantUpdate(self): manager = PackageManager(MagicMock()) manager.checkIfPackageCanUpdate = MagicMock(return_value=False) manager.addAvailablePackageVersion("beep", Version("1.0.0")) assert manager.packagesWithUpdate == set()