)]}'
{"nova/tests/unit/policies/base.py":[{"author":{"_account_id":782,"name":"John Garbutt","email":"john@johngarbutt.com","username":"johngarbutt"},"change_message_id":"ab6b32e5a076a0dd3e037d4f2a7b136b82afd4d7","unresolved":false,"context_lines":[{"line_number":113,"context_line":"            req.environ[\u0027nova.context\u0027] \u003d context"},{"line_number":114,"context_line":"            args1 \u003d copy.deepcopy(arg)"},{"line_number":115,"context_line":"            kwargs1 \u003d copy.deepcopy(kwarg)"},{"line_number":116,"context_line":"            if not fatal:"},{"line_number":117,"context_line":"                authorized_response.append(ensure_return("},{"line_number":118,"context_line":"                    req, *args1, **kwargs1))"},{"line_number":119,"context_line":"            else:"}],"source_content_type":"text/x-python","patch_set":5,"id":"1fa4df85_1e8d4bd2","line":116,"updated":"2020-03-05 17:12:53.000000000","message":"Maybe here we could pass in expected_authorized_response or something? If it is not None, then do an assert_equal here?","commit_id":"112841848437b2fa737afe9ade3eb285c77192eb"},{"author":{"_account_id":26458,"name":"Brin Zhang","email":"zhangbailin@inspur.com","username":"zhangbailin"},"change_message_id":"a647baaa3b6dfc4fd524e221bf2aa53f9d2dafef","unresolved":false,"context_lines":[{"line_number":113,"context_line":"            req.environ[\u0027nova.context\u0027] \u003d context"},{"line_number":114,"context_line":"            args1 \u003d copy.deepcopy(arg)"},{"line_number":115,"context_line":"            kwargs1 \u003d copy.deepcopy(kwarg)"},{"line_number":116,"context_line":"            if not fatal:"},{"line_number":117,"context_line":"                authorized_response.append(ensure_return("},{"line_number":118,"context_line":"                    req, *args1, **kwargs1))"},{"line_number":119,"context_line":"            else:"}],"source_content_type":"text/x-python","patch_set":5,"id":"1fa4df85_61ce1f2e","line":116,"in_reply_to":"1fa4df85_1e8d4bd2","updated":"2020-03-06 00:55:48.000000000","message":"I don\u0027t have a good idea to assertEqual the func\u0027s response, such [1] that we should format the os-instance-actions show API\u0027s because of the \u0027start_time\u0027 and \u0027finish_time\u0027 are need to conversion their value to display.\n\nsuch as bellow:\nThe acual authorized_response is:\nauthorized_response \u003d {\n    \u0027instanceAction\u0027: {\n        \u0027action\u0027: \u0027reboot\u0027,\n        \u0027instance_uuid\u0027: \u0027b48316c5-71e8-45e4-9884-6c78055b9b13\u0027,\n        \u0027request_id\u0027: \u0027req-3293a3f1-b44c-4609-b8d2-d81b105636b8\u0027,\n        \u0027user_id\u0027: \u0027789\u0027,\n        \u0027project_id\u0027: \u0027147\u0027,\n        \u0027start_time\u0027: datetime.datetime(2012, 12, 5, 0, 0),\n        \u0027message\u0027: \u0027\u0027,\n        \u0027events\u0027: [{\n                \u0027event\u0027: \u0027schedule\u0027,\n                \u0027start_time\u0027: datetime.datetime(2012, 12, 5, 1, 0, 2),\n                \u0027finish_time\u0027: datetime.datetime(2012, 12, 5, 1, 2),\n                \u0027result\u0027: \u0027Success\u0027,\n                \u0027traceback\u0027: \u0027\u0027\n            }, {\n                \u0027event\u0027: \u0027compute_create\u0027,\n                \u0027start_time\u0027: datetime.datetime(2012, 12, 5, 1, 3),\n                \u0027finish_time\u0027: datetime.datetime(2012, 12, 5, 1, 4),\n                \u0027result\u0027: \u0027Success\u0027,\n                \u0027traceback\u0027: \u0027\u0027\n            }\n        ]\n    }\n}\n\nThe expected authorized_response is:\nexpected_authorized_response \u003d {\n    \u0027action\u0027: \u0027reboot\u0027,\n    \u0027instance_uuid\u0027: \u0027b48316c5-71e8-45e4-9884-6c78055b9b13\u0027,\n    \u0027request_id\u0027: \u0027req-3293a3f1-b44c-4609-b8d2-d81b105636b8\u0027,\n    \u0027project_id\u0027: \u0027147\u0027,\n    \u0027user_id\u0027: \u0027789\u0027,\n    \u0027start_time\u0027: \u00272012-12-05 00:00:00\u0027,\n    \u0027message\u0027: \u0027\u0027,\n    \u0027events\u0027: [{\n            \u0027event\u0027: \u0027schedule\u0027,\n            \u0027start_time\u0027: \u00272012-12-05 01:00:02\u0027,\n            \u0027finish_time\u0027: \u00272012-12-05 01:02:00\u0027,\n            \u0027result\u0027: \u0027Success\u0027,\n            \u0027traceback\u0027: \u0027\u0027\n        }, {\n            \u0027event\u0027: \u0027compute_create\u0027,\n            \u0027start_time\u0027: \u00272012-12-05 01:03:00\u0027,\n            \u0027finish_time\u0027: \u00272012-12-05 01:04:00\u0027,\n            \u0027result\u0027: \u0027Success\u0027,\n            \u0027traceback\u0027: \u0027\u0027\n        }\n    ]\n}\n\nObviously, the response of the func cannot be unified here.\n\nFor other API interfaces, I can\u0027t predict whether the return value needs to be processed, so I recommend returning the obtained result directly and then processing it in the corresponding use case.\n\nIf you have a better way, you can update this ^^.","commit_id":"112841848437b2fa737afe9ade3eb285c77192eb"},{"author":{"_account_id":782,"name":"John Garbutt","email":"john@johngarbutt.com","username":"johngarbutt"},"change_message_id":"b9d8a43b0242f92bb39077399f2ae622753445d7","unresolved":false,"context_lines":[{"line_number":113,"context_line":"            req.environ[\u0027nova.context\u0027] \u003d context"},{"line_number":114,"context_line":"            args1 \u003d copy.deepcopy(arg)"},{"line_number":115,"context_line":"            kwargs1 \u003d copy.deepcopy(kwarg)"},{"line_number":116,"context_line":"            if not fatal:"},{"line_number":117,"context_line":"                authorized_response.append(ensure_return("},{"line_number":118,"context_line":"                    req, *args1, **kwargs1))"},{"line_number":119,"context_line":"            else:"}],"source_content_type":"text/x-python","patch_set":5,"id":"1fa4df85_040bb423","line":116,"in_reply_to":"1fa4df85_61ce1f2e","updated":"2020-03-06 10:10:55.000000000","message":"Yeah, fair enough.","commit_id":"112841848437b2fa737afe9ade3eb285c77192eb"},{"author":{"_account_id":782,"name":"John Garbutt","email":"john@johngarbutt.com","username":"johngarbutt"},"change_message_id":"ab6b32e5a076a0dd3e037d4f2a7b136b82afd4d7","unresolved":false,"context_lines":[{"line_number":130,"context_line":"                ensure_raises(req, *args1, **kwargs1)"},{"line_number":131,"context_line":"            else:"},{"line_number":132,"context_line":"                unauthorize_response.append("},{"line_number":133,"context_line":"                    ensure_return(req, *args1, **kwargs1))"},{"line_number":134,"context_line":""},{"line_number":135,"context_line":"        return authorized_response, unauthorize_response"}],"source_content_type":"text/x-python","patch_set":5,"id":"1fa4df85_7eb55f7d","line":133,"updated":"2020-03-05 17:12:53.000000000","message":"Could we instead do an assert_equal here, as pass in the expected value?","commit_id":"112841848437b2fa737afe9ade3eb285c77192eb"},{"author":{"_account_id":26458,"name":"Brin Zhang","email":"zhangbailin@inspur.com","username":"zhangbailin"},"change_message_id":"a647baaa3b6dfc4fd524e221bf2aa53f9d2dafef","unresolved":false,"context_lines":[{"line_number":130,"context_line":"                ensure_raises(req, *args1, **kwargs1)"},{"line_number":131,"context_line":"            else:"},{"line_number":132,"context_line":"                unauthorize_response.append("},{"line_number":133,"context_line":"                    ensure_return(req, *args1, **kwargs1))"},{"line_number":134,"context_line":""},{"line_number":135,"context_line":"        return authorized_response, unauthorize_response"}],"source_content_type":"text/x-python","patch_set":5,"id":"1fa4df85_8148fb86","line":133,"in_reply_to":"1fa4df85_7eb55f7d","updated":"2020-03-06 00:55:48.000000000","message":"ditto.","commit_id":"112841848437b2fa737afe9ade3eb285c77192eb"},{"author":{"_account_id":782,"name":"John Garbutt","email":"john@johngarbutt.com","username":"johngarbutt"},"change_message_id":"53f24cca15b0904767d24faf709e354a1b2dda8d","unresolved":false,"context_lines":[{"line_number":119,"context_line":"            args1 \u003d copy.deepcopy(arg)"},{"line_number":120,"context_line":"            kwargs1 \u003d copy.deepcopy(kwarg)"},{"line_number":121,"context_line":"            if not fatal:"},{"line_number":122,"context_line":"                authorized_response.append("},{"line_number":123,"context_line":"                    ensure_return(req, *args1, **kwargs1))"},{"line_number":124,"context_line":"            else:"},{"line_number":125,"context_line":"                func(req, *args1, **kwargs1)"}],"source_content_type":"text/x-python","patch_set":6,"id":"1fa4df85_c4391cd7","line":122,"updated":"2020-03-06 10:11:38.000000000","message":"Nit: its tempting to always return the response, given there is one.","commit_id":"2f11a5a0a95dbcbda56455db76ebab93e2f68cd4"}],"nova/tests/unit/policies/test_instance_actions.py":[{"author":{"_account_id":26458,"name":"Brin Zhang","email":"zhangbailin@inspur.com","username":"zhangbailin"},"change_message_id":"91672b76c85dcd2e6f142c806eb4139a3e285e1b","unresolved":false,"context_lines":[{"line_number":16,"context_line":"from oslo_policy import policy as oslo_policy"},{"line_number":17,"context_line":""},{"line_number":18,"context_line":"from nova.api.openstack.compute import instance_actions as instance_actions_v21"},{"line_number":19,"context_line":"from nova import context"},{"line_number":20,"context_line":"from nova import policy"},{"line_number":21,"context_line":"from nova.tests.unit.api.openstack import fakes"},{"line_number":22,"context_line":"from nova.tests.unit import fake_instance"}],"source_content_type":"text/x-python","patch_set":1,"id":"3fa7e38b_47042919","line":19,"range":{"start_line":19,"start_character":0,"end_line":19,"end_character":24},"updated":"2020-02-14 08:03:18.000000000","message":"unused.","commit_id":"56d3cdf97182a7faef4fc18a6b2d904e69f8608c"},{"author":{"_account_id":15334,"name":"Stephen Finucane","display_name":"stephenfin","email":"stephenfin@redhat.com","username":"sfinucan"},"change_message_id":"73fe5a9f57156f1ad8b8fe58aa7a6ffdc67c8452","unresolved":false,"context_lines":[{"line_number":128,"context_line":"        action \u003d self.fake_actions[FAKE_UUID][FAKE_REQUEST_ID]"},{"line_number":129,"context_line":"        mock_action_api.return_value \u003d action"},{"line_number":130,"context_line":"        # rule_name \u003d \"os_compute_api:os-instance-actions:events\""},{"line_number":131,"context_line":"        # TODO(): Because of fatal\u003dFalse, so the events check policy"},{"line_number":132,"context_line":"        # cannot raise exception, how to check?"},{"line_number":133,"context_line":"        # self.common_policy_check(self.reader_authorized_contexts,"},{"line_number":134,"context_line":"        #                          self.reader_unauthorized_contexts,"},{"line_number":135,"context_line":"        #                          rule_name, self.controller.show,"}],"source_content_type":"text/x-python","patch_set":2,"id":"3fa7e38b_d2139c01","line":132,"range":{"start_line":131,"start_character":0,"end_line":132,"end_character":47},"updated":"2020-02-20 11:42:57.000000000","message":"Any decisions on how to resolve this?","commit_id":"60fb73e4cc04d554af912b1ef22660584d493c3e"},{"author":{"_account_id":782,"name":"John Garbutt","email":"john@johngarbutt.com","username":"johngarbutt"},"change_message_id":"d690e0afa8f34ef4701e6bc2c6acbb8577f5e777","unresolved":false,"context_lines":[{"line_number":128,"context_line":"        action \u003d self.fake_actions[FAKE_UUID][FAKE_REQUEST_ID]"},{"line_number":129,"context_line":"        mock_action_api.return_value \u003d action"},{"line_number":130,"context_line":"        # rule_name \u003d \"os_compute_api:os-instance-actions:events\""},{"line_number":131,"context_line":"        # TODO(): Because of fatal\u003dFalse, so the events check policy"},{"line_number":132,"context_line":"        # cannot raise exception, how to check?"},{"line_number":133,"context_line":"        # self.common_policy_check(self.reader_authorized_contexts,"},{"line_number":134,"context_line":"        #                          self.reader_unauthorized_contexts,"},{"line_number":135,"context_line":"        #                          rule_name, self.controller.show,"}],"source_content_type":"text/x-python","patch_set":2,"id":"1fa4df85_bbb249e5","line":132,"range":{"start_line":131,"start_character":0,"end_line":132,"end_character":47},"in_reply_to":"1fa4df85_2c8645dd","updated":"2020-03-02 15:09:25.000000000","message":"I don\u0027t think your change helps here...\n\nWhat we need is a custom unit tests, and it simply is setup such that when the policy fails, you get empty list, and policy passes you get some results?","commit_id":"60fb73e4cc04d554af912b1ef22660584d493c3e"},{"author":{"_account_id":26458,"name":"Brin Zhang","email":"zhangbailin@inspur.com","username":"zhangbailin"},"change_message_id":"75c131dba9c9aec6a3a15b57d45253b9e6c4b22a","unresolved":false,"context_lines":[{"line_number":128,"context_line":"        action \u003d self.fake_actions[FAKE_UUID][FAKE_REQUEST_ID]"},{"line_number":129,"context_line":"        mock_action_api.return_value \u003d action"},{"line_number":130,"context_line":"        # rule_name \u003d \"os_compute_api:os-instance-actions:events\""},{"line_number":131,"context_line":"        # TODO(): Because of fatal\u003dFalse, so the events check policy"},{"line_number":132,"context_line":"        # cannot raise exception, how to check?"},{"line_number":133,"context_line":"        # self.common_policy_check(self.reader_authorized_contexts,"},{"line_number":134,"context_line":"        #                          self.reader_unauthorized_contexts,"},{"line_number":135,"context_line":"        #                          rule_name, self.controller.show,"}],"source_content_type":"text/x-python","patch_set":2,"id":"3fa7e38b_f27338e4","line":132,"range":{"start_line":131,"start_character":0,"end_line":132,"end_character":47},"in_reply_to":"3fa7e38b_d2139c01","updated":"2020-02-20 12:26:08.000000000","message":"I would like to get gmann\u0027s suggestion of this, although I have been researching deeply.","commit_id":"60fb73e4cc04d554af912b1ef22660584d493c3e"},{"author":{"_account_id":26458,"name":"Brin Zhang","email":"zhangbailin@inspur.com","username":"zhangbailin"},"change_message_id":"fd47fd151f5260db59657990ef57f542f221831c","unresolved":false,"context_lines":[{"line_number":128,"context_line":"        action \u003d self.fake_actions[FAKE_UUID][FAKE_REQUEST_ID]"},{"line_number":129,"context_line":"        mock_action_api.return_value \u003d action"},{"line_number":130,"context_line":"        # rule_name \u003d \"os_compute_api:os-instance-actions:events\""},{"line_number":131,"context_line":"        # TODO(): Because of fatal\u003dFalse, so the events check policy"},{"line_number":132,"context_line":"        # cannot raise exception, how to check?"},{"line_number":133,"context_line":"        # self.common_policy_check(self.reader_authorized_contexts,"},{"line_number":134,"context_line":"        #                          self.reader_unauthorized_contexts,"},{"line_number":135,"context_line":"        #                          rule_name, self.controller.show,"}],"source_content_type":"text/x-python","patch_set":2,"id":"1fa4df85_2c8645dd","line":132,"range":{"start_line":131,"start_character":0,"end_line":132,"end_character":47},"in_reply_to":"3fa7e38b_f27338e4","updated":"2020-02-28 07:47:45.000000000","message":"I open a bug to remove fatal\u003dFalse, and I will push the fix patch.\nhttps://bugs.launchpad.net/nova/+bug/1865117","commit_id":"60fb73e4cc04d554af912b1ef22660584d493c3e"}]}
