-
Notifications
You must be signed in to change notification settings - Fork 80
/
test_eduperson.py
74 lines (58 loc) · 2.18 KB
/
test_eduperson.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# --- BEGIN COPYRIGHT BLOCK ---
# Copyright (C) 2017 Red Hat, Inc.
# All rights reserved.
#
# License: GPL (version 3 or any later version).
# See LICENSE for details.
# --- END COPYRIGHT BLOCK ---
#
import os
import logging
import pytest
import ldap
from lib389.idm.user import UserAccounts
from lib389.topologies import topology_st as topology
from lib389._constants import DEFAULT_SUFFIX
DEBUGGING = os.getenv('DEBUGGING', False)
if DEBUGGING is not False:
DEBUGGING = True
if DEBUGGING:
logging.getLogger(__name__).setLevel(logging.DEBUG)
else:
logging.getLogger(__name__).setLevel(logging.INFO)
log = logging.getLogger(__name__)
def test_account_locking(topology):
"""
Test the eduperson schema works
"""
if DEBUGGING:
# Add debugging steps(if any)...
pass
users = UserAccounts(topology.standalone, DEFAULT_SUFFIX)
user_properties = {
'uid': 'testuser',
'cn' : 'testuser',
'sn' : 'user',
'uidNumber' : '1000',
'gidNumber' : '2000',
'homeDirectory' : '/home/testuser',
}
testuser = users.create(properties=user_properties)
# Extend the user with eduPerson
testuser.add('objectClass', 'eduPerson')
# now add eduPerson attrs
testuser.add('eduPersonAffiliation', 'value') # From 2002
testuser.add('eduPersonNickName', 'value') # From 2002
testuser.add('eduPersonOrgDN', 'ou=People,%s' % DEFAULT_SUFFIX) # From 2002
testuser.add('eduPersonOrgUnitDN', 'ou=People,%s' % DEFAULT_SUFFIX) # From 2002
testuser.add('eduPersonPrimaryAffiliation', 'value') # From 2002
testuser.add('eduPersonPrincipalName', 'value') # From 2002
testuser.add('eduPersonEntitlement', 'value') # From 2002
testuser.add('eduPersonPrimaryOrgUnitDN', 'ou=People,%s' % DEFAULT_SUFFIX) # From 2002
testuser.add('eduPersonScopedAffiliation', 'value') # From 2003
testuser.add('eduPersonTargetedID', 'value') # From 2003
testuser.add('eduPersonAssurance', 'value') # From 2008
testuser.add('eduPersonPrincipalNamePrior', 'value') # From 2012
testuser.add('eduPersonUniqueId', 'value') # From 2013
testuser.add('eduPersonOrcid', 'value') # From 2016
log.info('Test PASSED')