Strip space from all nodes names

Fix #727
This commit is contained in:
Julien Duponchelle
2016-10-18 11:11:45 +02:00
parent a8ffaa9cb5
commit dd849f7945
2 changed files with 19 additions and 0 deletions

View File

@ -539,3 +539,20 @@ def test_suspend_all(project, async_run):
compute.post = AsyncioMagicMock()
async_run(project.suspend_all())
assert len(compute.post.call_args_list) == 10
def test_node_name(project, async_run):
compute = MagicMock()
compute.id = "local"
response = MagicMock()
response.json = {"console": 2048}
compute.post = AsyncioMagicMock(return_value=response)
node = async_run(project.add_node(compute, "test-{0}", None, node_type="vpcs", properties={"startup_config": "test.cfg"}))
assert node.name == "test-1"
node = async_run(project.add_node(compute, "test-{0}", None, node_type="vpcs", properties={"startup_config": "test.cfg"}))
assert node.name == "test-2"
node = async_run(project.add_node(compute, "hello world-{0}", None, node_type="vpcs", properties={"startup_config": "test.cfg"}))
assert node.name == "helloworld-1"
node = async_run(project.add_node(compute, "hello world-{0}", None, node_type="vpcs", properties={"startup_config": "test.cfg"}))
assert node.name == "helloworld-2"