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

CI test - password #1412

Closed
389-ds-bot opened this issue Sep 12, 2020 · 25 comments
Closed

CI test - password #1412

389-ds-bot opened this issue Sep 12, 2020 · 25 comments
Labels
closed: fixed Migration flag - Issue
Milestone

Comments

@389-ds-bot
Copy link

Cloned from Pagure issue: https://pagure.io/389-ds-base/issue/48081

  • Created at 2015-02-26 03:39:05 by nhosoi (@nhosoi)
  • Closed at 2019-08-23 21:43:35 as fixed
  • Assigned to nobody

#No Description Provided

@389-ds-bot 389-ds-bot added the closed: fixed Migration flag - Issue label Sep 12, 2020
@389-ds-bot 389-ds-bot added this to the CI test 1.0 milestone Sep 12, 2020
@389-ds-bot
Copy link
Author

Comment from nhosoi (@nhosoi) at 2017-02-11 23:09:56

Metadata Update from @nhosoi:

  • Issue set to the milestone: CI test 1.0

@389-ds-bot
Copy link
Author

Comment from sramling at 2017-08-04 15:23:20

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

0001-Password-accepts-sn-attr.patch

@389-ds-bot
Copy link
Author

Comment from sramling at 2017-08-04 15:23:20

Metadata Update from @sramling:

  • Custom field reviewstatus adjusted to None
  • Issue close_status updated to: None

@389-ds-bot
Copy link
Author

Comment from sramling at 2017-08-04 15:23:30

Metadata Update from @sramling:

  • Custom field reviewstatus adjusted to review (was: None)

@389-ds-bot
Copy link
Author

Comment from spichugi (@droideck) at 2017-08-04 15:42:37

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.

@389-ds-bot
Copy link
Author

Comment from spichugi (@droideck) at 2017-08-08 10:19:54

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.

@389-ds-bot
Copy link
Author

Comment from sramling at 2017-08-08 12:29:39

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

0001-CI-tests-PasswordCheckSyntax.patch

@389-ds-bot
Copy link
Author

Comment from sramling at 2017-08-08 19:08:05

Adding new patch

0001-CI-tests-PasswordCheckSyntax.patch

@389-ds-bot
Copy link
Author

Comment from spichugi (@droideck) at 2017-08-09 10:46:51

{} 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?

@389-ds-bot
Copy link
Author

Comment from sramling at 2017-08-09 15:12:33

Review comments incorporated in the new patch.

0001-CI-tests-PasswordCheckSyntax.patch

@389-ds-bot
Copy link
Author

Comment from spichugi (@droideck) at 2017-08-09 16:51:22

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):

@389-ds-bot
Copy link
Author

Comment from sramling at 2017-08-09 18:46:14

Added pytest.mark

0001-CI-tests-PasswordCheckSyntax.patch

@389-ds-bot
Copy link
Author

Comment from spichugi (@droideck) at 2017-08-09 19:17:50

Metadata Update from @droideck:

  • Custom field reviewstatus adjusted to ack (was: review)

@389-ds-bot
Copy link
Author

Comment from spichugi (@droideck) at 2017-08-09 19:19:02

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

@389-ds-bot
Copy link
Author

Comment from sramling at 2017-08-14 13:23:10

Adding tests for OU and Givenname attribute.

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

@389-ds-bot
Copy link
Author

Comment from sramling at 2017-08-14 13:26:04

Metadata Update from @sramling:

  • Custom field reviewstatus adjusted to review (was: ack)

@389-ds-bot
Copy link
Author

Comment from sramling at 2017-08-16 16:33:46

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

@389-ds-bot
Copy link
Author

Comment from spichugi (@droideck) at 2017-08-16 18:33:33

There is a commented fixture you've missed:

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

Besides that, LGTM. Thanks. :)

@389-ds-bot
Copy link
Author

Comment from sramling at 2017-08-17 08:01:12

Removed the comment, thanks @droideck

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

@389-ds-bot
Copy link
Author

Comment from spichugi (@droideck) at 2017-08-17 09:36:10

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

@389-ds-bot
Copy link
Author

Comment from spichugi (@droideck) at 2017-08-17 09:36:25

Metadata Update from @droideck:

  • Custom field reviewstatus adjusted to ack (was: review)

@389-ds-bot
Copy link
Author

Comment from vashirov (@vashirov) at 2017-09-12 15:35:47

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

@389-ds-bot
Copy link
Author

Comment from mreynolds (@mreynolds389) at 2017-09-12 16:03:32

Thanks, ack

@389-ds-bot
Copy link
Author

Comment from vashirov (@vashirov) at 2017-09-12 17:25:57

To ssh://pagure.io/389-ds-base.git
5c2fa96..fe1cfca master -> master

@389-ds-bot
Copy link
Author

Comment from mreynolds (@mreynolds389) at 2019-08-23 21:43:35

Metadata Update from @mreynolds389:

  • Issue close_status updated to: fixed
  • Issue status updated to: Closed (was: Open)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed: fixed Migration flag - Issue
Projects
None yet
Development

No branches or pull requests

1 participant