Fix an action execution controller test

* test_get_all_with_and_without_output failed sometimes failed on
  Python 3.7 with a weird error coming from simplejson library:
  "AttributeError: 'MagicMock' object has no attribute 'items'"
  It seems like that the mock object used in the test got broken
  magically sometimes after the first use. So splitting the test
  into two solved the issue.

Change-Id: Ic2e0ad75b666dd4c258764018dd68d0ef0b032a8
This commit is contained in:
Renat Akhmerov
2019-04-17 18:16:29 +07:00
parent 7704797493
commit 9a60cd62d2

View File

@@ -557,10 +557,10 @@ class TestActionExecutionsController(base.APITest):
self.assertEqual(1, len(resp.json['action_executions']))
self.assertDictEqual(ACTION_EX, resp.json['action_executions'][0])
@mock.patch.object(db_api, 'get_action_executions', MOCK_ACTIONS)
@mock.patch.object(rest_utils, 'get_all')
def test_get_all_with_and_without_output(self, mock_get_all):
def test_get_all_without_output(self, mock_get_all):
resp = self.app.get('/v2/action_executions')
args, kwargs = mock_get_all.call_args
resource_function = kwargs['resource_function']
@@ -570,7 +570,10 @@ class TestActionExecutionsController(base.APITest):
resource_function
)
@mock.patch.object(rest_utils, 'get_all')
def test_get_all_with_output(self, mock_get_all):
resp = self.app.get('/v2/action_executions?include_output=true')
args, kwargs = mock_get_all.call_args
resource_function = kwargs['resource_function']