Пример #1
0
    def test_getComponentOverride_default_component(self):
        # getComponentOverride also accepts a component object (as
        # opposed to a component's name).
        component = getUtility(IComponentSet)['universe']
        component_name = UnknownOverridePolicy.getComponentOverride(component)

        self.assertEqual('universe', component_name)
Пример #2
0
    def test_getComponentOverride_default_component(self):
        # getComponentOverride also accepts a component object (as
        # opposed to a component's name).
        component = getUtility(IComponentSet)['universe']
        component_name = UnknownOverridePolicy.getComponentOverride(component)

        self.assertEqual('universe', component_name)
Пример #3
0
    def processUnknownFile(self, uploaded_file, override=None):
        """Apply a set of actions for newly-uploaded (unknown) files.

        Here we use the override, if specified, or simply default to the policy
        defined in UnknownOverridePolicy.

        In the case of a PPA, files are not touched.  They are always
        overridden to 'main' at publishing time, though.

        All files are also marked as new unless it's a PPA file, which are
        never considered new as they are auto-accepted.

        COPY archive build uploads are also auto-accepted, otherwise they
        would sit in the NEW queue since it's likely there's no ancestry.
        """
        if self.is_ppa or self.policy.archive.is_copy:
            return

        # All newly-uploaded, non-PPA files must be marked as new so that
        # the upload goes to the correct queue.  PPA uploads are always
        # auto-accepted so they are never new.
        uploaded_file.new = True

        if self.is_partner:
            # Don't override partner uploads.
            return

        # Use the specified override, or delegate to UnknownOverridePolicy.
        if override:
            uploaded_file.component_name = override.component.name
            return
        component_name_override = UnknownOverridePolicy.getComponentOverride(
            uploaded_file.component_name)
        uploaded_file.component_name = component_name_override
Пример #4
0
    def processUnknownFile(self, uploaded_file, override=None):
        """Apply a set of actions for newly-uploaded (unknown) files.

        Here we use the override, if specified, or simply default to the policy
        defined in UnknownOverridePolicy.

        In the case of a PPA, files are not touched.  They are always
        overridden to 'main' at publishing time, though.

        All files are also marked as new unless it's a PPA file, which are
        never considered new as they are auto-accepted.

        COPY archive build uploads are also auto-accepted, otherwise they
        would sit in the NEW queue since it's likely there's no ancestry.
        """
        if self.is_ppa or self.policy.archive.is_copy:
            return

        # All newly-uploaded, non-PPA files must be marked as new so that
        # the upload goes to the correct queue.  PPA uploads are always
        # auto-accepted so they are never new.
        uploaded_file.new = True

        if self.is_partner:
            # Don't override partner uploads.
            return

        # Use the specified override, or delegate to UnknownOverridePolicy.
        if override:
            uploaded_file.component_name = override.component.name
            return
        component_name_override = UnknownOverridePolicy.getComponentOverride(
            uploaded_file.component_name)
        uploaded_file.component_name = component_name_override
Пример #5
0
    def test_getComponentOverride_return_component(self):
        # Passing return_component=True to getComponentOverride makes it
        # return the Component object (as opposed to the component's
        # name).
        universe_component = getUtility(IComponentSet)['universe']
        component = UnknownOverridePolicy.getComponentOverride(
            universe_component, return_component=True)

        self.assertEqual(universe_component, component)
Пример #6
0
    def test_getComponentOverride_return_component(self):
        # Passing return_component=True to getComponentOverride makes it
        # return the Component object (as opposed to the component's
        # name).
        universe_component = getUtility(IComponentSet)['universe']
        component = UnknownOverridePolicy.getComponentOverride(
            universe_component, return_component=True)

        self.assertEqual(universe_component, component)
Пример #7
0
    def test_getComponentOverride_default_name(self):
        # getComponentOverride returns the default component name when an
        # unknown component name is passed.
        component_name = UnknownOverridePolicy.getComponentOverride('no-name')

        self.assertEqual('universe', component_name)
Пример #8
0
    def test_getComponentOverride_default_name(self):
        # getComponentOverride returns the default component name when an
        # unknown component name is passed.
        component_name = UnknownOverridePolicy.getComponentOverride('no-name')

        self.assertEqual('universe', component_name)