)]}'
{"ironic/tests/test_images.py":[{"author":{"_account_id":9315,"name":"ramesh","email":"rameshg87@gmail.com","username":"rameshg87"},"change_message_id":"267794cf49a633a0e688cd96dec4249297bf40e1","unresolved":false,"context_lines":[{"line_number":56,"context_line":"                                             \u0027qemu-img\u0027, \u0027info\u0027, \u0027img\u0027)"},{"line_number":57,"context_line":"        qemu_img_info_mock.assert_called_once_with(\u0027out\u0027)"},{"line_number":58,"context_line":""},{"line_number":59,"context_line":"    @mock.patch.object(utils, \u0027execute\u0027, return_value\u003d(\u0027out\u0027, \u0027err\u0027))"},{"line_number":60,"context_line":"    def test_convert_image(self, execute_mock):"},{"line_number":61,"context_line":"        images.convert_image(\u0027source\u0027, \u0027dest\u0027, \u0027out_format\u0027)"},{"line_number":62,"context_line":"        execute_mock.assert_called_once_with(\u0027qemu-img\u0027, \u0027convert\u0027, \u0027-O\u0027,"}],"source_content_type":"text/x-python","patch_set":1,"id":"1abeadc6_37b32b0b","line":59,"updated":"2014-08-29 09:14:11.000000000","message":"Is the return value required here ? We are not making any assertions with it.","commit_id":"f3569b1c96afaf2cea37a32f4ea2464ba9beef17"},{"author":{"_account_id":12356,"name":"Vladyslav Drok","email":"vdrok@mirantis.com","username":"vdrok"},"change_message_id":"936ee755c3fe89a6beb188743153f6824af81af2","unresolved":false,"context_lines":[{"line_number":56,"context_line":"                                             \u0027qemu-img\u0027, \u0027info\u0027, \u0027img\u0027)"},{"line_number":57,"context_line":"        qemu_img_info_mock.assert_called_once_with(\u0027out\u0027)"},{"line_number":58,"context_line":""},{"line_number":59,"context_line":"    @mock.patch.object(utils, \u0027execute\u0027, return_value\u003d(\u0027out\u0027, \u0027err\u0027))"},{"line_number":60,"context_line":"    def test_convert_image(self, execute_mock):"},{"line_number":61,"context_line":"        images.convert_image(\u0027source\u0027, \u0027dest\u0027, \u0027out_format\u0027)"},{"line_number":62,"context_line":"        execute_mock.assert_called_once_with(\u0027qemu-img\u0027, \u0027convert\u0027, \u0027-O\u0027,"}],"source_content_type":"text/x-python","patch_set":1,"id":"1abeadc6_b7f3ae71","line":59,"in_reply_to":"1abeadc6_37b32b0b","updated":"2014-08-29 10:41:10.000000000","message":"Done","commit_id":"f3569b1c96afaf2cea37a32f4ea2464ba9beef17"},{"author":{"_account_id":9315,"name":"ramesh","email":"rameshg87@gmail.com","username":"rameshg87"},"change_message_id":"267794cf49a633a0e688cd96dec4249297bf40e1","unresolved":false,"context_lines":[{"line_number":66,"context_line":"    @mock.patch.object(image_service, \u0027Service\u0027)"},{"line_number":67,"context_line":"    def test_fetch(self, image_service_mock):"},{"line_number":68,"context_line":"        open_mock \u003d mock.mock_open()"},{"line_number":69,"context_line":"        with mock.patch(\u0027__builtin__.open\u0027, open_mock, create\u003dTrue):"},{"line_number":70,"context_line":"            images.fetch(\u0027context\u0027, \u0027image_href\u0027, \u0027path\u0027)"},{"line_number":71,"context_line":"            open_mock.assert_called_once_with(\u0027path\u0027, \u0027wb\u0027)"},{"line_number":72,"context_line":"            image_service_mock.assert_called_once_with(version\u003d1,"}],"source_content_type":"text/x-python","patch_set":1,"id":"1abeadc6_976a3f18","line":69,"updated":"2014-08-29 09:14:11.000000000","message":"This can be moved as a decorator. Also we can avoid using mock.ANY and assert precisely whether download() was called with the return value of open by mocking __enter__.\n\nSomething like this:\nhttps://github.com/openstack/ironic/blob/master/ironic/tests/test_swift.py#L62-L68","commit_id":"f3569b1c96afaf2cea37a32f4ea2464ba9beef17"},{"author":{"_account_id":12356,"name":"Vladyslav Drok","email":"vdrok@mirantis.com","username":"vdrok"},"change_message_id":"936ee755c3fe89a6beb188743153f6824af81af2","unresolved":false,"context_lines":[{"line_number":66,"context_line":"    @mock.patch.object(image_service, \u0027Service\u0027)"},{"line_number":67,"context_line":"    def test_fetch(self, image_service_mock):"},{"line_number":68,"context_line":"        open_mock \u003d mock.mock_open()"},{"line_number":69,"context_line":"        with mock.patch(\u0027__builtin__.open\u0027, open_mock, create\u003dTrue):"},{"line_number":70,"context_line":"            images.fetch(\u0027context\u0027, \u0027image_href\u0027, \u0027path\u0027)"},{"line_number":71,"context_line":"            open_mock.assert_called_once_with(\u0027path\u0027, \u0027wb\u0027)"},{"line_number":72,"context_line":"            image_service_mock.assert_called_once_with(version\u003d1,"}],"source_content_type":"text/x-python","patch_set":1,"id":"1abeadc6_979792eb","line":69,"in_reply_to":"1abeadc6_976a3f18","updated":"2014-08-29 10:41:10.000000000","message":"Thanks, was trying to do that! Done.","commit_id":"f3569b1c96afaf2cea37a32f4ea2464ba9beef17"},{"author":{"_account_id":9315,"name":"ramesh","email":"rameshg87@gmail.com","username":"rameshg87"},"change_message_id":"267794cf49a633a0e688cd96dec4249297bf40e1","unresolved":false,"context_lines":[{"line_number":73,"context_line":"                                                       context\u003d\u0027context\u0027)"},{"line_number":74,"context_line":"            image_service_mock.return_value.download.assert_called_once_with("},{"line_number":75,"context_line":"                \u0027image_href\u0027, mock.ANY)"},{"line_number":76,"context_line":""},{"line_number":77,"context_line":"    @mock.patch.object(images, \u0027qemu_img_info\u0027)"},{"line_number":78,"context_line":"    def test_image_to_raw_no_file_format(self, qemu_img_info_mock):"},{"line_number":79,"context_line":"        info \u003d self.FakeImgInfo()"}],"source_content_type":"text/x-python","patch_set":1,"id":"1abeadc6_97addf33","line":76,"updated":"2014-08-29 09:14:11.000000000","message":"We can add one more test case for fetch() when image_service is passed to it.  We could pass a mock as argument for image_service, and assert whether download() was called on that mock.","commit_id":"f3569b1c96afaf2cea37a32f4ea2464ba9beef17"},{"author":{"_account_id":12356,"name":"Vladyslav Drok","email":"vdrok@mirantis.com","username":"vdrok"},"change_message_id":"936ee755c3fe89a6beb188743153f6824af81af2","unresolved":false,"context_lines":[{"line_number":73,"context_line":"                                                       context\u003d\u0027context\u0027)"},{"line_number":74,"context_line":"            image_service_mock.return_value.download.assert_called_once_with("},{"line_number":75,"context_line":"                \u0027image_href\u0027, mock.ANY)"},{"line_number":76,"context_line":""},{"line_number":77,"context_line":"    @mock.patch.object(images, \u0027qemu_img_info\u0027)"},{"line_number":78,"context_line":"    def test_image_to_raw_no_file_format(self, qemu_img_info_mock):"},{"line_number":79,"context_line":"        info \u003d self.FakeImgInfo()"}],"source_content_type":"text/x-python","patch_set":1,"id":"1abeadc6_17046248","line":76,"in_reply_to":"1abeadc6_97addf33","updated":"2014-08-29 10:41:10.000000000","message":"Done","commit_id":"f3569b1c96afaf2cea37a32f4ea2464ba9beef17"},{"author":{"_account_id":9315,"name":"ramesh","email":"rameshg87@gmail.com","username":"rameshg87"},"change_message_id":"267794cf49a633a0e688cd96dec4249297bf40e1","unresolved":false,"context_lines":[{"line_number":157,"context_line":"        rename_mock.assert_called_once_with(\u0027path_tmp\u0027, \u0027path\u0027)"},{"line_number":158,"context_line":""},{"line_number":159,"context_line":"    @mock.patch.object(image_service, \u0027Service\u0027)"},{"line_number":160,"context_line":"    def test_download_size(self, image_service_mock):"},{"line_number":161,"context_line":"        images.download_size(\u0027context\u0027, \u0027image_href\u0027)"},{"line_number":162,"context_line":"        image_service_mock.assert_called_once_with(version\u003d1,"},{"line_number":163,"context_line":"                                                   context\u003d\u0027context\u0027)"}],"source_content_type":"text/x-python","patch_set":1,"id":"1abeadc6_23b20894","line":160,"updated":"2014-08-29 09:14:11.000000000","message":"ditto as above.  we can add a test case to check if image_service passed is used, when image_service argument is not None.","commit_id":"f3569b1c96afaf2cea37a32f4ea2464ba9beef17"},{"author":{"_account_id":12356,"name":"Vladyslav Drok","email":"vdrok@mirantis.com","username":"vdrok"},"change_message_id":"936ee755c3fe89a6beb188743153f6824af81af2","unresolved":false,"context_lines":[{"line_number":157,"context_line":"        rename_mock.assert_called_once_with(\u0027path_tmp\u0027, \u0027path\u0027)"},{"line_number":158,"context_line":""},{"line_number":159,"context_line":"    @mock.patch.object(image_service, \u0027Service\u0027)"},{"line_number":160,"context_line":"    def test_download_size(self, image_service_mock):"},{"line_number":161,"context_line":"        images.download_size(\u0027context\u0027, \u0027image_href\u0027)"},{"line_number":162,"context_line":"        image_service_mock.assert_called_once_with(version\u003d1,"},{"line_number":163,"context_line":"                                                   context\u003d\u0027context\u0027)"}],"source_content_type":"text/x-python","patch_set":1,"id":"1abeadc6_37ff9e35","line":160,"in_reply_to":"1abeadc6_23b20894","updated":"2014-08-29 10:41:10.000000000","message":"Done","commit_id":"f3569b1c96afaf2cea37a32f4ea2464ba9beef17"},{"author":{"_account_id":10239,"name":"Dmitry Tantsur","email":"dtantsur@protonmail.com","username":"dtantsur"},"change_message_id":"fcd65b1a4012db5e990e3418f106de673c6192bb","unresolved":false,"context_lines":[{"line_number":16,"context_line":"#    License for the specific language governing permissions and limitations"},{"line_number":17,"context_line":"#    under the License."},{"line_number":18,"context_line":""},{"line_number":19,"context_line":"import __builtin__"},{"line_number":20,"context_line":"import mock"},{"line_number":21,"context_line":"import os"},{"line_number":22,"context_line":"import shutil"}],"source_content_type":"text/x-python","patch_set":3,"id":"fa98f980_67a77f50","line":19,"updated":"2014-09-01 07:15:29.000000000","message":"for the sake of future py3k:\n\n try:\n   import __builtin__\n excapt ImportError:\n   import builtins as __builtin__","commit_id":"c93b62e6348e64ed46f25c4c91fc0c135d4980bc"},{"author":{"_account_id":12356,"name":"Vladyslav Drok","email":"vdrok@mirantis.com","username":"vdrok"},"change_message_id":"117a477687114798242a137bfd4a51fa70f4b149","unresolved":false,"context_lines":[{"line_number":16,"context_line":"#    License for the specific language governing permissions and limitations"},{"line_number":17,"context_line":"#    under the License."},{"line_number":18,"context_line":""},{"line_number":19,"context_line":"import __builtin__"},{"line_number":20,"context_line":"import mock"},{"line_number":21,"context_line":"import os"},{"line_number":22,"context_line":"import shutil"}],"source_content_type":"text/x-python","patch_set":3,"id":"fa98f980_5b69768a","line":19,"in_reply_to":"fa98f980_67a77f50","updated":"2014-09-01 08:48:01.000000000","message":"Thanks for the review Dmitry! Done, but used six.moves instead.","commit_id":"c93b62e6348e64ed46f25c4c91fc0c135d4980bc"}]}
