"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "keystone/tests/unit/common/test_utils.py" between
keystone-16.0.1.tar.gz and keystone-17.0.0.tar.gz

About: OpenStack Keystone (Core Service: Identity) provides an authentication and authorization service for other OpenStack services. Provides a catalog of endpoints for all OpenStack services.
The "Ussuri" series (latest release).

test_utils.py  (keystone-16.0.1):test_utils.py  (keystone-17.0.0)
skipping to change at line 21 skipping to change at line 21
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import datetime import datetime
import fixtures import fixtures
import uuid import uuid
import freezegun import freezegun
from oslo_config import fixture as config_fixture from oslo_config import fixture as config_fixture
from oslo_log import log from oslo_log import log
import six
from keystone.common import fernet_utils from keystone.common import fernet_utils
from keystone.common import utils as common_utils from keystone.common import utils as common_utils
import keystone.conf import keystone.conf
from keystone.credential.providers import fernet as credential_fernet from keystone.credential.providers import fernet as credential_fernet
from keystone import exception from keystone import exception
from keystone.server.flask import application from keystone.server.flask import application
from keystone.tests import unit from keystone.tests import unit
from keystone.tests.unit import ksfixtures from keystone.tests.unit import ksfixtures
from keystone.tests.unit import utils from keystone.tests.unit import utils
skipping to change at line 53 skipping to change at line 52
def test_resource_uuid(self): def test_resource_uuid(self):
# Basic uuid test, most IDs issued by keystone look like this: # Basic uuid test, most IDs issued by keystone look like this:
value = u'536e28c2017e405e89b25a1ed777b952' value = u'536e28c2017e405e89b25a1ed777b952'
self.assertEqual(value, common_utils.resource_uuid(value)) self.assertEqual(value, common_utils.resource_uuid(value))
def test_resource_64_char_uuid(self): def test_resource_64_char_uuid(self):
# Exact 64 length string, like ones used by mapping_id backend, are not # Exact 64 length string, like ones used by mapping_id backend, are not
# valid UUIDs, so they will be UUID5 namespaced # valid UUIDs, so they will be UUID5 namespaced
value = u'f13de678ac714bb1b7d1e9a007c10db5' * 2 value = u'f13de678ac714bb1b7d1e9a007c10db5' * 2
if six.PY2:
value = value.encode('utf-8')
expected_id = uuid.uuid5(common_utils.RESOURCE_ID_NAMESPACE, value).hex expected_id = uuid.uuid5(common_utils.RESOURCE_ID_NAMESPACE, value).hex
self.assertEqual(expected_id, common_utils.resource_uuid(value)) self.assertEqual(expected_id, common_utils.resource_uuid(value))
def test_resource_non_ascii_chars(self): def test_resource_non_ascii_chars(self):
# IDs with non-ASCII characters will be UUID5 namespaced # IDs with non-ASCII characters will be UUID5 namespaced
value = u'ß' * 32 value = u'ß' * 32
if six.PY2:
value = value.encode('utf-8')
expected_id = uuid.uuid5(common_utils.RESOURCE_ID_NAMESPACE, value).hex expected_id = uuid.uuid5(common_utils.RESOURCE_ID_NAMESPACE, value).hex
self.assertEqual(expected_id, common_utils.resource_uuid(value)) self.assertEqual(expected_id, common_utils.resource_uuid(value))
def test_resource_invalid_id(self): def test_resource_invalid_id(self):
# This input is invalid because it's length is more than 64. # This input is invalid because it's length is more than 64.
value = u'x' * 65 value = u'x' * 65
self.assertRaises(ValueError, common_utils.resource_uuid, self.assertRaises(ValueError, common_utils.resource_uuid,
value) value)
def test_hash(self): def test_hash(self):
 End of changes. 3 change blocks. 
5 lines changed or deleted 0 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)