Skip to content

Commit 2e4c0a0

Browse files
committed
tests: rw: Add bug.{close,addcomment,setstatus} tests
1 parent b150fbc commit 2e4c0a0

2 files changed

Lines changed: 20 additions & 3 deletions

File tree

bugzilla/bug.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ def close(self, resolution, dupeid=None, fixedin=None,
205205
You can optionally add a comment while closing the bug. Set 'isprivate'
206206
to True if you want that comment to be private.
207207
'''
208+
# Note: fedora bodhi uses this function
208209
ignore = private_in_it
209210
ignore = nomail
210211

@@ -283,6 +284,7 @@ def addcomment(self, comment, private=False,
283284
Add the given comment to this bug. Set private to True to mark this
284285
comment as private.
285286
'''
287+
# Note: fedora bodhi uses this function
286288
ignore = timestamp
287289
ignore = bz_gid
288290
ignore = worktime

tests/rw_functional.py

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -241,13 +241,28 @@ def test5ModifyStatus(self):
241241
self.assertEquals(len(bug.longdescs), desclen + 1)
242242
self.assertTrue("marked as a duplicate" in bug.longdescs[-1]["text"])
243243

244-
# Add lone comment
244+
# bz.setstatus test
245245
comment = ("adding lone comment at %s" % datetime.datetime.today())
246-
tests.clicomm(cmd + "--comment \"%s\" --private" % comment, bz)
247-
246+
bug.setstatus("POST", comment=comment, private=True)
248247
bug.refresh()
249248
self.assertEquals(bug.longdescs[-1]["is_private"], 1)
250249
self.assertEquals(bug.longdescs[-1]["text"], comment)
250+
self.assertEquals(bug.status, "POST")
251+
252+
# bz.close test
253+
fixed_in = str(datetime.datetime.today())
254+
bug.close("ERRATA", fixedin=fixed_in)
255+
bug.refresh()
256+
self.assertEquals(bug.status, "CLOSED")
257+
self.assertEquals(bug.resolution, "ERRATA")
258+
self.assertEquals(bug.fixed_in, fixed_in)
259+
260+
# bz.addcomment test
261+
comment = ("yet another test comment %s" % datetime.datetime.today())
262+
bug.addcomment(comment, private=False)
263+
bug.refresh()
264+
self.assertEquals(bug.longdescs[-1]["text"], comment)
265+
self.assertEquals(bug.longdescs[-1]["is_private"], 0)
251266

252267
# Reset state
253268
tests.clicomm(cmd + "--status %s" % origstatus, bz)

0 commit comments

Comments
 (0)