Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests: port bash rfc2307 to pytest #6543

Closed
wants to merge 1 commit into from

Conversation

shridhargadekar
Copy link
Contributor

Porting bash rfc2307 to pytest, added two more
tests

@jakub-vavra-cz jakub-vavra-cz self-assigned this Jan 30, 2023
@shridhargadekar shridhargadekar marked this pull request as draft January 30, 2023 07:38
Copy link

@github-advanced-security github-advanced-security bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CodeQL found more than 10 potential problems in the proposed changes. Check the Files changed tab for more details.

src/tests/multihost/alltests/test_rfc2307.py Fixed Show fixed Hide fixed
user = f'user\\{sp_char}{r_num}@{domain_name}'
grp_n = f'grp\\{sp_char}{r_num}@{domain_name}'
cmd = multihost.client[0].run_command(f'id {user}', raiseonerr=False)
cmd_returnc0de = cmd.returncode

Check notice

Code scanning / CodeQL

Unused local variable

Variable cmd_returnc0de is not used.
grp_n = f'grp\\{sp_char}{r_num}@{domain_name}'
cmd = multihost.client[0].run_command(f'id {user}', raiseonerr=False)
cmd_returnc0de = cmd.returncode
ssh1 = tools.auth_from_client(f'{user}', 'Secret123') == 3

Check notice

Code scanning / CodeQL

Unused local variable

Variable ssh1 is not used.
"""
tools = sssdTools(multihost.client[0])
domain_name = tools.get_domain_section_name()
start = multihost.client[0].service_sssd('start')

Check notice

Code scanning / CodeQL

Unused local variable

Variable start is not used.
src/tests/multihost/alltests/test_rfc2307.py Fixed Show fixed Hide fixed
'uidNumber': f'22222',
'gidNumber': f'22222'}
usr_grp(multihost, usr_info, 'user', 'add')
memberdn = f'uid=testuser1,ou=People,{ds_suffix}'

Check warning

Code scanning / CodeQL

Variable defined multiple times

This assignment to 'memberdn' is unnecessary as it is [redefined](1) before this value is used.
'memberUid': f'TESTUSER1'
}
usr_grp(multihost, group_info, 'group', 'add')
memberdn = f'uid=TESTuser2,ou=People,{ds_suffix}'

Check notice

Code scanning / CodeQL

Unused local variable

Variable memberdn is not used.
src/tests/multihost/alltests/test_rfc2307.py Fixed Show fixed Hide fixed
@shridhargadekar shridhargadekar force-pushed the rfc2307_b branch 4 times, most recently from ad48ff3 to b056abe Compare April 12, 2023 09:01
@shridhargadekar shridhargadekar force-pushed the rfc2307_b branch 3 times, most recently from ef34a91 to 961d407 Compare April 17, 2023 09:51
tools.clear_sssd_cache()
mesg_log = '/var/log/messages'
segf_pat = re.compile(r'segfault at')
log = multihost.client[0].get_file_contents(logfile).decode('utf-8')

Check failure

Code scanning / CodeQL

Potentially uninitialized local variable

Local variable 'logfile' may be used before it is initialized.
src/tests/multihost/alltests/test_rfc2307.py Fixed Show fixed Hide fixed
src/tests/multihost/alltests/test_rfc2307.py Fixed Show fixed Hide fixed
tools.clear_sssd_cache()
mesg_log = '/var/log/messages'
segf_pat = re.compile(r'segfault at')
log = multihost.client[0].get_file_contents(logfile).decode('utf-8')

Check notice

Code scanning / CodeQL

Unused local variable

Variable log is not used.
'memberUid': f'{usr}',
'uniqueMember': memberdn}
usr_grp(multihost, group_info, 'group', 'add')
user = f'{usr}@{domain_name}'

Check warning

Code scanning / CodeQL

Variable defined multiple times

This assignment to 'user' is unnecessary as it is [redefined](1) before this value is used.
domain_name = tools.get_domain_section_name()
r_num = random.randint(9999, 99999)
usr = f'user{r_num}'
user = f'{usr}@{domain_name}'

Check notice

Code scanning / CodeQL

Unused local variable

Variable user is not used.
src/tests/multihost/alltests/test_rfc2307.py Fixed Show fixed Hide fixed
@shridhargadekar shridhargadekar marked this pull request as ready for review May 4, 2023 16:57
@shridhargadekar shridhargadekar force-pushed the rfc2307_b branch 2 times, most recently from 558beb0 to 09f6f68 Compare May 5, 2023 07:41
minor code rearrangement
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants