コード例 #1
0
    def test_is_valid_errors(self, build_lb_image_for_env):
        """Test list_versions command"""
        pkgs = [{
            "manager": "pip",
            "package": "gtmunit1",
            "version": '0.2.4'
        }, {
            "manager": "pip",
            "package": "gtmunit2",
            "version": "100.00"
        }, {
            "manager": "pip",
            "package": "gtmunit3",
            "version": ""
        }, {
            "manager": "pip",
            "package": "asdfasdfasdf",
            "version": ""
        }]

        mrg = PipPackageManager()
        lb = build_lb_image_for_env[0]
        username = build_lb_image_for_env[1]
        result = mrg.validate_packages(pkgs, lb, username)

        assert result[0].package == "gtmunit1"
        assert result[0].version == "0.2.4"
        assert result[0].error is False

        assert result[1].package == "gtmunit2"
        assert result[1].version == "100.00"
        assert result[1].error is True

        assert result[2].package == "gtmunit3"
        assert result[2].version == "5.0"
        assert result[2].error is False

        assert result[3].package == "asdfasdfasdf"
        assert result[3].version == ""
        assert result[3].error is True
コード例 #2
0
    def test_is_valid_good(self, build_lb_image_for_env):
        """Test valid packages command"""
        pkgs = [{
            "manager": "pip",
            "package": "gtmunit3",
            "version": "4.15"
        }, {
            "manager": "pip",
            "package": "gtmunit2",
            "version": ""
        }]

        mrg = PipPackageManager()
        lb = build_lb_image_for_env[0]
        username = build_lb_image_for_env[1]
        result = mrg.validate_packages(pkgs, lb, username)

        assert result[0].package == "gtmunit3"
        assert result[0].version == "4.15"
        assert result[0].error is False

        assert result[1].package == "gtmunit2"
        assert result[1].version == "12.2"
        assert result[1].error is False