Improve testing of unicode id mapping
We currently don't test that our id mapping correctly supports
unicode - and in fact, it doesn't. This patch adds a test that
demonstrates this. A follow-on patch will fix the issue.
(cherry picked from commit 635ff8f307
)
Partial-Bug: 1419187
Change-Id: Ief0597bbd0f1486f23eb799b68a85b590b7e35ef
This commit is contained in:
parent
52ec155b3a
commit
a322ceea9d
|
@ -1,3 +1,4 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2014 IBM Corp.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
|
@ -118,6 +119,21 @@ class SqlIDMapping(test_backend_sql.SqlTests):
|
|||
self.assertThat(mapping_sql.list_id_mappings(),
|
||||
matchers.HasLength(initial_mappings))
|
||||
|
||||
def test_id_mapping_handles_unicode(self):
|
||||
local_id = u'fäké1'
|
||||
local_entity = {'domain_id': self.domainA['id'],
|
||||
'local_id': local_id,
|
||||
'entity_type': mapping.EntityType.USER}
|
||||
|
||||
# Check no mappings for the new local entity
|
||||
self.assertIsNone(self.id_mapping_api.get_public_id(local_entity))
|
||||
|
||||
# The mapping generator should handle unicode, although currently this
|
||||
# fails due to bug #1419187
|
||||
self.assertRaises(UnicodeEncodeError,
|
||||
self.id_mapping_api.create_id_mapping,
|
||||
local_entity)
|
||||
|
||||
def test_delete_public_id_is_silent(self):
|
||||
# Test that deleting an invalid public key is silent
|
||||
self.id_mapping_api.delete_id_mapping(uuid.uuid4().hex)
|
||||
|
|
Loading…
Reference in New Issue