예제 #1
0
    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"}
예제 #2
0
    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
예제 #3
0
    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
예제 #4
0
    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
예제 #5
0
 def test_noAvailableVersions(self):
     manager = PackageManager(MagicMock())
     assert manager.checkIfPackageCanUpdate("beep") is False
예제 #6
0
    def test_addNewVersionThatCantUpdate(self):
        manager = PackageManager(MagicMock())
        manager.checkIfPackageCanUpdate = MagicMock(return_value=False)
        manager.addAvailablePackageVersion("beep", Version("1.0.0"))

        assert manager.packagesWithUpdate == set()