Exemplo n.º 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"}
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 5
0
 def test_noAvailableVersions(self):
     manager = PackageManager(MagicMock())
     assert manager.checkIfPackageCanUpdate("beep") is False
Exemplo n.º 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()