summaryrefslogtreecommitdiffstats
path: root/nova/tests
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2013-03-13 19:14:27 +0000
committerGerrit Code Review <review@openstack.org>2013-03-13 19:14:27 +0000
commitbad46261e1af94ab4364c050cb0193f8673b3129 (patch)
tree4e7630f3791e605e988d110254d1d68c46316746 /nova/tests
parentdd6e5368f1a9512f807f5140f687804d6a96adf5 (diff)
parente4e0d37f8a487d562d95a1ab37b4a90d861eb1d5 (diff)
Merge "Fix behaviour of split_cell_and_item"
Diffstat (limited to 'nova/tests')
-rw-r--r--nova/tests/cells/test_cells_utils.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/nova/tests/cells/test_cells_utils.py b/nova/tests/cells/test_cells_utils.py
index 84f60a796..871df0372 100644
--- a/nova/tests/cells/test_cells_utils.py
+++ b/nova/tests/cells/test_cells_utils.py
@@ -80,3 +80,26 @@ class CellsUtilsTestCase(test.TestCase):
{'changes-since': 'fake-updated-since',
'project_id': 'fake-project'})
self.assertEqual(call_info['shuffle'], 2)
+
+ def test_split_cell_and_item(self):
+ path = 'australia', 'queensland', 'gold_coast'
+ cell = cells_utils._PATH_CELL_SEP.join(path)
+ item = 'host_5'
+ together = cells_utils.cell_with_item(cell, item)
+ self.assertEqual(cells_utils._CELL_ITEM_SEP.join([cell, item]),
+ together)
+
+ # Test normal usage
+ result_cell, result_item = cells_utils.split_cell_and_item(together)
+ self.assertEqual(cell, result_cell)
+ self.assertEqual(item, result_item)
+
+ # Test with no cell
+ cell = None
+ together = cells_utils.cell_with_item(cell, item)
+ self.assertEqual(item, together)
+ print together
+ result_cell, result_item = cells_utils.split_cell_and_item(together)
+ print result_cell, result_item
+ self.assertEqual(cell, result_cell)
+ self.assertEqual(item, result_item)