From adc5dbb63243c2930eabbdbd85efc7131be6f0e3 Mon Sep 17 00:00:00 2001 From: Renat Akhmerov Date: Fri, 16 Oct 2015 15:25:42 +0600 Subject: [PATCH] Fix dict ordering issue in action executions CLI test Change-Id: I19e53dce2e342285858399739b787d24d837ac6e --- .../tests/unit/v2/test_cli_action_execs.py | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/mistralclient/tests/unit/v2/test_cli_action_execs.py b/mistralclient/tests/unit/v2/test_cli_action_execs.py index 7ffdb2e..4e115dd 100644 --- a/mistralclient/tests/unit/v2/test_cli_action_execs.py +++ b/mistralclient/tests/unit/v2/test_cli_action_execs.py @@ -61,8 +61,10 @@ class TestCLIActionExecutions(base.BaseCommandTest): app_args=['some', '{"output": "Hello!"}'] ) - self.app.stdout.write.assert_called_with( - json.dumps(ACTION_EX_RESULT) + "\n") + self.assertDictEqual( + ACTION_EX_RESULT, + json.loads(self.app.stdout.write.call_args[0][0]) + ) @mock.patch( 'mistralclient.api.v2.action_executions.ActionExecutionManager.create' @@ -79,7 +81,8 @@ class TestCLIActionExecutions(base.BaseCommandTest): self.assertEqual( ('123', 'some', 'thing', 'task1', 'RUNNING', - 'RUNNING somehow.', True), result[1] + 'RUNNING somehow.', True), + result[1] ) @mock.patch( @@ -106,7 +109,8 @@ class TestCLIActionExecutions(base.BaseCommandTest): self.assertEqual( [('123', 'some', 'thing', 'task1', 'RUNNING', - 'RUNNING somehow.', True)], result[1] + 'RUNNING somehow.', True)], + result[1] ) @mock.patch( @@ -130,8 +134,10 @@ class TestCLIActionExecutions(base.BaseCommandTest): self.call(action_ex_cmd.GetOutput, app_args=['id']) - self.app.stdout.write.assert_called_with( - json.dumps(ACTION_EX_RESULT, indent=4) + "\n") + self.assertDictEqual( + ACTION_EX_RESULT, + json.loads(self.app.stdout.write.call_args[0][0]) + ) @mock.patch( 'mistralclient.api.v2.action_executions.ActionExecutionManager.get' @@ -141,8 +147,9 @@ class TestCLIActionExecutions(base.BaseCommandTest): self.call(action_ex_cmd.GetInput, app_args=['id']) - self.app.stdout.write.assert_called_with( - json.dumps(ACTION_EX_INPUT, indent=4) + "\n" + self.assertDictEqual( + ACTION_EX_INPUT, + json.loads(self.app.stdout.write.call_args[0][0]) ) @mock.patch(