Skip to content

Commit 05b4291

Browse files
author
Costin Bleotu
committed
Fixed changes request
1 parent 12db57a commit 05b4291

File tree

5 files changed

+18
-55
lines changed

5 files changed

+18
-55
lines changed

.drone.yml

Lines changed: 0 additions & 22 deletions
This file was deleted.

gogs_client/entities.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -291,16 +291,16 @@ def hook_type(self):
291291
@property
292292
def events(self):
293293
"""
294-
The events that fires the hook
294+
The events that fire the hook
295295
296-
:rtype: list of strs
296+
:rtype: List[str]
297297
"""
298298
return self._events
299299

300300
@property
301301
def active(self):
302302
"""
303-
State of the hook
303+
Whether the hook is active
304304
305305
:rtype: bool
306306
"""
@@ -397,7 +397,7 @@ def created_at(self):
397397
@property
398398
def read_only(self):
399399
"""
400-
Is the key read only?
400+
Whether key is read-only.
401401
:rtype: bool
402402
"""
403403
return self._read_only
@@ -454,7 +454,7 @@ def username(self):
454454
"""
455455
Organization's username
456456
457-
:rtype: int
457+
:rtype: str
458458
"""
459459
return self._username
460460

@@ -463,7 +463,7 @@ def full_name(self):
463463
"""
464464
Organization's full name
465465
466-
:rtype: int
466+
:rtype: str
467467
"""
468468
return self._full_name
469469

@@ -544,7 +544,7 @@ def name(self):
544544
"""
545545
Team name
546546
547-
:rtype: int
547+
:rtype: str
548548
"""
549549
return self._name
550550

@@ -553,7 +553,7 @@ def description(self):
553553
"""
554554
Description to the team
555555
556-
:rtype: int
556+
:rtype: str
557557
"""
558558
return self._description
559559

