Encode should be called only for strings

If not string provided as arg to print_to_output
it should not be encoded, and lets assume that proper unicode handling
will be done in custom print_method

Change-Id: If0c03571ccc7513fe85c38477ad9750ad9d82e97
Closes-Bug: #1330485
This commit is contained in:
Dima Shulyak 2014-06-17 13:10:14 +03:00
parent 9112643217
commit 4ddf2faf88
2 changed files with 12 additions and 0 deletions

View File

@ -61,6 +61,8 @@ class Serializer(object):
if self.format_flags:
self.print_formatted(formatted_data)
else:
if isinstance(arg, unicode):
arg = arg.encode('utf-8')
print_method(arg)
def prepare_path(self, path):

View File

@ -228,3 +228,13 @@ class TestDownloadUploadNodeAttributes(BaseTestCase):
cmd = "node --node-id 1 --disk"
self.run_cli_commands((self.download_command(cmd),
self.upload_command(cmd)))
class TestDeployChanges(BaseTestCase):
def test_deploy_changes_no_failure(self):
self.load_data_to_nailgun_server()
env_create = "env create --name=test --release=1"
add_node = "--env-id=1 node set --node 1 --role=controller"
deploy_changes = "deploy-changes --env 1"
self.run_cli_commands((env_create, add_node, deploy_changes))