There was an error while loading. Please reload this page.
1 parent 97c8619 commit e00cad4Copy full SHA for e00cad4
2 files changed
gitlab/v4/objects.py
@@ -1250,6 +1250,18 @@ def enable(self, key_id, **kwargs):
1250
self.gitlab.http_post(path, **kwargs)
1251
1252
1253
+class ProjectBadge(SaveMixin, ObjectDeleteMixin, RESTObject):
1254
+ pass
1255
+
1256
1257
+class ProjectBadgeManager(CRUDMixin, RESTManager):
1258
+ _path = '/projects/%(project_id)s/badges'
1259
+ _obj_cls = ProjectBadge
1260
+ _from_parent_attrs = {'project_id': 'id'}
1261
+ _create_attrs = (('link_url', 'image_url'), tuple())
1262
+ _update_attrs = (('link_url', 'image_url'), tuple())
1263
1264
1265
class ProjectEvent(Event):
1266
pass
1267
@@ -2472,6 +2484,7 @@ class Project(SaveMixin, ObjectDeleteMixin, RESTObject):
2472
2484
_short_print_attr = 'path'
2473
2485
_managers = (
2474
2486
('accessrequests', 'ProjectAccessRequestManager'),
2487
+ ('badges', 'ProjectBadgeManager'),
2475
2488
('boards', 'ProjectBoardManager'),
2476
2489
('branches', 'ProjectBranchManager'),
2477
2490
('jobs', 'ProjectJobManager'),
tools/python_test_v4.py
@@ -583,6 +583,12 @@
583
#lists = board.lists.list()
584
#assert(len(lists) == begin_size - 1)
585
586
+# project badges
587
+badge_image = 'http://example.com'
588
+badge_link = 'http://example/img.svg'
589
+bp = admin_project.badges.create({'link_url': badge_link, 'image_url': badge_image})
590
+assert(len(admin_project.badges.list()) == 1)
591
592
# project wiki
593
wiki_content = 'Wiki page content'
594
wp = admin_project.wikis.create({'title': 'wikipage', 'content': wiki_content})
0 commit comments