diff options
author | Zuul <zuul@review.opendev.org> | 2023-05-17 23:20:30 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2023-05-17 23:20:30 +0000 |
commit | 4c7b2e3bb573a451ee7b2c0dec9e0a8da9d94129 (patch) | |
tree | 28274904f8ea2a27ed834b91df0755621bc66f3a /test/unit/common/test_utils.py | |
parent | 667f733cb938ddf5e5f46732463c46d030d0603d (diff) | |
parent | 0a4e41701dbb5795ff4cab7a2c68a41c90bd51e7 (diff) | |
download | swift-master.tar.gz |
Diffstat (limited to 'test/unit/common/test_utils.py')
-rw-r--r-- | test/unit/common/test_utils.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/test/unit/common/test_utils.py b/test/unit/common/test_utils.py index e66508c6d..b92d492b3 100644 --- a/test/unit/common/test_utils.py +++ b/test/unit/common/test_utils.py @@ -3713,6 +3713,15 @@ cluster_dfw1 = http://dfw1.host/v1/ self.fail('Invalid results from pure function:\n%s' % '\n'.join(failures)) + def test_cap_length(self): + self.assertEqual(utils.cap_length(None, 3), None) + self.assertEqual(utils.cap_length('', 3), '') + self.assertEqual(utils.cap_length('asdf', 3), 'asd...') + self.assertEqual(utils.cap_length('asdf', 5), 'asdf') + + self.assertEqual(utils.cap_length(b'asdf', 3), b'asd...') + self.assertEqual(utils.cap_length(b'asdf', 5), b'asdf') + def test_get_partition_for_hash(self): hex_hash = 'af088baea4806dcaba30bf07d9e64c77' self.assertEqual(43, utils.get_partition_for_hash(hex_hash, 6)) |