Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat(groups): add a list_ldap_group_links to go along with the pre ex…#2371

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletionsgitlab/v4/objects/groups.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -194,6 +194,23 @@ def delete_ldap_group_link(
path += f"/{cn}"
self.manager.gitlab.http_delete(path, **kwargs)

@cli.register_custom_action("Group")
@exc.on_http_error(exc.GitlabGetError)
def list_ldap_group_links(
self, **kwargs: Any
) -> Union[gitlab.GitlabList, List[Dict[str, Any]]]:
"""List LDAP group links.

Args:
**kwargs: Extra options to send to the server (e.g. sudo)

Raises:
GitlabAuthenticationError: If authentication is not correct
GitlabGetError: If the server cannot perform the request
"""
path = f"/groups/{self.encoded_id}/ldap_group_links"
return self.manager.gitlab.http_list(path, **kwargs)

@cli.register_custom_action("Group")
@exc.on_http_error(exc.GitlabCreateError)
def ldap_sync(self, **kwargs: Any) -> None:
Expand Down
27 changes: 27 additions & 0 deletionstests/unit/objects/test_groups.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -12,6 +12,14 @@
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,
Expand DownExpand Up@@ -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)
Expand DownExpand Up@@ -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()
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp