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. Change-Id: Ief0597bbd0f1486f23eb799b68a85b590b7e35ef Partial-Bug: 1419187
This commit is contained in:
parent
e323d6282a
commit
635ff8f307
|
@ -1,3 +1,4 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2014 IBM Corp.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
|
@ -116,6 +117,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