diff options
-rw-r--r-- | gitlab/v4/objects.py | 13 | ||||
-rw-r--r-- | tools/python_test_v4.py | 6 |
2 files changed, 19 insertions, 0 deletions
diff --git a/gitlab/v4/objects.py b/gitlab/v4/objects.py index 55696a0..3223b63 100644 --- a/gitlab/v4/objects.py +++ b/gitlab/v4/objects.py @@ -1394,6 +1394,18 @@ class ProjectKeyManager(CRUDMixin, RESTManager): self.gitlab.http_post(path, **kwargs) +class ProjectBadge(SaveMixin, ObjectDeleteMixin, RESTObject): + pass + + +class ProjectBadgeManager(CRUDMixin, RESTManager): + _path = '/projects/%(project_id)s/badges' + _obj_cls = ProjectBadge + _from_parent_attrs = {'project_id': 'id'} + _create_attrs = (('link_url', 'image_url'), tuple()) + _update_attrs = (('link_url', 'image_url'), tuple()) + + class ProjectEvent(Event): pass @@ -2707,6 +2719,7 @@ class Project(SaveMixin, ObjectDeleteMixin, RESTObject): _short_print_attr = 'path' _managers = ( ('accessrequests', 'ProjectAccessRequestManager'), + ('badges', 'ProjectBadgeManager'), ('boards', 'ProjectBoardManager'), ('branches', 'ProjectBranchManager'), ('jobs', 'ProjectJobManager'), diff --git a/tools/python_test_v4.py b/tools/python_test_v4.py index 558d7ab..70f093d 100644 --- a/tools/python_test_v4.py +++ b/tools/python_test_v4.py @@ -653,6 +653,12 @@ assert(admin_project.star_count == 0) #lists = board.lists.list() #assert(len(lists) == begin_size - 1) +# project badges +badge_image = 'http://example.com' +badge_link = 'http://example/img.svg' +bp = admin_project.badges.create({'link_url': badge_link, 'image_url': badge_image}) +assert(len(admin_project.badges.list()) == 1) + # project wiki wiki_content = 'Wiki page content' wp = admin_project.wikis.create({'title': 'wikipage', 'content': wiki_content}) |