Add a test for modifying a role to set the name the same

There was no test that showed what happened when a role is modified
to have the same name. The test shows that when using the LDAP
assignment this request fails with a conflict error.

(cherry picked from commit 79c2fedd6f)

Change-Id: I40bb62200e79c8ff519e02facad042a657c26cae
Partial-Bug: #1401721
This commit is contained in:
Brant Knudson 2014-12-11 19:13:56 -06:00
parent fc6e9e8d2c
commit 7fc6585406
2 changed files with 15 additions and 0 deletions

View File

@ -3328,6 +3328,13 @@ class IdentityTests(object):
{'description': uuid.uuid4().hex})
# If the previous line didn't raise an exception then the test passes.
def test_update_role_same_name(self):
# A user can update a role and set the name to be the same as it was.
self.assignment_api.update_role(self.role_member['id'],
{'name': self.role_member['name']})
# If the previous line didn't raise an exception then the test passes.
class TokenTests(object):
def _create_token_id(self):

View File

@ -1825,6 +1825,14 @@ class LDAPIdentity(BaseLDAPIdentity, tests.TestCase):
self.assertEqual('crap', user_ref['id'])
self.assertEqual('Foo Bar', user_ref['name'])
def test_update_role_same_name(self):
# Override
# This test is failing using the LDAP assignment backend, see
# bug 1401721.
# FIXME(blk-u): This should work.
self.assertRaises(exception.Conflict,
super(LDAPIdentity, self).test_update_role_same_name)
class LDAPIdentityEnabledEmulation(LDAPIdentity):
def setUp(self):