Merge lp:~gmb/launchpad/add-bugzilla-3.4-ebt-bug-415778 into lp:launchpad

Proposed by Graham Binns
Status: Merged
Merged at revision: not available
Proposed branch: lp:~gmb/launchpad/add-bugzilla-3.4-ebt-bug-415778
Merge into: lp:launchpad
Diff against target: None lines
To merge this branch: bzr merge lp:~gmb/launchpad/add-bugzilla-3.4-ebt-bug-415778
Reviewer Review Type Date Requested Status
Gavin Panella (community) Approve
Review via email: mp+10366@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Graham Binns (gmb) wrote :

This branch adds an ExternalBugTracker to support Bugzilla instances
that offer an API.

I've added the BugzillaAPI ExternalBugTracker as a subclass of the
Bugzilla ExternalBugTracker and made the existing BugzillaLPPlugin
inherit from it. This is because BugzillaLPPlugin currently offers a
superset of the BugzillaAPI functionality. If the inheritance went the
other way we'd end up with an ExternalBugTracker that claimed to do
things that it doesn't at the moment (e.g. syncing of comments).

It's very likely that significant functionality that's currently part of
BugzillaLPPlugin will be refactored into BugzillaAPI in subsequent
branches.

Test command: bin/test -vvt externalbugtracker-bugzilla-api.txt -t externalbugtracker-bugzilla-lp-plugin.txt

Revision history for this message
Gavin Panella (allenap) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'lib/lp/bugs/doc/externalbugtracker-bugzilla-api.txt'
2--- lib/lp/bugs/doc/externalbugtracker-bugzilla-api.txt 1970-01-01 00:00:00 +0000
3+++ lib/lp/bugs/doc/externalbugtracker-bugzilla-api.txt 2009-08-19 08:01:23 +0000
4@@ -0,0 +1,22 @@
5+Bugzilla bugtrackers with an XML-RPC API
6+========================================
7+
8+Instances of Bugzilla version 3.4+ offer an XML-RPC API for working with
9+bugs. This is very similar in some regards to that offered by the
10+Launchpad plugin for versions 3.0 and 3.2, however the differences
11+between them necessitate Launchpad's support for Bugzilla 3.4+ being
12+implemented as a separate ExternalBugTracker.
13+
14+As with the BugzillaLPPlugin ExternalBugTracker, we use a special XML-RPC
15+transport for the purposes of testing.
16+
17+ >>> from lp.bugs.externalbugtracker.bugzilla import (
18+ ... BugzillaAPI)
19+ >>> from lp.bugs.tests.externalbugtracker import (
20+ ... TestBugzillaAPIXMLRPCTransport)
21+ >>> test_transport = TestBugzillaAPIXMLRPCTransport(
22+ ... 'http://example.com/')
23+ >>> bugzilla = BugzillaAPI(
24+ ... 'http://example.com/', xmlrpc_transport=test_transport)
25+ >>> bugzilla.xmlrpc_transport == test_transport
26+ True
27
28=== modified file 'lib/lp/bugs/doc/externalbugtracker-bugzilla-lp-plugin.txt'
29--- lib/lp/bugs/doc/externalbugtracker-bugzilla-lp-plugin.txt 2009-07-08 09:28:40 +0000
30+++ lib/lp/bugs/doc/externalbugtracker-bugzilla-lp-plugin.txt 2009-08-19 09:22:08 +0000
31@@ -16,6 +16,14 @@
32 >>> bugzilla.xmlrpc_transport == test_transport
33 True
34
35+BugzillaLPPlugin inherits from the BugzillaAPI ExternalBugTracker, with
36+which it shares some functionality.
37+
38+ >>> from lp.bugs.externalbugtracker.bugzilla import (
39+ ... BugzillaAPI)
40+ >>> issubclass(BugzillaLPPlugin, BugzillaAPI)
41+ True
42+
43
44 == Authentication ==
45
46
47=== modified file 'lib/lp/bugs/externalbugtracker/bugzilla.py'
48--- lib/lp/bugs/externalbugtracker/bugzilla.py 2009-06-25 00:40:31 +0000
49+++ lib/lp/bugs/externalbugtracker/bugzilla.py 2009-08-19 09:22:08 +0000
50@@ -6,6 +6,7 @@
51 __metaclass__ = type
52 __all__ = [
53 'Bugzilla',
54+ 'BugzillaAPI',
55 'BugzillaLPPlugin',
56 'needs_authentication',
57 ]
58@@ -370,16 +371,12 @@
59 return decorator
60
61
62-class BugzillaLPPlugin(Bugzilla):
63- """An `ExternalBugTracker` to handle Bugzillas using the LP Plugin."""
64-
65- implements(
66- ISupportsBackLinking, ISupportsCommentImport,
67- ISupportsCommentPushing)
68+class BugzillaAPI(Bugzilla):
69+ """An `ExternalBugTracker` to handle Bugzillas that offer an API."""
70
71 def __init__(self, baseurl, xmlrpc_transport=None,
72 internal_xmlrpc_transport=None):
73- super(BugzillaLPPlugin, self).__init__(baseurl)
74+ super(BugzillaAPI, self).__init__(baseurl)
75 self._bugs = {}
76 self._bug_aliases = {}
77
78@@ -397,6 +394,15 @@
79 return xmlrpclib.ServerProxy(
80 self.xmlrpc_endpoint, transport=self.xmlrpc_transport)
81
82+
83+
84+class BugzillaLPPlugin(BugzillaAPI):
85+ """An `ExternalBugTracker` to handle Bugzillas using the LP Plugin."""
86+
87+ implements(
88+ ISupportsBackLinking, ISupportsCommentImport,
89+ ISupportsCommentPushing)
90+
91 def _authenticate(self):
92 """Authenticate with the remote Bugzilla instance.
93
94
95=== modified file 'lib/lp/bugs/tests/test_doc.py'
96--- lib/lp/bugs/tests/test_doc.py 2009-06-25 00:40:31 +0000
97+++ lib/lp/bugs/tests/test_doc.py 2009-08-19 08:01:23 +0000
98@@ -238,6 +238,13 @@
99 tearDown=tearDown,
100 layer=LaunchpadZopelessLayer
101 ),
102+ 'externalbugtracker-bugzilla-api.txt':
103+ LayeredDocFileSuite(
104+ '../doc/externalbugtracker-bugzilla-api.txt',
105+ setUp=checkwatchesSetUp,
106+ tearDown=tearDown,
107+ layer=LaunchpadZopelessLayer
108+ ),
109 'externalbugtracker-bugzilla-lp-plugin.txt':
110 LayeredDocFileSuite(
111 '../doc/externalbugtracker-bugzilla-lp-plugin.txt',