|
12 | 12 | from gitlab.v4.objects.projects import GroupProject, SharedProject
|
13 | 13 |
|
14 | 14 | content = {"name": "name", "id": 1, "path": "path"}
|
| 15 | +ldap_group_links_content = [ |
| 16 | + { |
| 17 | + "cn": None, |
| 18 | + "group_access": 40, |
| 19 | + "provider": "ldapmain", |
| 20 | + "filter": "(memberOf=cn=some_group,ou=groups,ou=fake_ou,dc=sub_dc,dc=example,dc=tld)", |
| 21 | + } |
| 22 | +] |
15 | 23 | projects_content = [
|
16 | 24 | {
|
17 | 25 | "id": 9,
|
@@ -216,6 +224,19 @@ def resp_delete_push_rules_group(no_content):
|
216 | 224 | yield rsps
|
217 | 225 |
|
218 | 226 |
|
| 227 | +@pytest.fixture |
| 228 | +def resp_list_ldap_group_links(no_content): |
| 229 | + with responses.RequestsMock() as rsps: |
| 230 | + rsps.add( |
| 231 | + method=responses.GET, |
| 232 | + url="http://localhost/api/v4/groups/1/ldap_group_links", |
| 233 | + json=ldap_group_links_content, |
| 234 | + content_type="application/json", |
| 235 | + status=200, |
| 236 | + ) |
| 237 | + yield rsps |
| 238 | + |
| 239 | + |
219 | 240 | def test_get_group(gl, resp_groups):
|
220 | 241 | data = gl.groups.get(1)
|
221 | 242 | assert isinstance(data, gitlab.v4.objects.Group)
|
@@ -261,6 +282,12 @@ def test_list_group_descendant_groups(group, resp_list_subgroups_descendant_grou
|
261 | 282 | assert descendant_groups[0].path == subgroup_descgroup_content[0]["path"]
|
262 | 283 |
|
263 | 284 |
|
| 285 | +def test_list_ldap_group_links(group, resp_list_ldap_group_links): |
| 286 | + ldap_group_links = group.list_ldap_group_links() |
| 287 | + assert isinstance(ldap_group_links, list) |
| 288 | + assert ldap_group_links[0]["provider"] == ldap_group_links_content[0]["provider"] |
| 289 | + |
| 290 | + |
264 | 291 | @pytest.mark.skip("GitLab API endpoint not implemented")
|
265 | 292 | def test_refresh_group_export_status(group, resp_export):
|
266 | 293 | export = group.exports.create()
|
|
0 commit comments