~ursinha/lp-qa-tools/bzr-tarmacland

« back to all changes in this revision

Viewing changes to tests/test_lpland.py

  • Committer: Diogo Matsubara
  • Date: 2010-09-09 12:27:00 UTC
  • mto: This revision was merged to the branch mainline in revision 73.
  • Revision ID: diogo.matsubara@canonical.com-20100909122700-5upkmmw24qux6iel
Implements additional options to the lpland.py plugin: removes the restriction to use the --no-qa and --incremental option together and implements the --rollback option.

Show diffs side-by-side

added added

removed removed

Lines of Context:
141
141
        self.assertRaises(MissingBugsIncrementalError,
142
142
            get_qa_clause, bugs, no_qa, incr)
143
143
 
 
144
    def test_bugs_incr_and_noqa_option_given(self):
 
145
        bug1 = FakeBug(20)
 
146
        no_qa = True
 
147
        incr = True
 
148
        self.assertEqual('[no-qa][incr]',
 
149
            get_qa_clause([bug1], no_qa, incr))
 
150
 
 
151
    def test_rollback_given(self):
 
152
        bugs = None
 
153
        self.assertEqual('[rollback=123]',
 
154
            get_qa_clause(bugs, rollback=123))
 
155
 
 
156
    def test_rollback_and_noqa_and_incr_given(self):
 
157
        bugs = None
 
158
        no_qa = True
 
159
        incr = True
 
160
        self.assertEqual('[rollback=123]',
 
161
            get_qa_clause(bugs, rollback=123))
 
162
 
144
163
 
145
164
class TestGetReviewerHandle(unittest.TestCase):
146
165
    """Tests for `get_reviewer_handle`."""
252
271
            self.mp.get_commit_message("Foobaring the sbrubble.",
253
272
                testfix, no_qa, incr))
254
273
 
 
274
    def test_commit_with_noqa_and_incr(self):
 
275
        incr = True
 
276
        no_qa = True
 
277
        testfix = False
 
278
 
 
279
        self.mp.get_bugs = FakeMethod([self.fake_bug])
 
280
        self.mp.get_reviews = FakeMethod({None : [self.fake_person]})
 
281
 
 
282
        self.assertEqual(
 
283
            "[r=foo][ui=none][bug=20][no-qa][incr] Foobaring the sbrubble.",
 
284
            self.mp.get_commit_message("Foobaring the sbrubble.", 
 
285
                testfix, no_qa, incr))
 
286
 
 
287
    def test_commit_with_rollback(self):
 
288
        self.mp.get_bugs = FakeMethod([self.fake_bug])
 
289
        self.mp.get_reviews = FakeMethod({None : [self.fake_person]})
 
290
 
 
291
        self.assertEqual(
 
292
            "[r=foo][ui=none][bug=20][rollback=123] Foobaring the sbrubble.",
 
293
            self.mp.get_commit_message("Foobaring the sbrubble.", 
 
294
                rollback=123))
 
295
 
255
296
 
256
297
class TestGetReviewerClause(unittest.TestCase):
257
298
    """Tests for `get_reviewer_clause`."""