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

Commitddefa57

Browse files
committed
Finish covering github3.github possibly.
1 parent9199f6a commitddefa57

File tree

2 files changed

+33
-5
lines changed

2 files changed

+33
-5
lines changed

‎github3/github.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ def create_repo(self,
204204
json=self._json(self._post(url,data),201)
205205
returnRepository(json,self)ifjsonelseNone
206206

207+
@requires_auth
207208
defdelete_key(self,key_id):
208209
"""Delete user key pointed to by ``key_id``.
209210
@@ -322,7 +323,8 @@ def issue(self, owner, repository, number):
322323

323324
@requires_basic_auth
324325
deflist_authorizations(self):
325-
"""List authorizations for the authenticated user.
326+
"""List authorizations for the authenticated user. This will return a
327+
404 if you are using a token for authentication.
326328
327329
:returns: list of :class:`Authorization <Authorization>`\ s
328330
"""
@@ -332,7 +334,8 @@ def list_authorizations(self):
332334

333335
@requires_basic_auth
334336
defiter_authorizations(self,number=-1):
335-
"""Iterate over authorizations for the authenticated user.
337+
"""Iterate over authorizations for the authenticated user. This will
338+
return a 404 if you are using a token for authentication.
336339
337340
:param int number: (optional), number of authorizations to return.
338341
Default: -1 returns all available authorizations
@@ -833,7 +836,7 @@ def markdown(self, text, mode='', context='', raw=False):
833836
req=self._post(url,data=data,headers=headers)
834837
ifreq.ok:
835838
returnreq.content
836-
return''
839+
return''# (No coverage)
837840

838841
defoctocat(self):
839842
"""Returns an easter egg of the API."""

‎tests/test_github.py

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,10 +240,35 @@ def test_key(self):
240240
k=next(self._g.iter_keys())
241241
expect(self._g.key(k.id)).isinstance(Key)
242242

243-
deftest_keys_requires_auth(self):
243+
deftest_create_key(self):
244244
self.raisesGHE(self.g.create_key,'Foo bar','bogus')
245-
self.raisesGHE(self.g.delete_key,2000)
245+
ifnotself.auth:
246+
return
247+
248+
key=self._g.create_key('test_key', (
249+
'ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAxGTCJTMYmsBhLL0PQ2RwLp3'
250+
'sgcJ8uz6RqOrlB/6lKzIXYOcvdaHqEEF9G+1xlJck7kA8pSNR9AkEWP2uoy'
251+
'1tJVp4nUVzPYKSrkoMppzA34vT+iqW/H4rRCADxIRillvpXZB2CWQ8fbRlD'
252+
'9Mjreh0L2A4NPKSmGxs5XfZXD9lWPb1+U6oQrZYG2h1ulyI7rt+adWOhfP2'
253+
'UYq6V5JSdNDi4r1nGxBccZgguiL7XNjl9TSsgr8QKmAacubyNEwIrmQIS9h'
254+
'ipKg3k10VcqfVmSzF1GuzDUKFfIHU/zyd6aJ0emAqgft/fho+BkrXBihhxf'
255+
'/Qbi5fi4Ipx3VFcLrdiOBbOQ==')
256+
)
257+
expect(key).isinstance(Key)
258+
self.alt_repo.delete_key(key.id)
259+
260+
deftest_delete_key(self):
261+
self.raisesGHE(self.g.delete_key,10)
262+
263+
deftest_list_keys(self):
246264
self.raisesGHE(self.g.list_keys)
265+
ifnotself.auth:
266+
return
267+
268+
expect(self._g.list_keys()).list_of(Key)
269+
270+
deftest_keys_requires_auth(self):
271+
self.raisesGHE(self.g.delete_key,2000)
247272

248273
deftest_iter_repos(self):
249274
self.raisesGHE(next,self.g.iter_repos())

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp