Skip to content

Commit 0442997

Browse files
committed
base: Bugzilla: add configpaths __init__ property
To control configpath setting at startup. Needed for API symmetry and for the test suite to skip API keys
1 parent bfea21a commit 0442997

2 files changed

Lines changed: 9 additions & 5 deletions

File tree

bugzilla/base.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ def _listify(val):
235235

236236
def __init__(self, url=-1, user=None, password=None, cookiefile=-1,
237237
sslverify=True, tokenfile=-1, use_creds=True, api_key=None,
238-
cert=None):
238+
cert=None, configpaths=-1):
239239
"""
240240
:param url: The bugzilla instance URL, which we will connect
241241
to immediately. Most users will want to specify this at
@@ -262,7 +262,8 @@ def __init__(self, url=-1, user=None, password=None, cookiefile=-1,
262262
:param sslverify: Maps to 'requests' sslverify parameter. Set to
263263
False to disable SSL verification, but it can also be a path
264264
to file or directory for custom certs.
265-
:param api_key: A bugzilla
265+
:param api_key: A bugzilla5+ API key
266+
:param configpaths: A list of possible bugzillarc locations.
266267
"""
267268
if url == -1:
268269
raise TypeError("Specify a valid bugzilla url, or pass url=None")
@@ -284,19 +285,22 @@ def __init__(self, url=-1, user=None, password=None, cookiefile=-1,
284285
self._field_aliases = []
285286
self._init_field_aliases()
286287

287-
self.configpath = _default_configpaths[:]
288288
if not use_creds:
289289
cookiefile = None
290290
tokenfile = None
291-
self.configpath = []
291+
configpaths = []
292292

293293
if cookiefile == -1:
294294
cookiefile = _default_auth_location("bugzillacookies")
295295
if tokenfile == -1:
296296
tokenfile = _default_auth_location("bugzillatoken")
297+
if configpaths == -1:
298+
configpaths = _default_configpaths[:]
299+
297300
log.debug("Using tokenfile=%s", tokenfile)
298301
self.cookiefile = cookiefile
299302
self.tokenfile = tokenfile
303+
self.configpath = configpaths
300304

301305
if url:
302306
self.connect(url)

tests/test_rw_functional.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -815,7 +815,7 @@ def compare(data, newid):
815815

816816
def test12SetCookie(self):
817817
bz = self.bzclass(self.url,
818-
cookiefile=-1, tokenfile=None)
818+
cookiefile=-1, tokenfile=None, configpaths=[])
819819

820820
try:
821821
bz.cookiefile = None

0 commit comments

Comments
 (0)