Skip to content

Commit ddc3b47

Browse files
committed
tests: add externalbugs unit tests
Signed-off-by: Cole Robinson <[email protected]>
1 parent e89676b commit ddc3b47

5 files changed

Lines changed: 83 additions & 0 deletions

File tree

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{'bug_ids': [1234, 5678],
2+
'external_bugs': [{'ext_bz_bug_id': 'externalid',
3+
'ext_description': 'link to launchpad',
4+
'ext_priority': 'bigly',
5+
'ext_status': 'CLOSED',
6+
'ext_type_description': 'some-bug-add-description',
7+
'ext_type_id': 'launchpad',
8+
'ext_type_url': 'https://example.com/launchpad/1234'}]}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{'bug_ids': ['blah'],
2+
'ext_bz_bug_id': ['99999'],
3+
'ext_type_description': 'foo-desc',
4+
'ext_type_id': 'footype',
5+
'ext_type_url': 'foo-url',
6+
'ids': ['remove1']}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{'bug_ids': ['some', 'bug', 'id'],
2+
'ext_bz_bug_id': ['externalid-update'],
3+
'ext_description': 'link to mozilla',
4+
'ext_priority': 'like, really bigly',
5+
'ext_status': 'OPEN',
6+
'ext_type_description': 'some-bug-update',
7+
'ext_type_id': 'mozilla',
8+
'ext_type_url': 'https://mozilla.foo/bar/5678',
9+
'ids': ['external1', 'external2']}

tests/mockbackend.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,13 @@ def bug_update(self, *args):
6565
def bug_update_tags(self, *args):
6666
return self.__helper(args)
6767

68+
def externalbugs_add(self, *args):
69+
return self.__helper(args)
70+
def externalbugs_update(self, *args):
71+
return self.__helper(args)
72+
def externalbugs_remove(self, *args):
73+
return self.__helper(args)
74+
6875
def product_get(self, *args):
6976
return self.__helper(args)
7077
def product_get_accessible(self, *args):

tests/test_api_externalbugs.py

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#
2+
# Copyright Red Hat, Inc. 2012
3+
#
4+
# This work is licensed under the GNU GPLv2 or later.
5+
# See the COPYING file in the top-level directory.
6+
#
7+
8+
"""
9+
Test miscellaneous API bits
10+
"""
11+
12+
import tests
13+
import tests.mockbackend
14+
15+
16+
def test_externalbugs():
17+
# Basic API testing of the ExternalBugs wrappers
18+
fakebz = tests.mockbackend.make_bz(
19+
externalbugs_add_args="data/mockargs/test_externalbugs_add.txt",
20+
externalbugs_add_return={},
21+
externalbugs_update_args="data/mockargs/test_externalbugs_update.txt",
22+
externalbugs_update_return={},
23+
externalbugs_remove_args="data/mockargs/test_externalbugs_remove.txt",
24+
externalbugs_remove_return={})
25+
26+
fakebz.add_external_tracker(
27+
bug_ids=[1234, 5678],
28+
ext_bz_bug_id="externalid",
29+
ext_type_id="launchpad",
30+
ext_type_description="some-bug-add-description",
31+
ext_type_url="https://example.com/launchpad/1234",
32+
ext_status="CLOSED",
33+
ext_description="link to launchpad",
34+
ext_priority="bigly")
35+
36+
fakebz.update_external_tracker(
37+
ids=["external1", "external2"],
38+
ext_bz_bug_id="externalid-update",
39+
ext_type_id="mozilla",
40+
ext_type_description="some-bug-update",
41+
ext_type_url="https://mozilla.foo/bar/5678",
42+
ext_status="OPEN",
43+
bug_ids=["some", "bug", "id"],
44+
ext_description="link to mozilla",
45+
ext_priority="like, really bigly")
46+
47+
fakebz.remove_external_tracker(
48+
ids="remove1",
49+
ext_bz_bug_id="99999",
50+
ext_type_id="footype",
51+
ext_type_description="foo-desc",
52+
ext_type_url="foo-url",
53+
bug_ids="blah")

0 commit comments

Comments
 (0)