本文整理汇总了Python中ipatests.test_xmlrpc.tracker.user_plugin.UserTracker类的典型用法代码示例。如果您正苦于以下问题:Python UserTracker类的具体用法?Python UserTracker怎么用?Python UserTracker使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了UserTracker类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_create_with_username_starting_with_numeric
def test_create_with_username_starting_with_numeric(self):
"""Successfully create a user with name starting with numeric chars"""
testuser = UserTracker(
name=u'1234user', givenname=u'First1234', sn=u'Surname1234',
)
testuser.create()
testuser.delete()
示例2: test_create_with_uppercase_principal
def test_create_with_uppercase_principal(self):
""" Create user with upper-case principal """
testuser = UserTracker(
name=u'tuser1', givenname=u'Test', sn=u'Tuser1',
krbprincipalname=u'tuser1'.upper()
)
testuser.create()
testuser.delete()
示例3: test_add_user_with_singlevalue_addattr
def test_add_user_with_singlevalue_addattr(self):
""" Try to add a user with single-value attribute
set via option and --addattr """
user = UserTracker(name=u'user', givenname=u'Test', sn=u'User1',
addattr=u'sn=User2')
command = user.make_create_command()
with raises_exact(errors.OnlyOneValueAllowed(attr='sn')):
command()
示例4: test_create_with_full_address
def test_create_with_full_address(self):
""" Create user with full address set """
testuser = UserTracker(
name=u'tuser1', givenname=u'Test', sn=u'Tuser1',
street=u'123 Maple Rd', l=u'Anytown', st=u'MD',
postalcode=u'01234-5678', mobile=u'410-555-1212'
)
testuser.create()
testuser.delete()
示例5: test_create_with_krb_ticket_policy
def test_create_with_krb_ticket_policy(self):
""" Try to create user with krbmaxticketlife set """
testuser = UserTracker(
name=u'tuser1', givenname=u'Test',
sn=u'Tuser1', setattr=u'krbmaxticketlife=88000'
)
command = testuser.make_create_command()
with raises_exact(errors.ObjectclassViolation(
info=u'attribute "%s" not allowed' % 'krbmaxticketlife')):
command()
示例6: test_create_with_numeric_only_username
def test_create_with_numeric_only_username(self):
"""Try to create a user with name only contains numeric chars"""
testuser = UserTracker(
name=u'1234', givenname=u'NumFirst1234', sn=u'NumSurname1234',
)
with raises_exact(errors.ValidationError(
name=u'login',
error=u'may only include letters, numbers, _, -, . and $',
)):
testuser.create()
示例7: test_create_with_invalid_login
def test_create_with_invalid_login(self):
""" Try to create user with an invalid login string """
testuser = UserTracker(
name=invaliduser1, givenname=u'Test', sn=u'User1'
)
command = testuser.make_create_command()
with raises_exact(errors.ValidationError(
name=u'login',
error=u'may only include letters, numbers, _, -, . and $')):
command()
示例8: test_create_with_too_long_login
def test_create_with_too_long_login(self):
""" Try to create user with too long login string """
testuser = UserTracker(
name=invaliduser2, givenname=u'Test', sn=u'User1'
)
command = testuser.make_create_command()
with raises_exact(errors.ValidationError(
name=u'login',
error=u'can be at most 255 characters')):
command()
示例9: user_radius
def user_radius(request):
""" User tracker fixture for testing users with radius user name """
tracker = UserTracker(name=u'radiususer', givenname=u'radiususer',
sn=u'radiususer1',
ipatokenradiususername=u'radiususer')
tracker.track_create()
tracker.attrs.update(
objectclass=objectclasses.user + [u'ipatokenradiusproxyuser']
)
return tracker.make_fixture(request)
示例10: test_create_with_bad_realm_in_principal
def test_create_with_bad_realm_in_principal(self):
""" Try to create user with a bad realm in principal """
testuser = UserTracker(
name=u'tuser1', givenname=u'Test', sn=u'Tuser1',
krbprincipalname=u'[email protected]'
)
command = testuser.make_create_command()
with raises_exact(errors.RealmMismatch()):
command()
示例11: test_add_user_coliding_with_alias
def test_add_user_coliding_with_alias(self, krbalias_user):
krbalias_user.ensure_exists()
user_alias = u'conflicting_name'
krbalias_user.add_principal([user_alias])
conflict_user = UserTracker(user_alias, u'test', u'conflict')
with pytest.raises(errors.DuplicateEntry):
conflict_user.create()
示例12: test_create_without_upg
def test_create_without_upg(self):
""" Try to create user without User's Primary GID """
testuser = UserTracker(
name=u'tuser1', givenname=u'Test', sn=u'Tuser1',
noprivate=True
)
command = testuser.make_create_command()
with raises_exact(errors.NotFound(
reason=u'Default group for new users is not POSIX')):
command()
示例13: test_create_with_malformed_principal
def test_create_with_malformed_principal(self):
""" Try to create user with wrongly formed principal """
testuser = UserTracker(
name=u'tuser1', givenname=u'Test', sn=u'Tuser1',
krbprincipalname=u'[email protected]@NOTFOUND.ORG'
)
command = testuser.make_create_command()
with raises_exact(errors.MalformedUserPrincipal(
principal=u'[email protected]@NOTFOUND.ORG')):
command()
示例14: user_npg2
def user_npg2(request, group):
""" User tracker fixture for testing users with no private group """
tracker = UserTracker(name=u'npguser2', givenname=u'Npguser',
sn=u'Npguser2', noprivate=True, gidnumber=1000)
tracker.track_create()
del tracker.attrs['mepmanagedentry']
tracker.attrs.update(
gidnumber=[u'1000'], description=[], memberof_group=[group.cn],
objectclass=add_oc(objectclasses.user_base, u'ipantuserattrs')
)
return tracker.make_fixture(request)
示例15: test_create_with_malformed_principal
def test_create_with_malformed_principal(self):
""" Try to create user with wrongly formed principal """
testuser = UserTracker(
name=u'tuser1', givenname=u'Test', sn=u'Tuser1',
krbprincipalname=u'[email protected]@NOTFOUND.ORG'
)
command = testuser.make_create_command()
with raises_exact(errors.ConversionError(
name='principal', error="Malformed principal: '{}'".format(
testuser.kwargs['krbprincipalname']))):
command()