Test _alternate_id logic
This unit test shows an underlying issue that was causing some key_manager service methods to fail. The issue has since been fixed, as the test passes now. But let's add the test. Change-Id: I3e9e737064a167694a176cc3afb20bb5bcc59f98 Related-Bug: #1628957
This commit is contained in:
parent
d92678a7ac
commit
45629a9e76
@ -633,6 +633,24 @@ class TestResource(base.TestCase):
|
||||
self.assertEqual(sot.alt, value2)
|
||||
self.assertEqual(sot.id, value2)
|
||||
|
||||
def test__alternate_id_from_other_property(self):
|
||||
class Test(resource.Resource):
|
||||
foo = resource.Body("foo")
|
||||
bar = resource.Body("bar", alternate_id=True)
|
||||
|
||||
# NOTE(redrobot): My expectation looking at the Test class defined
|
||||
# in this test is that because the alternate_id parameter is
|
||||
# is being set to True on the "bar" property of the Test class,
|
||||
# then the _alternate_id() method should return the name of that "bar"
|
||||
# property.
|
||||
self.assertEqual("bar", Test._alternate_id())
|
||||
sot = Test(bar='bunnies')
|
||||
self.assertEqual(sot.id, 'bunnies')
|
||||
self.assertEqual(sot.bar, 'bunnies')
|
||||
sot = Test(id='chickens', bar='bunnies')
|
||||
self.assertEqual(sot.id, 'chickens')
|
||||
self.assertEqual(sot.bar, 'bunnies')
|
||||
|
||||
def test__get_id_instance(self):
|
||||
class Test(resource.Resource):
|
||||
id = resource.Body("id")
|
||||
|
Loading…
x
Reference in New Issue
Block a user