Skip to content

Commit

Permalink
Reorder subscribed bugs stat (keep closed last)
Browse files Browse the repository at this point in the history
  • Loading branch information
psss committed Feb 21, 2017
1 parent 9e760f9 commit 46ff186
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 22 deletions.
10 changes: 4 additions & 6 deletions did/plugins/bugzilla.py
Expand Up @@ -31,8 +31,8 @@
--bz-returned Bugs returned
--bz-verified Bugs verified
--bz-commented Bugs commented
--bz-closed Bugs closed
--bz-subscribed Bugs subscribed
--bz-closed Bugs closed
--bz All above
"""

Expand Down Expand Up @@ -561,7 +561,7 @@ def fetch(self):

class SubscribedBugs(Stats):
"""
Bugs Subscribed (CCed)
Bugs subscribed
All bugs subscribed by given user in requested time frame.
"""
Expand All @@ -586,9 +586,7 @@ def fetch(self):
"v4": self.user.email,
}
bugs = self.parent.bugzilla.search(query, options=self.options)
self.stats = [
bug for bug in bugs
if bug.subscribed(self.user)]
self.stats = [bug for bug in bugs if bug.subscribed(self.user)]


class BugzillaStats(StatsGroup):
Expand Down Expand Up @@ -632,6 +630,6 @@ def __init__(self, option, name=None, parent=None, user=None):
ReturnedBugs(option=option + "-returned", parent=self),
VerifiedBugs(option=option + "-verified", parent=self),
CommentedBugs(option=option + "-commented", parent=self),
ClosedBugs(option=option + "-closed", parent=self),
SubscribedBugs(option=option + "-subscribed", parent=self),
ClosedBugs(option=option + "-closed", parent=self),
]
32 changes: 16 additions & 16 deletions tests/plugins/test_bugzilla.py
Expand Up @@ -85,6 +85,21 @@ def test_bugzilla_returned():
assert not any([bug.id == 1229704 for bug in stats])


# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Subscribed Bugs
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

def test_bugzilla_subscribed():
""" Check subscribed bugs """
did.base.Config(CONFIG)
stats = did.cli.main([
"--bz-subscribed",
"--email", "Evgeni Golov <egolov@redhat.com>",
"--since", "2016-06-06",
"--until", "2016-06-12"])[0][0].stats[0].stats[7].stats
assert any([bug.id == 1343546 for bug in stats])


# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Closed Bugs
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand All @@ -96,21 +111,6 @@ def test_bugzilla_closed():
"--bz-closed",
"--email", "Petr Šplíchal <psplicha@redhat.com>",
"--since", "2012-12-06",
"--until", "2012-12-06"])[0][0].stats[0].stats[7].stats
"--until", "2012-12-06"])[0][0].stats[0].stats[8].stats
assert any([bug.id == 862231 for bug in stats])
assert any(["[duplicate]" in unicode(bug) for bug in stats])


# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Subscribed Bugs
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

def test_bugzilla_subscribed():
""" Check subscribed bugs """
did.base.Config(CONFIG)
stats = did.cli.main([
"--bz-subscribed",
"--email", "Evgeni Golov <egolov@redhat.com>",
"--since", "2016-06-06",
"--until", "2016-06-12"])[0][0].stats[0].stats[8].stats
assert any([bug.id == 1343546 for bug in stats])

0 comments on commit 46ff186

Please sign in to comment.