#145 Fix bugimg for reopened bugs
Merged 4 years ago by lbrabec. Opened 4 years ago by lbrabec.

@@ -188,9 +188,12 @@ 

          return SVGResponse(_UNKNOWN_BUG_SVG_TEXT)

      else:

          info_all = []

-         # since the filtering is based on bugid, all the bug entries have the same status

-         # so we can use the first one

-         if bugs[0].status == "CLOSED":

+         # same bug can be in DB multiple times (for different milestones),

+         # only bugs in active milestones are updated, status of bug in

+         # inactive milestone will remain CLOSED even if bug is reopened for

+         # active milestone

+         # show BUG CLOSED when all bug entries in DB have status == "CLOSED"

+         if all([bug.status == "CLOSED" for bug in bugs]):

              info_all.append(_BUG_CLOSED)

          for bug in bugs:

              milestone_info = "%s: " % bug.milestone.name

file modified
+18 -1
@@ -39,6 +39,13 @@ 

          bug2 = add_bug(9002, 'testbug2', cls.milestone)

          bug2.accepted_blocker = False

          bug2.proposed_fe = True

+         bug3 = add_bug(9003, 'testbug3', cls.milestone)

+         bug3.accepted_blocker = False

+         bug3.proposed_fe = True

+         bug4 = add_bug(9003, 'testbug3', cls.milestone2) # same bugid and summary as bug3 is intentional

+         bug4.accepted_blocker = True

+         bug4.proposed_fe = False

+         bug4.status = 'CLOSED'

          cls.update_pending_stable = add_update(u'test-pending-stable.fc99',

                                                 u'stable', [bug1], cls.release,

                                                 [cls.milestone, cls.milestone2])
@@ -82,7 +89,7 @@ 

          resp = self.client.get(url)

          assert resp.status_code == httplib.OK

          data = json.loads(resp.data)

-         assert len(data) == 2

+         assert len(data) == 3

          bug = data[0]

          assert bug['bugid'] == 9000

          assert bug['url'] == 'https://bugzilla.redhat.com/show_bug.cgi?id=9000'
@@ -180,3 +187,13 @@ 

          data = str(resp.data)

  

          assert _BUG_CLOSED in data

+ 

+     def test_get_bugimg_multiple_bugs_unsynced_status(self):

+         url = '/api/v0/bugimg/9003'

+         resp = self.client.get(url)

+         assert resp.status_code == httplib.OK

+         data = str(resp.data)

+ 

+         assert '99-beta' in data

+         assert '99-final' in data

+         assert _BUG_CLOSED not in data

Bugimg showed bugs as closed when they weren't.
This happened when previously proposed and closed
bug (e.g. proposed for beta and solved) was reopened
and proposed again (e.g. for final). Bug sync won't
update bugs in inactive milestones, show CLOSED only
when all bugs with the same bugid have status CLOSED.

Fix for #144

Build succeeded.

Metadata Update from @kparal:
- Pull-request tagged with: next

4 years ago

Metadata Update from @kparal:
- Pull-request untagged with: next

4 years ago

rebased onto b5e7f27

4 years ago

Pull-Request has been merged by lbrabec

4 years ago

Build succeeded.