)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":8556,"name":"Ghanshyam Maan","display_name":"Ghanshyam Maan","email":"gmaan.os14@gmail.com","username":"ghanshyam"},"change_message_id":"319e988142e2547126ccb92f4a3d1a08bc98aa5a","unresolved":false,"context_lines":[{"line_number":8,"context_line":""},{"line_number":9,"context_line":"remove mox3 from nova/tests/unit/virt/test_block_device.py"},{"line_number":10,"context_line":""},{"line_number":11,"context_line":"Part of blueprint remove-mox-pike"},{"line_number":12,"context_line":""},{"line_number":13,"context_line":"Change-Id: I4a2e42af85895907931f019fd3e41d2bb5485a39"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":4,"id":"bf659307_e3ace48d","line":11,"range":{"start_line":11,"start_character":0,"end_line":11,"end_character":33},"updated":"2018-03-27 02:24:21.000000000","message":"We have new BP for this now,\n- https://blueprints.launchpad.net/nova/+spec/mox-removal","commit_id":"f3cf0df639ebf05221631053a967402de470a9c2"}],"nova/tests/unit/virt/test_block_device.py":[{"author":{"_account_id":15524,"name":"dane-fichter","email":"dane.fichter@jhuapl.edu","username":"dane-fichter"},"change_message_id":"59d66e77ca81f94273ab371a6c31a6c5b69ebfac","unresolved":false,"context_lines":[{"line_number":655,"context_line":"                                  return_value\u003dconnection_info),"},{"line_number":656,"context_line":"        ) as (mock_save,"},{"line_number":657,"context_line":"              mock_get_volume_connector,"},{"line_number":658,"context_line":"              mock_initialize_connection):"},{"line_number":659,"context_line":"            test_bdm.refresh_connection_info(self.context, instance,"},{"line_number":660,"context_line":"                                             self.volume_api, self.virt_driver)"},{"line_number":661,"context_line":"            self.assertThat(test_bdm[\u0027connection_info\u0027],"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f201791_1cd8b978","line":658,"updated":"2017-06-27 13:22:08.000000000","message":"These can be mocked out using @ notation before the test method.","commit_id":"3e55dcf8957f98f6ab05fc83ad539cc30beea93c"},{"author":{"_account_id":15524,"name":"dane-fichter","email":"dane.fichter@jhuapl.edu","username":"dane-fichter"},"change_message_id":"59d66e77ca81f94273ab371a6c31a6c5b69ebfac","unresolved":false,"context_lines":[{"line_number":775,"context_line":"            mock.patch.object(self.volume_api, \u0027create\u0027),"},{"line_number":776,"context_line":"        ) as (mock_attach, mock_get_snapshot, mock_create):"},{"line_number":777,"context_line":"            test_bdm.attach(self.context, instance, self.volume_api,"},{"line_number":778,"context_line":"                            self.virt_driver)"},{"line_number":779,"context_line":"            self.assertEqual(test_bdm.volume_id, \u0027fake-volume-id-2\u0027)"},{"line_number":780,"context_line":"            mock_attach.assert_called_once_with(self.context,"},{"line_number":781,"context_line":"                                                instance,"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f201791_7cbe8dff","line":778,"updated":"2017-06-27 13:22:08.000000000","message":"Ditto here.","commit_id":"3e55dcf8957f98f6ab05fc83ad539cc30beea93c"},{"author":{"_account_id":15524,"name":"dane-fichter","email":"dane.fichter@jhuapl.edu","username":"dane-fichter"},"change_message_id":"59d66e77ca81f94273ab371a6c31a6c5b69ebfac","unresolved":false,"context_lines":[{"line_number":884,"context_line":"            mock.patch.object(self.volume_api, \u0027create\u0027)"},{"line_number":885,"context_line":"        ) as (mock_attach, mock_get_snapshots, mock_create):"},{"line_number":886,"context_line":"            test_bdm.attach(self.context, instance, self.volume_api,"},{"line_number":887,"context_line":"                            self.virt_driver)"},{"line_number":888,"context_line":"            self.assertEqual(test_bdm.volume_id, \u0027fake-volume-id-2\u0027)"},{"line_number":889,"context_line":"            mock_attach.assert_called_once_with(self.context,"},{"line_number":890,"context_line":"                                                instance,"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f201791_1c3d598e","line":887,"updated":"2017-06-27 13:22:08.000000000","message":"And here.","commit_id":"3e55dcf8957f98f6ab05fc83ad539cc30beea93c"},{"author":{"_account_id":15524,"name":"dane-fichter","email":"dane.fichter@jhuapl.edu","username":"dane-fichter"},"change_message_id":"276eeab6b781898e9404db19ef4df609d4cd7d88","unresolved":false,"context_lines":[{"line_number":416,"context_line":"    def _mock_out_object(self, obj, attr, **kargs):"},{"line_number":417,"context_line":"        patcher \u003d mock.patch.object(obj, attr)"},{"line_number":418,"context_line":"        patcher.start()"},{"line_number":419,"context_line":"        self.addCleanup(patcher.stop)"},{"line_number":420,"context_line":""},{"line_number":421,"context_line":"    def _create_mock_for_test_volume_attach("},{"line_number":422,"context_line":"            self, driver_bdm, bdm_dict, fake_volume, fail_check_av_zone\u003dFalse,"}],"source_content_type":"text/x-python","patch_set":4,"id":"3f1d235d_9ff0c9cb","line":419,"updated":"2017-06-30 13:30:11.000000000","message":"Why is this function necessary?","commit_id":"f3cf0df639ebf05221631053a967402de470a9c2"},{"author":{"_account_id":8556,"name":"Ghanshyam Maan","display_name":"Ghanshyam Maan","email":"gmaan.os14@gmail.com","username":"ghanshyam"},"change_message_id":"319e988142e2547126ccb92f4a3d1a08bc98aa5a","unresolved":false,"context_lines":[{"line_number":416,"context_line":"    def _mock_out_object(self, obj, attr, **kargs):"},{"line_number":417,"context_line":"        patcher \u003d mock.patch.object(obj, attr)"},{"line_number":418,"context_line":"        patcher.start()"},{"line_number":419,"context_line":"        self.addCleanup(patcher.stop)"},{"line_number":420,"context_line":""},{"line_number":421,"context_line":"    def _create_mock_for_test_volume_attach("},{"line_number":422,"context_line":"            self, driver_bdm, bdm_dict, fake_volume, fail_check_av_zone\u003dFalse,"}],"source_content_type":"text/x-python","patch_set":4,"id":"bf659307_63a53404","line":419,"in_reply_to":"3f1d235d_9ff0c9cb","updated":"2018-03-27 02:24:21.000000000","message":"yea, i do not think we need this.","commit_id":"f3cf0df639ebf05221631053a967402de470a9c2"},{"author":{"_account_id":15524,"name":"dane-fichter","email":"dane.fichter@jhuapl.edu","username":"dane-fichter"},"change_message_id":"276eeab6b781898e9404db19ef4df609d4cd7d88","unresolved":false,"context_lines":[{"line_number":418,"context_line":"        patcher.start()"},{"line_number":419,"context_line":"        self.addCleanup(patcher.stop)"},{"line_number":420,"context_line":""},{"line_number":421,"context_line":"    def _create_mock_for_test_volume_attach("},{"line_number":422,"context_line":"            self, driver_bdm, bdm_dict, fake_volume, fail_check_av_zone\u003dFalse,"},{"line_number":423,"context_line":"            driver_attach\u003dFalse, fail_driver_attach\u003dFalse, volume_attach\u003dTrue,"},{"line_number":424,"context_line":"            fail_volume_attach\u003dFalse, access_mode\u003d\u0027rw\u0027,"}],"source_content_type":"text/x-python","patch_set":4,"id":"3f1d235d_bf7a6521","line":421,"updated":"2017-06-30 13:30:11.000000000","message":"Same with these helper \"create_mock\" functions. For each test, simply use function decorators to mock out what you need.","commit_id":"f3cf0df639ebf05221631053a967402de470a9c2"},{"author":{"_account_id":8556,"name":"Ghanshyam Maan","display_name":"Ghanshyam Maan","email":"gmaan.os14@gmail.com","username":"ghanshyam"},"change_message_id":"319e988142e2547126ccb92f4a3d1a08bc98aa5a","unresolved":false,"context_lines":[{"line_number":418,"context_line":"        patcher.start()"},{"line_number":419,"context_line":"        self.addCleanup(patcher.stop)"},{"line_number":420,"context_line":""},{"line_number":421,"context_line":"    def _create_mock_for_test_volume_attach("},{"line_number":422,"context_line":"            self, driver_bdm, bdm_dict, fake_volume, fail_check_av_zone\u003dFalse,"},{"line_number":423,"context_line":"            driver_attach\u003dFalse, fail_driver_attach\u003dFalse, volume_attach\u003dTrue,"},{"line_number":424,"context_line":"            fail_volume_attach\u003dFalse, access_mode\u003d\u0027rw\u0027,"}],"source_content_type":"text/x-python","patch_set":4,"id":"bf659307_e377043a","line":421,"in_reply_to":"3f1d235d_a2b3504d","updated":"2018-03-27 02:24:21.000000000","message":"you can do on internal function also, ex- https://github.com/openstack/nova/blob/f81865f56bd5aeffddfff99fdaa089160ce88048/nova/tests/functional/test_compute_mgr.py#L65","commit_id":"f3cf0df639ebf05221631053a967402de470a9c2"},{"author":{"_account_id":21363,"name":"Gao Yuan","email":"yuan.gao@easystack.cn","username":"gaoyuan"},"change_message_id":"6ce2edb40ce49281b0b89effb39ce16f09b4cc46","unresolved":false,"context_lines":[{"line_number":418,"context_line":"        patcher.start()"},{"line_number":419,"context_line":"        self.addCleanup(patcher.stop)"},{"line_number":420,"context_line":""},{"line_number":421,"context_line":"    def _create_mock_for_test_volume_attach("},{"line_number":422,"context_line":"            self, driver_bdm, bdm_dict, fake_volume, fail_check_av_zone\u003dFalse,"},{"line_number":423,"context_line":"            driver_attach\u003dFalse, fail_driver_attach\u003dFalse, volume_attach\u003dTrue,"},{"line_number":424,"context_line":"            fail_volume_attach\u003dFalse, access_mode\u003d\u0027rw\u0027,"}],"source_content_type":"text/x-python","patch_set":4,"id":"3f1d235d_a2b3504d","line":421,"in_reply_to":"3f1d235d_bf7a6521","updated":"2017-07-03 02:04:07.000000000","message":"This is not a test case function, it\u0027s a internal util function that shared by many other functions. It seems if using decorator, we had to add parameters into this internal function. the example you give show how to deal with a normal test case. Can you give an example of decorating a shared function? I tried to look for one, but failed.","commit_id":"f3cf0df639ebf05221631053a967402de470a9c2"}]}
