Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a couple of tests for the gerrit plugin
- Loading branch information
Showing
1 changed file
with
57 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# coding: utf-8 | ||
""" Tests for the Gerrit plugin """ | ||
|
||
from __future__ import unicode_literals, absolute_import | ||
|
||
import did.cli | ||
import did.base | ||
|
||
|
||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
# Constants | ||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
CONFIG = """ | ||
[general] | ||
email = Bill Peck <bpeck@redhat.com> | ||
[gerrit] | ||
type = gerrit | ||
url = https://gerrit.beaker-project.org/#/ | ||
prefix = GR | ||
""" | ||
|
||
|
||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
# Tests | ||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
def test_gerrit_smoke(): | ||
""" Smoke test for all stats """ | ||
did.base.Config(CONFIG) | ||
stats = did.cli.main("last week") | ||
assert stats | ||
|
||
|
||
def test_gerrit_merged(): | ||
""" Check merged changes """ | ||
did.base.Config(CONFIG) | ||
stats = did.cli.main([ | ||
"--gerrit-merged", | ||
"--since", "2015-08-01", | ||
"--until", "2015-08-31"])[0][0].stats[0].stats[1].stats | ||
assert any([ | ||
"GR#4347 - Fix jobs.rst" in unicode(change) | ||
for change in stats]) | ||
|
||
|
||
def test_gerrit_reviewed(): | ||
""" Check reviewed changes """ | ||
did.base.Config(CONFIG) | ||
stats = did.cli.main([ | ||
"--gerrit-reviewed", | ||
"--since", "2015-08-01", | ||
"--until", "2015-08-31"])[0][0].stats[0].stats[5].stats | ||
assert any([ | ||
"GR#4380 - Fix memleak" in unicode(change) | ||
for change in stats]) |