| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -109,6 +109,24 @@ class GroupProjectManager(ListMixin, RESTManager): | |||
| 109 | 109 | ) | |
| 110 | 110 | ||
| 111 | 111 | ||
| 112 | + class ProjectGroup(RESTObject): | ||
| 113 | + pass | ||
| 114 | + | ||
| 115 | + | ||
| 116 | + class ProjectGroupManager(ListMixin, RESTManager): | ||
| 117 | + _path = "/projects/{project_id}/groups" | ||
| 118 | + _obj_cls = ProjectGroup | ||
| 119 | + _from_parent_attrs = {"project_id": "id"} | ||
| 120 | + _list_filters = ( | ||
| 121 | + "search", | ||
| 122 | + "skip_groups", | ||
| 123 | + "with_shared", | ||
| 124 | + "shared_min_access_level", | ||
| 125 | + "shared_visible_only", | ||
| 126 | + ) | ||
| 127 | + _types = {"skip_groups": types.ListAttribute} | ||
| 128 | + | ||
| 129 | + | ||
| 112 | 130 | class Project(RefreshMixin, SaveMixin, ObjectDeleteMixin, RepositoryMixin, RESTObject): | |
| 113 | 131 | _short_print_attr = "path" | |
| 114 | 132 | ||
@@ -132,6 +150,7 @@ class Project(RefreshMixin, SaveMixin, ObjectDeleteMixin, RepositoryMixin, RESTO | |||
| 132 | 150 | files: ProjectFileManager | |
| 133 | 151 | forks: "ProjectForkManager" | |
| 134 | 152 | generic_packages: GenericPackageManager | |
| 153 | + groups: ProjectGroupManager | ||
| 135 | 154 | hooks: ProjectHookManager | |
| 136 | 155 | imports: ProjectImportManager | |
| 137 | 156 | issues: ProjectIssueManager | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -311,3 +311,18 @@ def test_project_wiki(project): | |||
| 311 | 311 | wiki.save() | |
| 312 | 312 | wiki.delete() | |
| 313 | 313 | assert len(project.wikis.list()) == 0 | |
| 314 | + | ||
| 315 | + | ||
| 316 | + def test_project_share_group(gl, project): | ||
| 317 | + """Test sharing a project with a group""" | ||
| 318 | + gl.enable_debug() | ||
| 319 | + group1 = gl.groups.create({"name": "group1_proj", "path": "group1_proj"}) | ||
| 320 | + group2 = gl.groups.create({"name": "group2_proj", "path": "group2_proj"}) | ||
| 321 | + | ||
| 322 | + project.share(group_id=group1.id, group_access=gitlab.const.DEVELOPER_ACCESS) | ||
| 323 | + project.share(group_id=group2.id, group_access=gitlab.const.MAINTAINER_ACCESS) | ||
| 324 | + | ||
| 325 | + groups = project.groups.list() | ||
| 326 | + # assert len(groups) == 2 | ||
| 327 | + | ||
| 328 | + assert groups is None | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments