~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/registry/browser/tests/test_distroseries.py

[r=allenap][bug=826752] Fix grammar in notification message when
        syncing a single package on DistroSeries:+localpackagediffs and
        its siblings.

Show diffs side-by-side

added added

removed removed

Lines of Context:
70
70
    )
71
71
from lp.services.features.testing import FeatureFixture
72
72
from lp.services.utils import utc_now
 
73
from lp.soyuz.browser.archive import copy_asynchronously_message
73
74
from lp.soyuz.enums import (
74
75
    ArchivePermissionType,
75
76
    PackagePublishingStatus,
97
98
    normalize_whitespace,
98
99
    person_logged_in,
99
100
    StormStatementRecorder,
 
101
    TestCase,
100
102
    TestCaseWithFactory,
101
103
    with_celebrity_logged_in,
102
104
    )
1938
1940
        pu = self.factory.makePackageUpload(distroseries=dsd.derived_series)
1939
1941
        # A copy job with an attached packageupload means the job is
1940
1942
        # waiting in the queues.
1941
 
        removeSecurityProxy(pu).package_copy_job=pcj.id
 
1943
        removeSecurityProxy(pu).package_copy_job = pcj.id
1942
1944
        view.pending_syncs = {dsd.source_package_name.name: pcj}
1943
1945
        expected = (
1944
1946
            'waiting in <a href="%s/+queue?queue_state=%s">%s</a>&hellip;'
2063
2065
        notifications = view.request.response.notifications
2064
2066
        self.assertEqual(1, len(notifications))
2065
2067
        self.assertIn(
2066
 
            "<p>Requested sync of 1 packages.</p>",
 
2068
            "<p>Requested sync of 1 package.</p>",
2067
2069
            notifications[0].message)
2068
2070
        # 302 is a redirect back to the same page.
2069
2071
        self.assertEqual(302, view.request.response.getStatus())
2280
2282
            self.assertEqual(1, len(view.cached_differences.batch))
2281
2283
 
2282
2284
 
 
2285
class TestCopyAsynchronouslyMessage(TestCase):
 
2286
    """Test the helper function `copy_asynchronously_message`."""
 
2287
 
 
2288
    def test_zero_packages(self):
 
2289
        self.assertEqual(
 
2290
            "<p>Requested sync of 0 packages.</p><p>Please allow "
 
2291
            "some time for these to be processed.</p>",
 
2292
            copy_asynchronously_message(0).escapedtext)
 
2293
 
 
2294
    def test_one_package(self):
 
2295
        self.assertEqual(
 
2296
            "<p>Requested sync of 1 package.</p><p>Please allow "
 
2297
            "some time for these to be processed.</p>",
 
2298
            copy_asynchronously_message(1).escapedtext)
 
2299
 
 
2300
    def test_multiple_packages(self):
 
2301
        self.assertEqual(
 
2302
            "<p>Requested sync of 5 packages.</p><p>Please allow "
 
2303
            "some time for these to be processed.</p>",
 
2304
            copy_asynchronously_message(5).escapedtext)
 
2305
 
 
2306
 
2283
2307
class TestDistroSeriesNeedsPackagesView(TestCaseWithFactory):
2284
2308
    """Test the distroseries +needs-packaging view."""
2285
2309