~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/soyuz/tests/test_archive.py

[r=julian-edwards][bug=789091] Fix InitialiseDistroSeries so that it
        actually initializes a derived series from multiple parents.

Show diffs side-by-side

added added

removed removed

Lines of Context:
10
10
    )
11
11
import doctest
12
12
 
13
 
from testtools.matchers import DocTestMatches, MatchesRegex
 
13
from testtools.matchers import (
 
14
    DocTestMatches,
 
15
    MatchesRegex,
 
16
    )
14
17
from testtools.testcase import ExpectedException
15
 
 
16
18
import transaction
17
19
from zope.component import getUtility
18
20
from zope.security.interfaces import Unauthorized
1905
1907
        self.assertEqual(3, cprov_archive.getPublishedSources(
1906
1908
            created_since_date=two_hours_earlier).count())
1907
1909
 
 
1910
    def test_getPublishedSources_name(self):
 
1911
        # The name parameter allows filtering with a list of
 
1912
        # names.
 
1913
        distroseries =  self.factory.makeDistroSeries()
 
1914
        # Create some SourcePackagePublishingHistory.
 
1915
        for package_name in ['package1', 'package2', 'package3']:
 
1916
            self.factory.makeSourcePackagePublishingHistory(
 
1917
                distroseries=distroseries,
 
1918
                archive=distroseries.main_archive,
 
1919
                sourcepackagename=self.factory.makeSourcePackageName(
 
1920
                    package_name))
 
1921
        filtered_sources = distroseries.main_archive.getPublishedSources(
 
1922
            name=['package1', 'package2'])
 
1923
 
 
1924
        self.assertEqual(
 
1925
            3,
 
1926
            distroseries.main_archive.getPublishedSources().count())
 
1927
        self.assertEqual(
 
1928
            2,
 
1929
            filtered_sources.count())
 
1930
        self.assertContentEqual(
 
1931
            ['package1', 'package2'],
 
1932
            [filtered_source.sourcepackagerelease.name for filtered_source in
 
1933
            filtered_sources])
 
1934
 
1908
1935
 
1909
1936
class TestSyncSource(TestCaseWithFactory):
1910
1937