コード例 #1
0
    def test_deserialize_with_minimum_info(self):
        """Testing PackageRules.deserialize with minimum info"""
        bundle = PackageBundle()
        channel = PackageChannel(bundle)
        rules = PackageRules.deserialize(
            channel,
            {
                'version_range': '*',
                'package_type': 'rpm',
                'systems': ['centos', 'macosx'],
            })

        self.assertEqual(rules.version_range, '*')
        self.assertEqual(rules.package_type, PackageRules.PACKAGE_TYPE_RPM)
        self.assertEqual(rules.systems, ['centos', 'macosx'])
        self.assertEqual(rules.package_name, None)
        self.assertEqual(rules.required_dependencies, [])
        self.assertEqual(rules.recommended_dependencies, [])
        self.assertEqual(rules.optional_dependencies, [])
        self.assertEqual(rules.replaces, [])
        self.assertEqual(rules.pre_install_commands, [])
        self.assertEqual(rules.install_commands, [])
        self.assertEqual(rules.post_install_commands, [])
        self.assertEqual(rules.install_flags, [])
        self.assertEqual(rules.uninstall_commands, [])
コード例 #2
0
ファイル: package_channel.py プロジェクト: reviewboard/rbpkg
    def load(self):
        """Load data from the manifest file.

        The data from the manifest will be loaded and stored in this
        instance, allowing the caller to access it.
        """
        # Let the exceptions bubble up.
        data = get_data_loader().load_by_path(self.absolute_manifest_url)

        self._releases = []
        self._package_rules = []

        self.created_timestamp = \
            dateutil.parser.parse(data['created_timestamp'])
        self.last_updated_timestamp = \
            dateutil.parser.parse(data['last_updated_timestamp'])

        self._releases = [
            PackageRelease.deserialize(self, releases_data)
            for releases_data in data['releases']
        ]

        self._package_rules = [
            PackageRules.deserialize(self, rules_data)
            for rules_data in data['package_rules']
        ]

        self._loaded = True
コード例 #3
0
    def test_deserialize_with_all_info(self):
        """Testing PackageRules.deserialize with all available info"""
        bundle = PackageBundle()
        channel = PackageChannel(bundle)
        rules = PackageRules.deserialize(
            channel,
            {
                'version_range': '*',
                'package_type': 'rpm',
                'package_name': 'TestPackage',
                'systems': ['centos', 'macosx'],
                'dependencies': {
                    'required': ['foo'],
                    'recommended': ['bar'],
                    'optional': ['baz'],
                },
                'replaces': ['OldPackage'],
                'pre_install_commands': [
                    'echo pre-install',
                ],
                'install_commands': [
                    'echo install',
                ],
                'post_install_commands': [
                    'echo post-install',
                ],
                'install_flags': [
                    '--with-pie',
                    '--with-ice-cream',
                ],
                'uninstall_commands': [
                    'echo uninstall',
                ],
            })

        self.assertEqual(rules.version_range, '*')
        self.assertEqual(rules.package_type, PackageRules.PACKAGE_TYPE_RPM)
        self.assertEqual(rules.package_name, 'TestPackage')
        self.assertEqual(rules.systems, ['centos', 'macosx'])
        self.assertEqual(rules.required_dependencies, ['foo'])
        self.assertEqual(rules.recommended_dependencies, ['bar'])
        self.assertEqual(rules.optional_dependencies, ['baz'])
        self.assertEqual(rules.replaces, ['OldPackage'])
        self.assertEqual(rules.pre_install_commands, ['echo pre-install'])
        self.assertEqual(rules.install_commands, ['echo install'])
        self.assertEqual(rules.post_install_commands, ['echo post-install'])
        self.assertEqual(rules.install_flags,
                         ['--with-pie', '--with-ice-cream'])
        self.assertEqual(rules.uninstall_commands, ['echo uninstall'])