xmlrpc_test: Expect bytes rather than strings for binary attributes

The attributes krbextradata, krbprincipalkey, and userpassword contain
binary data.

Part of the work for: https://fedorahosted.org/freeipa/ticket/4985

Reviewed-By: Martin Basti <mbasti@redhat.com>
Reviewed-By: Petr Spacek <pspacek@redhat.com>
This commit is contained in:
Petr Viktorin 2016-04-29 16:26:04 +02:00 committed by Martin Basti
parent 890f83b0bb
commit 095d0cb7af
3 changed files with 8 additions and 8 deletions

View File

@ -75,8 +75,8 @@ options_def = OrderedDict([
('random password', {u'random': True}),
])
options_ok = options_def.values()
options_ids = options_def.keys()
options_ok = list(options_def.values())
options_ids = list(options_def.keys())
@pytest.fixture(scope='class')

View File

@ -35,7 +35,7 @@ from ipatests.util import (
assert_deepequal, assert_equal, assert_not_equal, raises)
from ipatests.test_xmlrpc.xmlrpc_test import (
XMLRPC_test, fuzzy_digits, fuzzy_uuid, fuzzy_password,
fuzzy_string, fuzzy_dergeneralizedtime, add_sid, add_oc, raises_exact)
Fuzzy, fuzzy_dergeneralizedtime, add_sid, add_oc, raises_exact)
from ipapython.dn import DN
from ipatests.test_xmlrpc.tracker.base import Tracker
@ -483,7 +483,7 @@ class TestCreate(XMLRPC_test):
testuser.attrs.update(
randompassword=fuzzy_password,
has_keytab=True, has_password=True,
krbextradata=[fuzzy_string],
krbextradata=[Fuzzy(type=bytes)],
krbpasswordexpiration=[fuzzy_dergeneralizedtime],
krblastpwdchange=[fuzzy_dergeneralizedtime]
)

View File

@ -9,7 +9,7 @@ from ipalib import api, errors
from ipatests.test_xmlrpc.tracker.base import Tracker
from ipatests.test_xmlrpc import objectclasses
from ipatests.test_xmlrpc.xmlrpc_test import (
fuzzy_string, fuzzy_dergeneralizedtime, raises_exact)
Fuzzy, fuzzy_string, fuzzy_dergeneralizedtime, raises_exact)
from ipatests.util import assert_deepequal
from ipapython.dn import DN
@ -136,12 +136,12 @@ class StageUserTracker(Tracker):
self.attrs[u'sshpubkeyfp'] = [sshpubkeyfp]
self.attrs[key] = [self.kwargs[key]]
elif key == u'random' or key == u'userpassword':
self.attrs[u'krbextradata'] = [fuzzy_string]
self.attrs[u'krbextradata'] = [Fuzzy(type=bytes)]
self.attrs[u'krbpasswordexpiration'] = [
fuzzy_dergeneralizedtime]
self.attrs[u'krblastpwdchange'] = [fuzzy_dergeneralizedtime]
self.attrs[u'krbprincipalkey'] = [fuzzy_string]
self.attrs[u'userpassword'] = [fuzzy_string]
self.attrs[u'krbprincipalkey'] = [Fuzzy(type=bytes)]
self.attrs[u'userpassword'] = [Fuzzy(type=bytes)]
self.attrs[u'has_keytab'] = True
self.attrs[u'has_password'] = True
if key == u'random':