summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRay <1338507+rayisbadat@users.noreply.github.com>2022-11-16 14:35:50 -0600
committerGitHub <noreply@github.com>2022-11-16 21:35:50 +0100
commitad7c8fafd56866002aa6723ceeba4c4bc071ca0d (patch)
tree79c8cde65c170a5c8ce0769326eb77da9975ca18 /tests
parenta0553c29899f091209afe6366e8fb75fb9edef40 (diff)
downloadgitlab-ad7c8fafd56866002aa6723ceeba4c4bc071ca0d.tar.gz
feat(groups): add support for listing ldap_group_links (#2371)
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/objects/test_groups.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/unit/objects/test_groups.py b/tests/unit/objects/test_groups.py
index 6ca5cfe..5cba6dc 100644
--- a/tests/unit/objects/test_groups.py
+++ b/tests/unit/objects/test_groups.py
@@ -12,6 +12,14 @@ from gitlab.v4.objects import GroupDescendantGroup, GroupSubgroup
from gitlab.v4.objects.projects import GroupProject, SharedProject
content = {"name": "name", "id": 1, "path": "path"}
+ldap_group_links_content = [
+ {
+ "cn": None,
+ "group_access": 40,
+ "provider": "ldapmain",
+ "filter": "(memberOf=cn=some_group,ou=groups,ou=fake_ou,dc=sub_dc,dc=example,dc=tld)",
+ }
+]
projects_content = [
{
"id": 9,
@@ -216,6 +224,19 @@ def resp_delete_push_rules_group(no_content):
yield rsps
+@pytest.fixture
+def resp_list_ldap_group_links(no_content):
+ with responses.RequestsMock() as rsps:
+ rsps.add(
+ method=responses.GET,
+ url="http://localhost/api/v4/groups/1/ldap_group_links",
+ json=ldap_group_links_content,
+ content_type="application/json",
+ status=200,
+ )
+ yield rsps
+
+
def test_get_group(gl, resp_groups):
data = gl.groups.get(1)
assert isinstance(data, gitlab.v4.objects.Group)
@@ -261,6 +282,12 @@ def test_list_group_descendant_groups(group, resp_list_subgroups_descendant_grou
assert descendant_groups[0].path == subgroup_descgroup_content[0]["path"]
+def test_list_ldap_group_links(group, resp_list_ldap_group_links):
+ ldap_group_links = group.list_ldap_group_links()
+ assert isinstance(ldap_group_links, list)
+ assert ldap_group_links[0]["provider"] == ldap_group_links_content[0]["provider"]
+
+
@pytest.mark.skip("GitLab API endpoint not implemented")
def test_refresh_group_export_status(group, resp_export):
export = group.exports.create()