~launchpad-pqm/launchpad/devel

« back to all changes in this revision

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

[r=bac][bug=835024] New error_description property on
        InitializeDistroSeriesJob.

Show diffs side-by-side

added added

removed removed

Lines of Context:
70
70
        packageset2 = self.factory.makePackageset()
71
71
 
72
72
        overlays = (True, False)
73
 
        overlay_pockets = (('Updates',), ('Release',))
74
 
        overlay_components = (("main",), ("universe",))
 
73
        overlay_pockets = (u'Updates', u'Release')
 
74
        overlay_components = (u"main", u"universe")
75
75
        arches = (u'i386', u'amd64')
76
76
        packagesets = (packageset1.id, packageset2.id)
77
77
        rebuild = False
84
84
            "distribution: {distroseries.distribution.name}, "
85
85
            "distroseries: {distroseries.name}, "
86
86
            "parent[overlay?/pockets/components]: "
87
 
            "{parent1.name}[True/[u'Updates']/[u'main']],"
88
 
            "{parent2.name}[False/[u'Release']/[u'universe']], "
 
87
            "{parent1.name}[True/Updates/main],"
 
88
            "{parent2.name}[False/Release/universe], "
89
89
            "architectures: (u'i386', u'amd64'), "
90
90
            "packagesets: [u'{packageset1.name}', u'{packageset2.name}'], "
91
91
            "rebuild: False>".format(
99
99
            repr(job)
100
100
        )
101
101
 
102
 
 
103
102
    def test_create_with_existing_pending_job(self):
104
103
        parent = self.factory.makeDistroSeries()
105
104
        distroseries = self.factory.makeDistroSeries()
197
196
        self.assertIsInstance(job, InitializeDistroSeriesJob)
198
197
        self.assertEqual(job.distroseries, distroseries)
199
198
 
 
199
    def test_error_description_when_no_error(self):
 
200
        # The InitializeDistroSeriesJob.error_description property returns
 
201
        # None when no error description is recorded.
 
202
        parent = self.factory.makeDistroSeries()
 
203
        distroseries = self.factory.makeDistroSeries()
 
204
        job = self.job_source.create(distroseries, [parent.id])
 
205
        self.assertIs(None, removeSecurityProxy(job).error_description)
 
206
 
 
207
    def test_error_description_set_when_notifying_about_user_errors(self):
 
208
        # error_description is set by notifyUserError().
 
209
        parent = self.factory.makeDistroSeries()
 
210
        distroseries = self.factory.makeDistroSeries()
 
211
        job = self.job_source.create(distroseries, [parent.id])
 
212
        message = "This is an example message."
 
213
        job.notifyUserError(InitializationError(message))
 
214
        self.assertEqual(message, removeSecurityProxy(job).error_description)
 
215
 
200
216
 
201
217
class InitializeDistroSeriesJobTestsWithPackages(TestCaseWithFactory):
202
218
    """Test case for InitializeDistroSeriesJob."""