Skip to content

Commit 7a81117

Browse files
committed
fix(groups): adding unit test for list_ldap_group_sync - try 2
1 parent 373b46c commit 7a81117

File tree

1 file changed

+17
-11
lines changed

1 file changed

+17
-11
lines changed

tests/unit/objects/test_groups.py

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,19 @@ def resp_delete_push_rules_group(no_content):
224224
yield rsps
225225

226226

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+
227240
def test_get_group(gl, resp_groups):
228241
data = gl.groups.get(1)
229242
assert isinstance(data, gitlab.v4.objects.Group)
@@ -269,17 +282,10 @@ def test_list_group_descendant_groups(group, resp_list_subgroups_descendant_grou
269282
assert descendant_groups[0].path == subgroup_descgroup_content[0]["path"]
270283

271284

272-
@pytest.fixture
273-
def resp_list_ldap_group_links(no_content):
274-
with responses.RequestsMock() as rsps:
275-
rsps.add(
276-
method=responses.GET,
277-
url="http://localhost/api/v4/groups/1/ldap_group_links",
278-
json=ldap_group_links_content,
279-
content_type="application/json",
280-
status=200,
281-
)
282-
yield rsps
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"]
283289

284290

285291
@pytest.mark.skip("GitLab API endpoint not implemented")

0 commit comments

Comments
 (0)