gogs_client/interface.py

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,6 @@ def delete_hook(self, auth, username, repo_name, hook_id):
420420
"""
421421
path = "/repos/{u}/{r}/hooks/{i}".format(u=username, r=repo_name, i=hook_id)
422422
response = self._check_ok(self._delete(path, auth=auth))
423-
return response
424423

425424
def create_organization(self, auth, username, org_name, full_name=None, avatar_url=None, description=None, website=None, location=None):
426425
"""
@@ -457,7 +456,7 @@ def create_organization_team(self, auth, org_name, name, description=None, permi
457456
458457
:param auth.Authentication auth: authentication object, must be admin-level
459458
:param str org_name: [Required] Organization user name
460-
:param str team_name: Full name of the team
459+
:param str name: Full name of the team
461460
:param str description: Description to the team
462461
:param str permission: Team permission, can be read, write or admin, default is read
463462
:return: a representation of the created team
@@ -484,14 +483,11 @@ def add_team_membership(self, auth, team_id, username):
484483
:param auth.Authentication auth: authentication object, must be admin-level
485484
:param str team_id: [Required] Id of the team
486485
:param str username: Username of the user to be added to team
487-
:return: status code of the request
488-
:rtype: str
489486
:raises NetworkFailure: if there is an error communicating with the server
490487
:raises ApiFailure: if the request cannot be serviced
491488
"""
492489
url = "/admin/teams/{t}/members/{u}".format(t=team_id, u=username)
493-
response = self._put(url, auth=auth)
494-
return self._check_ok(response)
490+
response = self._check_ok(self._put(url, auth=auth))
495491

496492
def remove_team_membership(self, auth, team_id, username):
497493
"""
@@ -500,14 +496,11 @@ def remove_team_membership(self, auth, team_id, username):
500496
:param auth.Authentication auth: authentication object, must be admin-level
501497
:param str team_id: [Required] Id of the team
502498
:param str username: Username of the user to be removed from the team
503-
:return: status code of the request
504-
:rtype: str
505499
:raises NetworkFailure: if there is an error communicating with the server
506500
:raises ApiFailure: if the request cannot be serviced
507501
"""
508502
url = "/admin/teams/{t}/members/{u}".format(t=team_id, u=username)
509-
response = self._delete(url, auth=auth)
510-
return self._check_ok(response)
503+
response = self._check_ok(self._delete(url, auth=auth))
511504

512505
def add_repo_to_team(self, auth, team_id, repo_name):
513506
"""
@@ -516,15 +509,11 @@ def add_repo_to_team(self, auth, team_id, repo_name):
516509
:param auth.Authentication auth: authentication object, must be admin-level
517510
:param str team_id: [Required] Id of the team
518511
:param str repo_name: Name of the repo to be added to the team
519-
:return: status code of the request
520-
:rtype: str
521512
:raises NetworkFailure: if there is an error communicating with the server
522513
:raises ApiFailure: if the request cannot be serviced
523514
"""
524515
url = "/admin/teams/{t}/repos/{r}".format(t=team_id, r=repo_name)
525-
response = self._put(url, auth=auth)
526-
return self._check_ok(response)
527-
516+
response = self._check_ok(self._put(url, auth=auth))
528517

529518
def remove_repo_from_team(self, auth, team_id, repo_name):
530519
"""
@@ -533,14 +522,11 @@ def remove_repo_from_team(self, auth, team_id, repo_name):
533522
:param auth.Authentication auth: authentication object, must be admin-level
534523
:param str team_id: [Required] Id of the team
535524
:param str repo_name: Name of the repo to be removed from the team
536-
:return: status code of the request
537-
:rtype: str
538525
:raises NetworkFailure: if there is an error communicating with the server
539526
:raises ApiFailure: if the request cannot be serviced
540527
"""
541528
url = "/admin/teams/{t}/repos/{r}".format(t=team_id, r=repo_name)
542-
response = self._delete(url, auth=auth)
543-
return self._check_ok(response)
529+
response = self._check_ok(self._delete(url, auth=auth))
544530

545531
def list_deploy_keys(self, auth, username, repo_name):
546532
"""

test.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

tests/interface_test.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ def test_delete_hook(self):
458458
uri = self.path("/repos/username/repo1/hooks/4")
459459
responses.add(responses.DELETE, uri, status=204)
460460
hook = self.client.delete_hook(self.token, "username", "repo1", 4)
461-
self.assertEqual(hook.status_code, 204)
461+
self.assertEqual(hook, None)
462462

463463
@responses.activate
464464
def test_create_organization(self):
@@ -495,28 +495,28 @@ def test_add_team_membership(self):
495495
uri = self.path("/admin/teams/team/members/username")
496496
responses.add(responses.PUT, uri, status=204)
497497
resp = self.client.add_team_membership(self.token, "team", "username")
498-
self.assertEqual(resp.status_code, 204)
498+
self.assertEqual(resp, None)
499499

500500
@responses.activate
501501
def test_remove_team_membership(self):
502502
uri = self.path("/admin/teams/team/members/username")
503503
responses.add(responses.DELETE, uri, status=204)
504504
resp = self.client.remove_team_membership(self.token, "team", "username")
505-
self.assertEqual(resp.status_code, 204)
505+
self.assertEqual(resp, None)
506506

507507
@responses.activate
508508
def test_add_repo_to_team(self):
509509
uri = self.path("/admin/teams/test_team/repos/repo_name")
510510
responses.add(responses.PUT, uri, status=204)
511511
resp = self.client.add_repo_to_team(self.token, "test_team", "repo_name")
512-
self.assertEqual(resp.status_code, 204)
512+
self.assertEqual(resp, None)
513513

514514
@responses.activate
515515
def test_remove_repo_from_team(self):
516516
uri = self.path("/admin/teams/test_team/repos/repo_name")
517517
responses.add(responses.DELETE, uri, status=204)
518518
resp = self.client.remove_repo_from_team(self.token, "test_team", "repo_name")
519-
self.assertEqual(resp.status_code, 204)
519+
self.assertEqual(resp, None)
520520

521521
@responses.activate
522522
def test_list_deploy_keys(self):

0 commit comments

Comments
 (0)