Exemplo n.º 1
0
    def test_package_with_version_is_present(self, mock_module):
        # given
        package = 'py37-conan-1.21.0'
        parseable_flag_not_supported = 1
        mock_module.run_command.side_effect = [
            (parseable_flag_not_supported,
             "pkgin 0.11.7 for Darwin-18.6.0 x86_64 (using SQLite 3.27.2)",
             None),
            (0, "%s = C/C++ package manager" % package, None),
        ]

        # when
        command_result = pkgin.query_package(mock_module, package)

        # then
        self.assertEquals(command_result, pkgin.PackageState.PRESENT)
Exemplo n.º 2
0
    def test_package_found_outdated(self, mock_module):
        # given
        package = 'cmake316'
        parseable_flag_not_supported = 1
        mock_module.run_command.side_effect = [
            (parseable_flag_not_supported,
             "pkgin 0.11.7 for Darwin-18.6.0 x86_64 (using SQLite 3.27.2)",
             None),
            (0, "cmake316-3.16.0nb1 < Cross platform make", None),
        ]

        # when
        command_result = pkgin.query_package(mock_module, package)

        # then
        self.assertEquals(command_result, pkgin.PackageState.OUTDATED)
Exemplo n.º 3
0
    def test_package_not_found(self, mock_module):
        # given
        package = 'cmake320-3.20.0nb1'
        parseable_flag_not_supported = 1
        mock_module.run_command.side_effect = [
            (parseable_flag_not_supported,
             "pkgin 0.11.7 for Darwin-18.6.0 x86_64 (using SQLite 3.27.2)",
             None),
            (1, None, "No results found for %s" % package),
        ]

        # when
        command_result = pkgin.query_package(mock_module, package)

        # then
        self.assertEquals(command_result, pkgin.PackageState.NOT_FOUND)