~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/registry/browser/tests/distributionsourcepackage-views.txt

  • Committer: Michael Nelson
  • Date: 2009-06-23 10:47:17 UTC
  • mto: (8697.14.16 bug-280958-ui2)
  • mto: This revision was merged to the branch mainline in revision 8721.
  • Revision ID: michael.nelson@canonical.com-20090623104717-4kiq8tqdazbwd3ay
Added view test with basic coverage...

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
DistributionSourcePackageView
 
2
=============================
 
3
 
 
4
The DistributionSourcePackageView is used to present a source
 
5
package within a distribution.
 
6
 
 
7
    # Setup the breezy autotest distroseries
 
8
    >>> login("foo.bar@canonical.com")
 
9
    >>> from lp.soyuz.tests.test_publishing import SoyuzTestPublisher
 
10
    >>> publisher = SoyuzTestPublisher()
 
11
    >>> publisher.prepareBreezyAutotest()
 
12
    >>> ubuntutest = publisher.ubuntutest
 
13
    >>> from lp.registry.interfaces.distroseries import DistroSeriesStatus
 
14
    >>> publisher.distroseries.status = DistroSeriesStatus.DEVELOPMENT
 
15
 
 
16
    # Publish the source 'gedit' in the ubuntutest main archive.
 
17
    >>> from datetime import datetime
 
18
    >>> import pytz
 
19
    >>> from lp.soyuz.interfaces.publishing import PackagePublishingStatus
 
20
    >>> gedit_main_src_hist = publisher.getPubSource(
 
21
    ...     sourcename="gedit", archive=ubuntutest.main_archive,
 
22
    ...     date_uploaded=datetime(2010, 12, 30, tzinfo=pytz.UTC),
 
23
    ...     status=PackagePublishingStatus.PUBLISHED)
 
24
 
 
25
The DistributionSourcePackageView includes a helper property
 
26
'all_published_in_active_distroseries' that returns a list of
 
27
all the published versions of the source package within the distribution's
 
28
serieses.
 
29
 
 
30
    >>> from canonical.launchpad.webapp.servers import LaunchpadTestRequest
 
31
    >>> from zope.component import getMultiAdapter
 
32
    >>> ubuntu_gedit = ubuntutest.getSourcePackage('gedit')
 
33
    >>> ubuntu_gedit_view = getMultiAdapter(
 
34
    ...     (ubuntu_gedit, LaunchpadTestRequest()), name="+index")
 
35
    >>> for result in ubuntu_gedit_view.all_published_in_active_distroseries:
 
36
    ...     print "%s - %s" % (
 
37
    ...         result['suite'], result['description'])
 
38
    Breezy-autotest - (666): main/base
 
39
 
 
40
Latest published PPA versions
 
41
-----------------------------
 
42
 
 
43
The view includes a latest_published_ppa_versions property which returns
 
44
a list of dictionaries describing the last three most-recently-uploaded
 
45
ppa versions of the package.
 
46
 
 
47
 
 
48
 
 
49