8000 Fix issues with login vs id · AndrewOrr/github3.py@ad4be9a · GitHub
[go: up one dir, main page]

Skip to content

Commit ad4be9a

Browse files
Christophe LECOINTEEricDales
authored andcommitted
Fix issues with login vs id
All lights are green, I accept this change
1 parent e233097 commit ad4be9a

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

github3/users.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ def rename(self, login):
391391
:param str login: (required), new name of the user
392392
:returns: bool
393393
"""
394-
url = self._build_url('admin', 'users', self.id)
394+
url = self._build_url('admin', 'users', self.login)
395395
payload = {'login': login}
396396
resp = self._boolean(self._patch(url, data=payload), 202, 403)
397397
return resp
@@ -407,7 +407,7 @@ def impersonate(self, scopes=None):
407407
i.e., 'gist', 'user'
408408
:returns: :class:`Authorization <Authorization>`
409409
"""
410-
url = self._build_url('admin', 'users', self.id, 'authorizations')
410+
url = self._build_url('admin', 'users', self.login, 'authorizations')
411411
data = {}
412412

413413
if scopes:
@@ -425,7 +425,7 @@ def revoke_impersonation(self):
425425
426426
:returns: bool -- True if successful, False otherwise
427427
"""
428-
url = self._build_url('admin', 'users', self.id, 'authorizations')
428+
url = self._build_url('admin', 'users', self.login, 'authorizations')
429429

430430
return self._boolean(self._delete(url), 204, 403)
431431

@@ -494,5 +494,5 @@ def delete(self):
494494
495495
:returns: bool -- True if successful, False otherwise
496496
"""
497-
url = self._build_url('admin', 'users', self.id)
497+
url = self._build_url('admin', 'users', self.login)
498498
return self._boolean(self._delete(url), 204, 403)

tests/unit/test_github_enterprise.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
from github3.github import GitHubEnterprise
21
import github3
3-
2+
from github3.github import GitHubEnterprise
43
from .helper import UnitHelper, create_example_data_helper
54

65
get_example_user = create_example_data_helper('user_example')
@@ -52,7 +51,8 @@ def url_for_user(self, path=''):
5251
return self.base_url + 'users/' + example_data['login'] + path
5352

5453
def url_for_admin(self, path=''):
55-
return self.base_url + 'admin/users/' + str(example_data['id']) + path
54+
return self.base_url + 'admin/users/' + str(example_data['login']) \
55+
+ path
5656

5757
def test_delete_user(self):
5858
"""Show that an admin can ask for user deletion."""

0 commit comments

Comments
 (0)
0