Skip to content

Commit

Permalink
Tests: Porting the AD-Access-control test-suite to pytest
Browse files Browse the repository at this point in the history
Minor docstring modifcations. Adding detailed expectedresults
instead of 'should succeed' in docstrings of testcases

Reviewed-by: Jakub Vávra <[email protected]>
  • Loading branch information
shridhargadekar1 authored and pbrezina committed Oct 13, 2022
1 parent df55b1f commit a05719f
Show file tree
Hide file tree
Showing 3 changed files with 452 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/tests/multihost/ad/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,36 @@ def remove_ad_user_group():
return (ad_user, ad_group)


@pytest.fixture(scope="function")
def create_nested_group(session_multihost, create_aduser_group, request):
""" create nested AD group
l1_grp is a top-level group
l2_grp is a level-2 group and is a member of l1_grp group
ad_user is a user-member of a 2nd-level l2_grp group
"""
run_id = random.randint(999, 999999)
ad_user = f'testuser-{run_id}'
ad_group = f'testgroup-{run_id}'
l1_grp = f'testgrp-l1-{run_id}'
l2_grp = f'testgrp-l1-{run_id}'
ad_op = ADOperations(session_multihost.ad[0])
ad_op.create_ad_unix_group(l1_grp)
ad_op.create_ad_unix_group(l2_grp)
ad_op.create_ad_unix_user_group(ad_user, ad_group)
ad_op.add_user_member_of_group(l1_grp, l2_grp)
ad_op.add_user_member_of_group(l2_grp, ad_user)

def remove_ad_user_group():
""" Remove windows AD user and group """
ad_op.delete_ad_user_group(ad_user)
ad_op.delete_ad_user_group(ad_group)
ad_op.delete_ad_user_group(l1_grp)
ad_op.delete_ad_user_group(l2_grp)

request.addfinalizer(remove_ad_user_group)
return (run_id)


@pytest.fixture(scope="function")
def create_domain_local_group(session_multihost, request):
""" Add user in domain local AD group"""
Expand Down
1 change: 1 addition & 0 deletions src/tests/multihost/ad/pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ markers =
adloginattr: Tests for AD login attributes
automount: Automount test cases with maps stored in AD schema
cifs: Cifs test cases
ad_access_control: Test for AD Access Control
idmaprange: Tests related to ldap idmap range
keytabrotation: keytab rotation using adcli
memcachesid: Test for mem cache sid
Expand Down
Loading

0 comments on commit a05719f

Please sign in to comment.