diff options
author | Alexey Stupnikov <aleksey.stupnikov@gmail.com> | 2021-07-26 11:37:19 +0000 |
---|---|---|
committer | Alexey Stupnikov <aleksey.stupnikov@gmail.com> | 2021-08-03 13:13:58 +0200 |
commit | 2c74bb92e5e9561e2ad1386c2e14fb042d6dc062 (patch) | |
tree | a9a90b8b4a0c2fbaf220f59367176327d1bc3ae4 /oslo_utils/tests/test_fixture.py | |
parent | 75c4abd909aa86f01e138329e89ffc31d53ef2d3 (diff) | |
download | oslo-utils-2c74bb92e5e9561e2ad1386c2e14fb042d6dc062.tar.gz |
Modify UUID sentinel to support keystone-like UUIDs4.10.0
Keystone User IDs and Project IDs are used in unit tests, but
_UUIDSentinels() class doesn't generate UUIDs without hyphens.
This patch makes backward compatible modifications to
_UUIDSentinels() class and introduces keystoneidsentinel global
that could be used in the same way as existing uuidsentinel.
Original "UUID sentinel" change: I214ff21b461fa1ca4b83476e1d0a763efe986217
Related-Bug: #1746747
Change-Id: Idb3e893cc03d64ad0522b5e4cedfa30c4f4a2a2f
Diffstat (limited to 'oslo_utils/tests/test_fixture.py')
-rw-r--r-- | oslo_utils/tests/test_fixture.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/oslo_utils/tests/test_fixture.py b/oslo_utils/tests/test_fixture.py index b106f15..c6b2e6d 100644 --- a/oslo_utils/tests/test_fixture.py +++ b/oslo_utils/tests/test_fixture.py @@ -19,6 +19,7 @@ import datetime from oslotest import base as test_base from oslo_utils import fixture +from oslo_utils.fixture import keystoneidsentinel as keystids from oslo_utils.fixture import uuidsentinel as uuids from oslo_utils import timeutils from oslo_utils import uuidutils @@ -71,13 +72,20 @@ class UUIDSentinelsTest(test_base.BaseTestCase): uuid1 = uuids.foobar uuid2 = uuids.barfoo self.assertNotEqual(uuid1, uuid2) + keystid1 = keystids.foobar + keystid2 = keystids.barfoo + self.assertNotEqual(keystid1, keystid2) def test_returns_uuid(self): self.assertTrue(uuidutils.is_uuid_like(uuids.foo)) + self.assertTrue(uuidutils.is_uuid_like(keystids.foo)) def test_returns_string(self): self.assertIsInstance(uuids.foo, str) + self.assertIsInstance(keystids.foo, str) def test_with_underline_prefix(self): ex = self.assertRaises(AttributeError, getattr, uuids, '_foo') self.assertIn("Sentinels must not start with _", str(ex)) + ex = self.assertRaises(AttributeError, getattr, keystids, '_foo') + self.assertIn("Sentinels must not start with _", str(ex)) |