#48081 CI test - password
Closed: wontfix by mreynolds. Opened by nhosoi.

No Description Provided


Metadata Update from @nhosoi:
- Issue set to the milestone: CI test 1.0

Adding pytest test for bugzilla - https://bugzilla.redhat.com/show_bug.cgi?id=1465600

0001-Password-accepts-sn-attr.patch

Metadata Update from @sramling:
- Custom field reviewstatus adjusted to None
- Issue close_status updated to: None

Metadata Update from @sramling:
- Custom field reviewstatus adjusted to review (was: None)

I think, it is a bit unclear.
We have https://bugzilla.redhat.com/show_bug.cgi?id=1465600 and the bugzilla will have it's issue in Pagure.
As I see, we need to create a ticket in pagure for the bug and upload the test ticket there. Sorry, that I didn't mention it at the previous ticket.

Ok, for the review. We can do it here and mention the commit later in the new issue.

I think it will be more efficient to create one data structure insted of this (btw, {} is for dict, not for list or tuple):

TEST_USER = 'UIDpwtest1'
CN_ATTR = 'CNpwtest1'
SN_ATTR = 'SNpwtest1'
UID_ATTR = TEST_USER
attrs = {CN_ATTR, SN_ATTR, UID_ATTR}

Like this:

user_data = {'cn': 'CNpwtest1',
    'sn': 'SNpwtest1',
    'uid': 'UIDpwtest1'}

And you have a lot of methods to work with dict:

user_data.items()
user_data.keys()
user_data.values()
user_properties.update(user_data)
# etc.

The next thing. I think it is better to parametrize the test case. Because it fails now and the failure stops the execution during the 'for loop'. So we don't see all results but only one for the first failure.

Thanks @spichugi for your valuable comments. Adding a new patch with suggested changes.

0001-CI-tests-PasswordCheckSyntax.patch

Adding new patch

0001-CI-tests-PasswordCheckSyntax.patch

{} is for dicts, not for lists or tuples. Also, please, use more explicit variable names. Like 'TEST_PASSWORDS' for lists and 'TEST_PASSWORD' for single password.

TEST_PASW = {'CN12pwtest31', 'SN3pwtest231', 'UID1pwtest123', 'MAIL2pwtest12@redhat.com'}

In the passw_policy() fixture, you enable subtreePwdPolicy but don't disable it in the finalizer.

topo.standalone.subtreePwdPolicy(subtree, {'passwordchange': 'on', 'passwordCheckSyntax': 'on'})

In the test_users() fixture, you can just use variable from outer scope. Also, it is only one 'test_user', not 'test_users'. And you can rerurn the 'tuser'. Like this:

log.info('Adding user-uid={},ou=people,{}'.format(user_data['uid'], SUFFIX))
users = UserAccounts(topo.standalone, SUFFIX)
user_properties = {
    'uidNumber': '1001',
    'gidNumber': '2001',
    'userpassword': USER_PASW,
     'homeDirectory': '/home/pwtest1'}
user_properties.update(user_data)
tuser = users.create(properties=user_properties)
def fin():
    log.info('Deleting user-uid={},ou=people,{}'.format(user_data['uid'], SUFFIX))
    tuser.delete()
request.addfinalizer(fin)
return tuser

And later, you dont need this:

userdn = 'uid={},ou=people,{}'.format(user_data['uid'], SUFFIX)
users = UserAccounts(topo.standalone, SUFFIX)
tuser = users.get(user_data['uid'])

Just work with 'test_user' fixture object.

conn = test_user.bind(USER_PASW)

Don't you need to change password back in the 'finally:' block in case if something will go wrong?

Review comments incorporated in the new patch.

0001-CI-tests-PasswordCheckSyntax.patch

Review comments incorporated in the new patch.

Okay, one thing more. After a discussion on IRC, we've decided to add markings with pytest.
So please, add @pytest.mark.bz1465600 and @pytest.mark.bz1468284 like this:

@pytest.mark.bz1468284
@pytest.mark.parametrize("user_pasw", TEST_PASSWORDS)
def test_cn_sn_like_passw(topo, passw_policy, test_user, user_pasw):

Added pytest.mark

0001-CI-tests-PasswordCheckSyntax.patch

Metadata Update from @spichugi:
- Custom field reviewstatus adjusted to ack (was: review)

To ssh://pagure.io/389-ds-base.git
e710054f6..05b00f20f master -> master
commit 05b00f20f7ec6053b562af2b28820e1e5a3c89bf
Author: Sankar Ramalingam sramling@redhat.com
Date: Wed Aug 9 22:10:46 2017 +0530

Adding tests for OU and Givenname attribute.

0001-CI-tests-PasswordCheckSyntax-ou-givenname.patch

Metadata Update from @sramling:
- Custom field reviewstatus adjusted to review (was: ack)

@spichugi @firstyear , can you review the patch? I added couple of new inputs for testing OU and Givenname attributes.

There is a commented fixture you've missed:

40 +# @pytest.mark.parametrize("user_pasw", user_data.values())

Besides that, LGTM. Thanks. :)

Removed the comment, thanks @spichugi

0001-CI-tests-PasswordCheckSyntax-ou-givenname.patch

commit da4ebf7a4c9248f3415bf3a7d4f4847417dfeefc
Author: Sankar Ramalingam sramling@redhat.com
Date: Thu Aug 17 11:26:56 2017 +0530

Metadata Update from @spichugi:
- Custom field reviewstatus adjusted to ack (was: review)

Adding another test case for pwdPolicy_warning_test
0001-Issue-48081-CI-test-password.patch

Thanks, ack

To ssh://pagure.io/389-ds-base.git
5c2fa9636..fe1cfca3a master -> master

Metadata Update from @mreynolds:
- Issue close_status updated to: fixed
- Issue status updated to: Closed (was: Open)

389-ds-base is moving from Pagure to Github. This means that new issues and pull requests
will be accepted only in 389-ds-base's github repository.

This issue has been cloned to Github and is available here:
- https://github.com/389ds/389-ds-base/issues/1412

If you want to receive further updates on the issue, please navigate to the github issue
and click on subscribe button.

Thank you for understanding. We apologize for all inconvenience.

Metadata Update from @spichugi:
- Issue close_status updated to: wontfix (was: fixed)

Metadata