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 aa00bba535
commit 815d6b301f
2 changed files with 13 additions and 1 deletions

View File

@@ -63,7 +63,9 @@ class Serializer(object):
if self.format_flags:
self.print_formatted(formatted_data)
else:
print_method(arg.encode('utf-8'))
if isinstance(arg, unicode):
arg = arg.encode('utf-8')
print_method(arg)
def prepare_path(self, path):
return "{0}.{1}".format(

View File

@@ -241,3 +241,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))