mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Fix unicode failures in Env tests and dn failures in XML-RPC tests
This commit is contained in:
@@ -39,8 +39,8 @@ from ipalib import config, constants, base
|
||||
# raw: the value being set (possibly a string repr)
|
||||
# value: the expected value after the lightweight conversion
|
||||
good_vars = (
|
||||
('a_string', 'Hello world!', 'Hello world!'),
|
||||
('trailing_whitespace', ' value ', 'value'),
|
||||
('a_string', u'Hello world!', u'Hello world!'),
|
||||
('trailing_whitespace', u' value ', u'value'),
|
||||
('an_int', 42, 42),
|
||||
('int_repr', ' 42 ', 42),
|
||||
('a_float', 3.14, 3.14),
|
||||
@@ -54,16 +54,16 @@ good_vars = (
|
||||
('empty', '', None),
|
||||
|
||||
# These verify that the implied conversion is case-sensitive:
|
||||
('not_true', ' true ', 'true'),
|
||||
('not_false', ' false ', 'false'),
|
||||
('not_none', ' none ', 'none'),
|
||||
('not_true', u' true ', u'true'),
|
||||
('not_false', u' false ', u'false'),
|
||||
('not_none', u' none ', u'none'),
|
||||
)
|
||||
|
||||
|
||||
bad_names = (
|
||||
('CamelCase', 'value'),
|
||||
('_leading_underscore', 'value'),
|
||||
('trailing_underscore_', 'value'),
|
||||
('CamelCase', u'value'),
|
||||
('_leading_underscore', u'value'),
|
||||
('trailing_underscore_', u'value'),
|
||||
)
|
||||
|
||||
|
||||
@@ -253,7 +253,7 @@ class test_Env(ClassChecker):
|
||||
Test the `ipalib.config.Env.__getitem__` method.
|
||||
"""
|
||||
o = self.cls()
|
||||
value = 'some value'
|
||||
value = u'some value'
|
||||
o.key = value
|
||||
assert o.key is value
|
||||
assert o['key'] is value
|
||||
@@ -300,7 +300,7 @@ class test_Env(ClassChecker):
|
||||
assert len(o) == 0
|
||||
for i in xrange(1, 11):
|
||||
key = 'key%d' % i
|
||||
value = 'value %d' % i
|
||||
value = u'value %d' % i
|
||||
o[key] = value
|
||||
assert o[key] is value
|
||||
assert len(o) == i
|
||||
@@ -321,16 +321,16 @@ class test_Env(ClassChecker):
|
||||
Test the `ipalib.config.Env._merge` method.
|
||||
"""
|
||||
group1 = (
|
||||
('key1', 'value 1'),
|
||||
('key2', 'value 2'),
|
||||
('key3', 'value 3'),
|
||||
('key4', 'value 4'),
|
||||
('key1', u'value 1'),
|
||||
('key2', u'value 2'),
|
||||
('key3', u'value 3'),
|
||||
('key4', u'value 4'),
|
||||
)
|
||||
group2 = (
|
||||
('key0', 'Value 0'),
|
||||
('key2', 'Value 2'),
|
||||
('key4', 'Value 4'),
|
||||
('key5', 'Value 5'),
|
||||
('key0', u'Value 0'),
|
||||
('key2', u'Value 2'),
|
||||
('key4', u'Value 4'),
|
||||
('key5', u'Value 5'),
|
||||
)
|
||||
o = self.cls()
|
||||
assert o._merge(**dict(group1)) == (4, 4)
|
||||
@@ -599,7 +599,7 @@ class test_Env(ClassChecker):
|
||||
# Check that **lastchance works
|
||||
(o, home) = self.finalize_core(None)
|
||||
key = 'just_one_more_key'
|
||||
value = 'with one more value'
|
||||
value = u'with one more value'
|
||||
lastchance = {key: value}
|
||||
assert key not in o
|
||||
assert o._isdone('_finalize') is False
|
||||
|
||||
@@ -176,7 +176,7 @@ class test_group(Declarative):
|
||||
truncated=False,
|
||||
result=[
|
||||
dict(
|
||||
#dn=u'cn=%s,cn=groups,cn=accounts,%s' % (group1, api.env.basedn),
|
||||
dn=u'cn=%s,cn=groups,cn=accounts,%s' % (group1, api.env.basedn),
|
||||
cn=[group1],
|
||||
description=[u'New desc 1'],
|
||||
gidnumber=[fuzzy_digits],
|
||||
@@ -293,7 +293,7 @@ class test_group(Declarative):
|
||||
truncated=False,
|
||||
result=[
|
||||
dict(
|
||||
#dn=u'cn=%s,cn=groups,cn=accounts,%s' % (group2, api.env.basedn),
|
||||
dn=u'cn=%s,cn=groups,cn=accounts,%s' % (group2, api.env.basedn),
|
||||
cn=[group2],
|
||||
description=[u'New desc 2'],
|
||||
),
|
||||
@@ -312,32 +312,32 @@ class test_group(Declarative):
|
||||
truncated=False,
|
||||
result=[
|
||||
{
|
||||
#'dn': u'cn=admins,cn=groups,cn=accounts,%s' % api.env.basedn,
|
||||
'dn': u'cn=admins,cn=groups,cn=accounts,%s' % api.env.basedn,
|
||||
'member_user': [u'admin'],
|
||||
'gidnumber': [fuzzy_digits],
|
||||
'cn': [u'admins'],
|
||||
'description': [u'Account administrators group'],
|
||||
},
|
||||
{
|
||||
#'dn': u'cn=ipausers,cn=groups,cn=accounts,%s' % api.env.basedn,
|
||||
'dn': u'cn=ipausers,cn=groups,cn=accounts,%s' % api.env.basedn,
|
||||
'gidnumber': [fuzzy_digits],
|
||||
'cn': [u'ipausers'],
|
||||
'description': [u'Default group for all users'],
|
||||
},
|
||||
{
|
||||
#'dn': u'cn=editors,cn=groups,cn=accounts,%s' % api.env.basedn,
|
||||
'dn': u'cn=editors,cn=groups,cn=accounts,%s' % api.env.basedn,
|
||||
'gidnumber': [fuzzy_digits],
|
||||
'cn': [u'editors'],
|
||||
'description': [u'Limited admins who can edit other users'],
|
||||
},
|
||||
dict(
|
||||
#dn=u'cn=%s,cn=groups,cn=accounts,%s' % (group1, api.env.basedn),
|
||||
dn=u'cn=%s,cn=groups,cn=accounts,%s' % (group1, api.env.basedn),
|
||||
cn=[group1],
|
||||
description=[u'New desc 1'],
|
||||
gidnumber=[fuzzy_digits],
|
||||
),
|
||||
dict(
|
||||
#dn=u'cn=%s,cn=groups,cn=accounts,%s' % (group2, api.env.basedn),
|
||||
dn=u'cn=%s,cn=groups,cn=accounts,%s' % (group2, api.env.basedn),
|
||||
cn=[group2],
|
||||
description=[u'New desc 2'],
|
||||
),
|
||||
|
||||
@@ -148,7 +148,7 @@ class test_host(Declarative):
|
||||
summary=u'1 host matched',
|
||||
result=[
|
||||
dict(
|
||||
#dn=dn1,
|
||||
dn=dn1,
|
||||
fqdn=[fqdn1],
|
||||
description=[u'Test host 1'],
|
||||
l=[u'Undisclosed location 1'],
|
||||
@@ -168,6 +168,7 @@ class test_host(Declarative):
|
||||
summary=u'1 host matched',
|
||||
result=[
|
||||
dict(
|
||||
dn=dn1,
|
||||
cn=[fqdn1],
|
||||
fqdn=[fqdn1],
|
||||
description=[u'Test host 1'],
|
||||
|
||||
@@ -165,7 +165,7 @@ class test_hostgroup(Declarative):
|
||||
summary=u'1 hostgroup matched',
|
||||
result=[
|
||||
{
|
||||
#'dn': dn1,
|
||||
'dn': dn1,
|
||||
'member_host': [u'testhost1.%s' % api.env.domain],
|
||||
'cn': [hostgroup1],
|
||||
'description': [u'Test hostgroup 1'],
|
||||
|
||||
@@ -184,7 +184,7 @@ class test_rolegroup(Declarative):
|
||||
summary=u'1 rolegroup matched',
|
||||
result=[
|
||||
{
|
||||
#'dn': rolegroup1_dn,
|
||||
'dn': rolegroup1_dn,
|
||||
'cn': [rolegroup1],
|
||||
'description': [u'rolegroup desc 1'],
|
||||
'member_group': [group1],
|
||||
@@ -203,7 +203,7 @@ class test_rolegroup(Declarative):
|
||||
summary=u'1 rolegroup matched',
|
||||
result=[
|
||||
{
|
||||
#'dn': rolegroup1_dn,
|
||||
'dn': rolegroup1_dn,
|
||||
'cn': [rolegroup1],
|
||||
'description': [u'rolegroup desc 1'],
|
||||
'member_group': [group1],
|
||||
@@ -240,7 +240,7 @@ class test_rolegroup(Declarative):
|
||||
summary=u'1 rolegroup matched',
|
||||
result=[
|
||||
{
|
||||
#'dn': rolegroup1_dn,
|
||||
'dn': rolegroup1_dn,
|
||||
'cn': [rolegroup1],
|
||||
'description': [u'rolegroup desc 1'],
|
||||
'member_group': [group1],
|
||||
@@ -259,13 +259,13 @@ class test_rolegroup(Declarative):
|
||||
summary=u'2 rolegroups matched',
|
||||
result=[
|
||||
{
|
||||
#'dn': rolegroup1_dn,
|
||||
'dn': rolegroup1_dn,
|
||||
'cn': [rolegroup1],
|
||||
'description': [u'rolegroup desc 1'],
|
||||
'member_group': [group1],
|
||||
},
|
||||
{
|
||||
#'dn': rolegroup2_dn,
|
||||
'dn': rolegroup2_dn,
|
||||
'cn': [rolegroup2],
|
||||
'description': [u'rolegroup desc 2'],
|
||||
},
|
||||
@@ -396,7 +396,7 @@ class test_rolegroup(Declarative):
|
||||
summary=u'1 rolegroup matched',
|
||||
result=[
|
||||
{
|
||||
#'dn': rolegroup2_dn,
|
||||
'dn': rolegroup2_dn,
|
||||
'cn': [rolegroup2],
|
||||
'description': [u'rolegroup desc 2'],
|
||||
},
|
||||
|
||||
@@ -206,7 +206,7 @@ class test_taskgroup(Declarative):
|
||||
summary=u'1 taskgroup matched',
|
||||
result=[
|
||||
{
|
||||
#'dn': taskgroup1_dn,
|
||||
'dn': taskgroup1_dn,
|
||||
'cn': [taskgroup1],
|
||||
'description': [u'Test desc 1'],
|
||||
'member_rolegroup': [rolegroup1],
|
||||
@@ -226,7 +226,7 @@ class test_taskgroup(Declarative):
|
||||
summary=u'1 taskgroup matched',
|
||||
result=[
|
||||
{
|
||||
#'dn': taskgroup1_dn,
|
||||
'dn': taskgroup1_dn,
|
||||
'cn': [taskgroup1],
|
||||
'description': [u'Test desc 1'],
|
||||
'member_rolegroup': [rolegroup1],
|
||||
@@ -264,7 +264,7 @@ class test_taskgroup(Declarative):
|
||||
summary=u'1 taskgroup matched',
|
||||
result=[
|
||||
{
|
||||
#'dn': taskgroup1_dn,
|
||||
'dn': taskgroup1_dn,
|
||||
'cn': [taskgroup1],
|
||||
'description': [u'Test desc 1'],
|
||||
'member_rolegroup': [rolegroup1],
|
||||
@@ -284,14 +284,14 @@ class test_taskgroup(Declarative):
|
||||
summary=u'2 taskgroups matched',
|
||||
result=[
|
||||
{
|
||||
#'dn': taskgroup1_dn,
|
||||
'dn': taskgroup1_dn,
|
||||
'cn': [taskgroup1],
|
||||
'description': [u'Test desc 1'],
|
||||
'member_rolegroup': [rolegroup1],
|
||||
'member_group': [group1],
|
||||
},
|
||||
{
|
||||
#'dn': taskgroup2_dn,
|
||||
'dn': taskgroup2_dn,
|
||||
'cn': [taskgroup2],
|
||||
'description': [u'Test desc 2'],
|
||||
},
|
||||
@@ -401,7 +401,7 @@ class test_taskgroup(Declarative):
|
||||
summary=u'1 taskgroup matched',
|
||||
result=[
|
||||
{
|
||||
#'dn': taskgroup2_dn,
|
||||
'dn': taskgroup2_dn,
|
||||
'cn': [taskgroup2],
|
||||
'description': [u'Test desc 2'],
|
||||
},
|
||||
|
||||
@@ -123,7 +123,7 @@ class test_user(Declarative):
|
||||
expected=dict(
|
||||
result=[
|
||||
{
|
||||
#'dn': u'uid=user1,cn=users,cn=accounts,' + api.env.basedn,
|
||||
'dn': u'uid=tuser1,cn=users,cn=accounts,' + api.env.basedn,
|
||||
'cn': [u'Test User1'],
|
||||
'gecos': [user1],
|
||||
'givenname': [u'Test'],
|
||||
@@ -153,7 +153,7 @@ class test_user(Declarative):
|
||||
expected=dict(
|
||||
result=[
|
||||
dict(
|
||||
#dn=u'uid=tuser1,cn=users,cn=accounts,' + api.env.basedn,
|
||||
dn=u'uid=tuser1,cn=users,cn=accounts,' + api.env.basedn,
|
||||
givenname=[u'Test'],
|
||||
homedirectory=[u'/home/tuser1'],
|
||||
loginshell=[u'/bin/sh'],
|
||||
@@ -177,7 +177,7 @@ class test_user(Declarative):
|
||||
expected=dict(
|
||||
result=[
|
||||
dict(
|
||||
#dn=u'uid=admin,cn=users,cn=accounts,' + api.env.basedn,
|
||||
dn=u'uid=admin,cn=users,cn=accounts,' + api.env.basedn,
|
||||
homedirectory=[u'/home/admin'],
|
||||
loginshell=[u'/bin/bash'],
|
||||
sn=[u'Administrator'],
|
||||
@@ -185,7 +185,7 @@ class test_user(Declarative):
|
||||
memberof_group=[u'admins'],
|
||||
),
|
||||
dict(
|
||||
#dn=u'uid=tuser1,cn=users,cn=accounts,' + api.env.basedn,
|
||||
dn=u'uid=tuser1,cn=users,cn=accounts,' + api.env.basedn,
|
||||
givenname=[u'Test'],
|
||||
homedirectory=[u'/home/tuser1'],
|
||||
loginshell=[u'/bin/sh'],
|
||||
|
||||
Reference in New Issue
Block a user