~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/soyuz/adapters/tests/test_overrides.py

  • Committer: Launchpad Patch Queue Manager
  • Date: 2011-08-23 19:50:35 UTC
  • mfrom: (13751.3.3 override-bug-826870)
  • Revision ID: launchpad@pqm.canonical.com-20110823195035-5xent8w8p7b04ky6
[r=julian-edwards][bug=826870] Fix UnknownOverridePolicy to put
        sources from debian into the right default component.

Show diffs side-by-side

added added

removed removed

Lines of Context:
149
149
                distroseries.main_archive, distroseries, pocket, bpns)
150
150
        self.assertThat(recorder, HasQueryCount(Equals(4)))
151
151
 
 
152
    def test_getComponentOverride_default_name(self):
 
153
        # getComponentOverride returns the default component name when an
 
154
        # unknown component name is passed.
 
155
        component_name = UnknownOverridePolicy.getComponentOverride('no-name')
 
156
 
 
157
        self.assertEqual('universe', component_name)
 
158
 
 
159
    def test_getComponentOverride_default_component(self):
 
160
        # getComponentOverride also accepts a component object (as
 
161
        # opposed to a component's name).
 
162
        component = getUtility(IComponentSet)['universe']
 
163
        component_name = UnknownOverridePolicy.getComponentOverride(component)
 
164
 
 
165
        self.assertEqual('universe', component_name)
 
166
 
 
167
    def test_getComponentOverride_return_component(self):
 
168
        # Passing return_component=True to getComponentOverride makes it
 
169
        # return the Component object (as opposed to the component's
 
170
        # name).
 
171
        universe_component = getUtility(IComponentSet)['universe']
 
172
        component = UnknownOverridePolicy.getComponentOverride(
 
173
            universe_component, return_component=True)
 
174
 
 
175
        self.assertEqual(universe_component, component)
 
176
 
152
177
    def test_unknown_sources(self):
153
178
        # If the unknown policy is used, it does no checks, just returns the
154
179
        # defaults.