Skip to content

Commit cecdbe3

Browse files
Merge pull request disqus#62 from Fabcien/token_shadow
Prevent Phabricator.token from shadowing the conduit token API
2 parents 483781e + 843166d commit cecdbe3

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

phabricator/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -357,9 +357,9 @@ def __init__(self, username=None, certificate=None, host=None,
357357
raise ConfigurationError("No host found or provided.")
358358

359359
current_host_config = defined_hosts.get(self.host, {})
360-
self.token = token if token else current_host_config.get('token')
360+
self.conduit_token = token if token else current_host_config.get('token')
361361

362-
if self.token is None:
362+
if self.conduit_token is None:
363363
self.username = username if username else current_host_config.get('user')
364364
self.certificate = certificate if certificate else current_host_config.get('cert')
365365

@@ -376,9 +376,9 @@ def _request(self, **kwargs):
376376
raise SyntaxError('You cannot call the Conduit API without a resource.')
377377

378378
def connect(self):
379-
if self.token:
379+
if self.conduit_token:
380380
self._conduit = {
381-
'token': self.token
381+
'token': self.conduit_token
382382
}
383383
return
384384

phabricator/tests/test_phabricator.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,5 +176,13 @@ def test_map_param_type(self):
176176
complex_list_pair = 'list<pair<string-constant<"gtcm">, string>>'
177177
self.assertEqual(phabricator.map_param_type(complex_list_pair), [tuple])
178178

179+
def test_endpoint_shadowing(self):
180+
shadowed_endpoints = [e for e in self.api.interface.keys() if e in self.api.__dict__]
181+
self.assertEqual(
182+
shadowed_endpoints,
183+
[],
184+
"The following endpoints are shadowed: {}".format(shadowed_endpoints)
185+
)
186+
179187
if __name__ == '__main__':
180188
unittest.main()

0 commit comments

Comments
 (0)