)]}'
{"nova/tests/unit/api/openstack/compute/test_shelve.py":[{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"20c5f9f230d8350a393a41c12a732a8728ea6c28","unresolved":false,"context_lines":[{"line_number":37,"context_line":"        self.controller \u003d self.plugin.ShelveController()"},{"line_number":38,"context_line":"        self.req \u003d fakes.HTTPRequest.blank(\u0027\u0027)"},{"line_number":39,"context_line":""},{"line_number":40,"context_line":"    @mock.patch(\u0027nova.objects.Service.get_minimum_version\u0027)"},{"line_number":41,"context_line":"    @mock.patch(\u0027nova.objects.instance.Instance.get_by_uuid\u0027)"},{"line_number":42,"context_line":"    def test_shelve_locked_server(self, mock_instance_get, mock_min):"},{"line_number":43,"context_line":"        mock_min.return_value \u003d 1"}],"source_content_type":"text/x-python","patch_set":1,"id":"5a8bc5a2_9f25735d","line":40,"updated":"2016-09-26 20:05:30.000000000","message":"I\u0027m not really sure what is hitting this in these tests, I don\u0027t see anything directly calling this from the REST API code.\n\nRather than copy this for all tests, it might just be easier to use the AllServicesCurrent fixture in the setUp.","commit_id":"d8fc1d7e270a1cef81356c9a243940c9454e3fe4"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"c900c1f1625943cc4e3716a419699c98d804c2fe","unresolved":false,"context_lines":[{"line_number":37,"context_line":"        self.controller \u003d self.plugin.ShelveController()"},{"line_number":38,"context_line":"        self.req \u003d fakes.HTTPRequest.blank(\u0027\u0027)"},{"line_number":39,"context_line":""},{"line_number":40,"context_line":"    @mock.patch(\u0027nova.objects.Service.get_minimum_version\u0027)"},{"line_number":41,"context_line":"    @mock.patch(\u0027nova.objects.instance.Instance.get_by_uuid\u0027)"},{"line_number":42,"context_line":"    def test_shelve_locked_server(self, mock_instance_get, mock_min):"},{"line_number":43,"context_line":"        mock_min.return_value \u003d 1"}],"source_content_type":"text/x-python","patch_set":1,"id":"5a8bc5a2_dab2a94b","line":40,"in_reply_to":"5a8bc5a2_9f25735d","updated":"2016-09-26 20:21:20.000000000","message":"As we talked about in IRC, the reason we have to mock out get_minimum_version is because we\u0027re getting to _get_instance in the compute API:\n\nhttps://review.openstack.org/#/c/263927/67/nova/compute/api.py@2127\n\nThat\u0027s really too low level for this REST API test. So I think the real fix is changing the mock on nova.objects.instance.Instance.get_by_uuid to something high level, like nova.api.openstack.common.get_instance.","commit_id":"d8fc1d7e270a1cef81356c9a243940c9454e3fe4"},{"author":{"_account_id":16907,"name":"Diana Clarke","email":"diana.joan.clarke@gmail.com","username":"diana-clarke"},"change_message_id":"ccf0d07ef221c40776bb76b3071b00878c724dbb","unresolved":false,"context_lines":[{"line_number":37,"context_line":"        self.controller \u003d self.plugin.ShelveController()"},{"line_number":38,"context_line":"        self.req \u003d fakes.HTTPRequest.blank(\u0027\u0027)"},{"line_number":39,"context_line":""},{"line_number":40,"context_line":"    @mock.patch(\u0027nova.objects.Service.get_minimum_version\u0027)"},{"line_number":41,"context_line":"    @mock.patch(\u0027nova.objects.instance.Instance.get_by_uuid\u0027)"},{"line_number":42,"context_line":"    def test_shelve_locked_server(self, mock_instance_get, mock_min):"},{"line_number":43,"context_line":"        mock_min.return_value \u003d 1"}],"source_content_type":"text/x-python","patch_set":1,"id":"5a8bc5a2_93fba678","line":40,"in_reply_to":"5a8bc5a2_dab2a94b","updated":"2016-09-27 01:29:43.000000000","message":"Good call, thanks! I copied the following pattern from the tests below.\n\n    @mock.patch(\u0027nova.api.openstack.common.get_instance\u0027)\n    def test_foo(self, get_instance_mock):\n        get_instance_mock.return_value \u003d (\n            fake_instance.fake_instance_obj(self.req.environ[\u0027nova.context\u0027]))","commit_id":"d8fc1d7e270a1cef81356c9a243940c9454e3fe4"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"539ae875c1e9cf7a0fe7add818e7ba6454baf4c1","unresolved":false,"context_lines":[{"line_number":39,"context_line":""},{"line_number":40,"context_line":"    @mock.patch(\u0027nova.objects.instance.Instance.get_by_uuid\u0027)"},{"line_number":41,"context_line":"    def test_shelve_locked_server(self, mock_instance_get):"},{"line_number":42,"context_line":"        instance \u003d objects.Instance("},{"line_number":43,"context_line":"            uuid\u003duuidsentinel.instance1,"},{"line_number":44,"context_line":"            project_id\u003dself.req.environ[\u0027nova.context\u0027].project_id,"},{"line_number":45,"context_line":"            user_id\u003dself.req.environ[\u0027nova.context\u0027].user_id)"},{"line_number":46,"context_line":"        mock_instance_get.return_value \u003d instance"},{"line_number":47,"context_line":"        self.stubs.Set(compute_api.API, \u0027shelve\u0027,"},{"line_number":48,"context_line":"                       fakes.fake_actions_to_locked_server)"}],"source_content_type":"text/x-python","patch_set":2,"id":"5a8bc5a2_b7df8fd4","side":"PARENT","line":45,"range":{"start_line":42,"start_character":19,"end_line":45,"end_character":61},"updated":"2016-09-27 13:30:53.000000000","message":"FWIW I think leaving this would have been fine. Using fake_instance actually changes the behavior of the test since we probably have different user/project IDs:\n\nhttps://github.com/openstack/nova/blob/1aa494107e9fff990faf37ee848e71e0ba133f11/nova/tests/unit/fake_instance.py#L62\n\nGiven this test was named \"Policy\" I figured that would cause an issue, but I guess these tests are less about policy and more about trying to perform shelve/unshelve actions on a locked server (we should probably rename the test class at some point).\n\nAlso, probably didn\u0027t need to even rename the mock formal argument, it would have made for a smaller change. But this is OK.","commit_id":"c983a6a2bc26154f0219290b1cb2824200a24855"},{"author":{"_account_id":16907,"name":"Diana Clarke","email":"diana.joan.clarke@gmail.com","username":"diana-clarke"},"change_message_id":"19982681ce2a88e7c74d17b4044a9daa4bdc1e2e","unresolved":false,"context_lines":[{"line_number":39,"context_line":""},{"line_number":40,"context_line":"    @mock.patch(\u0027nova.objects.instance.Instance.get_by_uuid\u0027)"},{"line_number":41,"context_line":"    def test_shelve_locked_server(self, mock_instance_get):"},{"line_number":42,"context_line":"        instance \u003d objects.Instance("},{"line_number":43,"context_line":"            uuid\u003duuidsentinel.instance1,"},{"line_number":44,"context_line":"            project_id\u003dself.req.environ[\u0027nova.context\u0027].project_id,"},{"line_number":45,"context_line":"            user_id\u003dself.req.environ[\u0027nova.context\u0027].user_id)"},{"line_number":46,"context_line":"        mock_instance_get.return_value \u003d instance"},{"line_number":47,"context_line":"        self.stubs.Set(compute_api.API, \u0027shelve\u0027,"},{"line_number":48,"context_line":"                       fakes.fake_actions_to_locked_server)"}],"source_content_type":"text/x-python","patch_set":2,"id":"5a8bc5a2_d7eeda20","side":"PARENT","line":45,"range":{"start_line":42,"start_character":19,"end_line":45,"end_character":61},"in_reply_to":"5a8bc5a2_b7df8fd4","updated":"2016-09-27 13:50:36.000000000","message":"Re \u0027mock_instance_get\u0027 vs \u0027get_instance_mock\u0027: I just made them match the tests below it, so that they are consistent across the module (those other tests are where this code was copied from).\n\nRe: removing the explicit instance values, I thought more was less here; especially now that it isn\u0027t explicitly needed because fake_instance_obj sets values that pass the context.can() check in _shelve(). I hope that makes sense. They were need before when a bare instance object was used.","commit_id":"c983a6a2bc26154f0219290b1cb2824200a24855"}]}
