)]}'
{"tests/unit/test_shell.py":[{"author":{"_account_id":7847,"name":"Alistair Coles","email":"alistairncoles@gmail.com","username":"acoles"},"change_message_id":"59c2beef012f21abc45a269c09b5118ef33a1d9c","unresolved":false,"context_lines":[{"line_number":415,"context_line":"        class CopyingMock(mock.MagicMock):"},{"line_number":416,"context_line":"            # Taken from"},{"line_number":417,"context_line":"            # http://www.voidspace.org.uk/python/mock/examples.html"},{"line_number":418,"context_line":"            # For objects that are called with mutable args"},{"line_number":419,"context_line":"            def __call__(self, *a, **kw):"},{"line_number":420,"context_line":"                args \u003d deepcopy(a)"},{"line_number":421,"context_line":"                kwargs \u003d deepcopy(kw)"}],"source_content_type":"text/x-python","patch_set":2,"id":"baa201ad_ad0a3a25","line":418,"updated":"2014-10-09 16:39:22.000000000","message":"this site is under creative commons BY-SA 2.0 license and i\u0027m not sure if that is compatible with Apache 2.0. This [1] suggests not, but IANAL :) Would be easier to just avoid - could you (a) just mock the SwiftService.upload and (b) assume the options dict is not modified in the test code path (I don\u0027t think it is but I haven\u0027t tried).\n\n[1] http://www.apache.org/legal/resolved.html#cc-sa","commit_id":"f75037fec049878556a9354d940bc783697ff47d"},{"author":{"_account_id":13470,"name":"Daniel Wakefield","email":"dan@danw.eu","username":"danw"},"change_message_id":"d3d9c0704a7a0d2ab049f3ae756ddca64ecc2fc6","unresolved":false,"context_lines":[{"line_number":415,"context_line":"        class CopyingMock(mock.MagicMock):"},{"line_number":416,"context_line":"            # Taken from"},{"line_number":417,"context_line":"            # http://www.voidspace.org.uk/python/mock/examples.html"},{"line_number":418,"context_line":"            # For objects that are called with mutable args"},{"line_number":419,"context_line":"            def __call__(self, *a, **kw):"},{"line_number":420,"context_line":"                args \u003d deepcopy(a)"},{"line_number":421,"context_line":"                kwargs \u003d deepcopy(kw)"}],"source_content_type":"text/x-python","patch_set":2,"id":"baa201ad_bd409608","line":418,"in_reply_to":"baa201ad_ad0a3a25","updated":"2014-10-10 09:35:31.000000000","message":"It seems the site itself is under CC-BY-SA2 but the code is under BSD-3 (http://www.voidspace.org.uk/python/license.shtml). Either way its a hassle to comply with it so i\u0027ll try to find a different way to test it.","commit_id":"f75037fec049878556a9354d940bc783697ff47d"},{"author":{"_account_id":7847,"name":"Alistair Coles","email":"alistairncoles@gmail.com","username":"acoles"},"change_message_id":"59c2beef012f21abc45a269c09b5118ef33a1d9c","unresolved":false,"context_lines":[{"line_number":432,"context_line":"            self.assertEqual(int(actual), expected)"},{"line_number":433,"context_line":""},{"line_number":434,"context_line":"        with mock.patch(\"swiftclient.shell.SwiftService\", mock_swift):"},{"line_number":435,"context_line":"            with mock.patch(\"swiftclient.shell.parse_args\", _mock_parse_args):"},{"line_number":436,"context_line":"                # Test new behaviour with both upper and lower case"},{"line_number":437,"context_line":"                # trailing characters"},{"line_number":438,"context_line":"                argv \u003d [\"\", \"-S\", \"1B\", \"container\", \"object\"]"}],"source_content_type":"text/x-python","patch_set":2,"id":"baa201ad_70566508","line":435,"updated":"2014-10-09 16:39:22.000000000","message":"By mocking this you risk a change in parse_args causing a regression that your tests will not detect e.g. if I could break your change by adding a check in parse_args for segment_size being an int. Can I suggest calling swift.main (like other tests in this class) to test more of the code path?","commit_id":"f75037fec049878556a9354d940bc783697ff47d"},{"author":{"_account_id":13470,"name":"Daniel Wakefield","email":"dan@danw.eu","username":"danw"},"change_message_id":"d3d9c0704a7a0d2ab049f3ae756ddca64ecc2fc6","unresolved":false,"context_lines":[{"line_number":432,"context_line":"            self.assertEqual(int(actual), expected)"},{"line_number":433,"context_line":""},{"line_number":434,"context_line":"        with mock.patch(\"swiftclient.shell.SwiftService\", mock_swift):"},{"line_number":435,"context_line":"            with mock.patch(\"swiftclient.shell.parse_args\", _mock_parse_args):"},{"line_number":436,"context_line":"                # Test new behaviour with both upper and lower case"},{"line_number":437,"context_line":"                # trailing characters"},{"line_number":438,"context_line":"                argv \u003d [\"\", \"-S\", \"1B\", \"container\", \"object\"]"}],"source_content_type":"text/x-python","patch_set":2,"id":"baa201ad_b80ee4e3","line":435,"in_reply_to":"baa201ad_70566508","updated":"2014-10-10 09:35:31.000000000","message":"I did try this way to start but something was causing it to fail, I cant remember what but I\u0027ll try it again.\nIf I cant get that to work I\u0027ll add in a separate test for the code path main -\u003e st_upload.","commit_id":"f75037fec049878556a9354d940bc783697ff47d"},{"author":{"_account_id":7847,"name":"Alistair Coles","email":"alistairncoles@gmail.com","username":"acoles"},"change_message_id":"59c2beef012f21abc45a269c09b5118ef33a1d9c","unresolved":false,"context_lines":[{"line_number":476,"context_line":"                # string"},{"line_number":477,"context_line":"                argv \u003d [\"\", \"-S\", \"K1234\", \"container\", \"object\"]"},{"line_number":478,"context_line":"                parser \u003d OptionParser()"},{"line_number":479,"context_line":"                out \u003d mock.Mock()"},{"line_number":480,"context_line":"                swiftclient.shell.st_upload(parser, argv, out)"},{"line_number":481,"context_line":"                out.error.assert_called_with(\"Invalid segment size\")"},{"line_number":482,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"baa201ad_309a1dc6","line":479,"updated":"2014-10-09 16:39:22.000000000","message":"not sure you need to reset out?","commit_id":"f75037fec049878556a9354d940bc783697ff47d"},{"author":{"_account_id":13470,"name":"Daniel Wakefield","email":"dan@danw.eu","username":"danw"},"change_message_id":"d3d9c0704a7a0d2ab049f3ae756ddca64ecc2fc6","unresolved":false,"context_lines":[{"line_number":476,"context_line":"                # string"},{"line_number":477,"context_line":"                argv \u003d [\"\", \"-S\", \"K1234\", \"container\", \"object\"]"},{"line_number":478,"context_line":"                parser \u003d OptionParser()"},{"line_number":479,"context_line":"                out \u003d mock.Mock()"},{"line_number":480,"context_line":"                swiftclient.shell.st_upload(parser, argv, out)"},{"line_number":481,"context_line":"                out.error.assert_called_with(\"Invalid segment size\")"},{"line_number":482,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"baa201ad_d8f728f4","line":479,"in_reply_to":"baa201ad_309a1dc6","updated":"2014-10-10 09:35:31.000000000","message":"Yes, you\u0027re right i was getting confused between assert_called_with (Only checks the last call) and assert_any_call (Checks every call) and was assuming that the previous test was polluting the mock so that this would always pass.","commit_id":"f75037fec049878556a9354d940bc783697ff47d"},{"author":{"_account_id":7847,"name":"Alistair Coles","email":"alistairncoles@gmail.com","username":"acoles"},"change_message_id":"6a4548505f3df2db6601435ee572476f7ef266a6","unresolved":false,"context_lines":[{"line_number":409,"context_line":"        connection.return_value.get_capabilities.assert_called_with(None)"},{"line_number":410,"context_line":""},{"line_number":411,"context_line":"    def test_human_readable_upload_segment_size(self):"},{"line_number":412,"context_line":"        def _check_expected(x, expected):"},{"line_number":413,"context_line":"            actual \u003d x.call_args_list[-1][1][\"options\"][\"segment_size\"]"},{"line_number":414,"context_line":"            self.assertEqual(int(actual), expected)"},{"line_number":415,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"baa201ad_8e7a1e86","line":412,"updated":"2014-10-16 14:13:15.000000000","message":"nit: you could insert:\n\n  self.assertEqual(1, len(x.call_args_list))\n\nthat way if a regression occurs your tests will Fail rather than Error","commit_id":"5f89dcc46ea0ae126c9ebc328d6569da839336cd"},{"author":{"_account_id":13470,"name":"Daniel Wakefield","email":"dan@danw.eu","username":"danw"},"change_message_id":"72309d7ad7a5597eb4bce77f944d279382f49849","unresolved":false,"context_lines":[{"line_number":409,"context_line":"        connection.return_value.get_capabilities.assert_called_with(None)"},{"line_number":410,"context_line":""},{"line_number":411,"context_line":"    def test_human_readable_upload_segment_size(self):"},{"line_number":412,"context_line":"        def _check_expected(x, expected):"},{"line_number":413,"context_line":"            actual \u003d x.call_args_list[-1][1][\"options\"][\"segment_size\"]"},{"line_number":414,"context_line":"            self.assertEqual(int(actual), expected)"},{"line_number":415,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"baa201ad_fb652345","line":412,"in_reply_to":"baa201ad_8e7a1e86","updated":"2014-10-16 17:21:56.000000000","message":"Since SwiftService is mocked in context around the tests call_args_list grows for each test but it should be easy enough to add a counter or abuse a mutable arg in the function to keep track of how many test have been done / times _check_expected has been called.","commit_id":"5f89dcc46ea0ae126c9ebc328d6569da839336cd"},{"author":{"_account_id":11356,"name":"Louis Taylor","email":"louis@kragniz.eu","username":"kragniz"},"change_message_id":"494000be5fe98d918e02222830e419d28601f2eb","unresolved":false,"context_lines":[{"line_number":411,"context_line":"    def test_human_readable_upload_segment_size(self):"},{"line_number":412,"context_line":"        def _check_expected(x, expected):"},{"line_number":413,"context_line":"            actual \u003d x.call_args_list[-1][1][\"options\"][\"segment_size\"]"},{"line_number":414,"context_line":"            self.assertEqual(int(actual), expected)"},{"line_number":415,"context_line":""},{"line_number":416,"context_line":"        mock_out \u003d mock.MagicMock(spec\u003dswiftclient.shell.OutputManager)"},{"line_number":417,"context_line":"        mock_out.__enter__.return_value \u003d mock_out"}],"source_content_type":"text/x-python","patch_set":3,"id":"baa201ad_34b79c3b","line":414,"updated":"2014-10-17 17:56:32.000000000","message":"nit: the order of arguments to assertEqual should be (expected, actual).","commit_id":"5f89dcc46ea0ae126c9ebc328d6569da839336cd"}]}
