Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc65e74e

Browse files
committed
Try to stop creating Authorizations recklessly.
1 parenta09d472 commitc65e74e

File tree

3 files changed

+8
-18
lines changed

3 files changed

+8
-18
lines changed

‎github3/auths.py‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,22 +67,22 @@ def update(self, scopes=[], add_scopes=[], rm_scopes=[], note='',
6767
success=False
6868
ifscopes:
6969
d=dumps({'scopes':scopes})
70-
json=self._json(self._get(self._api,data=d),200)
70+
json=self._json(self._post(self._api,data=d),200)
7171
self._update_(json)
7272
success=True
7373
ifadd_scopes:
7474
d=dumps({'add_scopes':add_scopes})
75-
json=self._json(self._get(self._api,data=d),200)
75+
json=self._json(self._post(self._api,data=d),200)
7676
self._update_(json)
7777
success=True
7878
ifrm_scopes:
7979
d=dumps({'remove_scopes':rm_scopes})
80-
json=self._json(self._get(self._api,data=d),200)
80+
json=self._json(self._post(self._api,data=d),200)
8181
self._update_(json)
8282
success=True
8383
ifnoteornote_url:
8484
d=dumps({'note':note,'note_url':note_url})
85-
json=self._json(self._get(self._api,data=d),200)
85+
json=self._json(self._post(self._api,data=d),200)
8686
self._update_(json)
8787
success=True
8888
returnsuccess

‎tests/test_auths.py‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,19 @@ def test_scopes(self):
5454
deftest_update(self):
5555
ifnotself.auth:
5656
return
57+
5758
ifself.deleted:
5859
self.authorization=self._g.authorize(None,None, [])
60+
5961
self.authorization.update(['repo','repo:status'], ['user'],
6062
['repo:status'],'https://github.com/sigmavirus24/github3.py')
63+
6164
ifself.deleted:
6265
self.authorization.delete()
6366

6467
deftest_delete(self):
6568
ifnotself.auth:
6669
return
70+
6771
self.authorization.delete()
6872
self.deleted=True

‎tests/test_github.py‎

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -291,20 +291,6 @@ def test_user(self):
291291

292292
expect(self._g.user()).isinstance(github3.users.User)
293293

294-
deftest_authorization(self):
295-
ifnotself.auth:
296-
return
297-
298-
auth=self.g.authorize(self.user,self.pw, [])
299-
expect(auth).isinstance(github3.github.Authorization)
300-
auth_g=self._g.authorization(auth.id)
301-
expect(auth_g).isinstance(github3.github.Authorization)
302-
auth.delete()
303-
delauth
304-
auth=self._g.authorize(None,None, [])
305-
expect(auth).isinstance(github3.github.Authorization)
306-
auth.delete()
307-
308294
deftest_subscribe_unsub(self):
309295
args= (self.gh3py,self.test_repo)
310296
self.raisesGHE(self.g.subscribe,*args)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp