)]}'
{"nova/api/openstack/compute/contrib/keypairs.py":[{"author":{"_account_id":5441,"name":"Andrew Laski","email":"andrew@lascii.com","username":"alaski"},"change_message_id":"440e16c8a17275580fea77f9dc7bd84e2036c29b","unresolved":false,"context_lines":[{"line_number":175,"context_line":"    @wsgi.extends"},{"line_number":176,"context_line":"    def show(self, req, resp_obj, id):"},{"line_number":177,"context_line":"        context \u003d req.environ[\u0027nova.context\u0027]"},{"line_number":178,"context_line":"        if soft_authorize(context, action\u003d\u0027show\u0027):"},{"line_number":179,"context_line":"            self._show(req, resp_obj)"},{"line_number":180,"context_line":""},{"line_number":181,"context_line":"    @wsgi.extends"}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAAPn%2F%2Fnv8%3D","line":178,"updated":"2013-06-26 15:37:23.000000000","message":"I\u0027m not sure it makes sense to have actions for the server response portion.  It makes sense to me that if you have access to the extension that the server listing would include keypairs.  Or at the very least if you have \u0027show\u0027 access you would get both show and detail of the server listing.","commit_id":"905f4487cfb74f07168170487b0443626829dbc3"}],"nova/tests/api/openstack/compute/contrib/test_keypairs.py":[{"author":{"_account_id":5441,"name":"Andrew Laski","email":"andrew@lascii.com","username":"alaski"},"change_message_id":"9f9200812ebf57a8ee546f66189ff2914c67992a","unresolved":false,"context_lines":[{"line_number":58,"context_line":"    def setUp(self):"},{"line_number":59,"context_line":"        super(KeypairsTest, self).setUp()"},{"line_number":60,"context_line":"        self.Controller \u003d keypairs.Controller()"},{"line_number":61,"context_line":"        self.KeyPairController \u003d keypairs.KeypairController()"},{"line_number":62,"context_line":"        fakes.stub_out_networking(self.stubs)"},{"line_number":63,"context_line":"        fakes.stub_out_rate_limiting(self.stubs)"},{"line_number":64,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAPn%2F%2Fk%2BE%3D","line":61,"updated":"2013-06-27 13:40:51.000000000","message":"Is this used anywhere?","commit_id":"54008634d280a142d62574ad2ab668d397adb8a8"},{"author":{"_account_id":5441,"name":"Andrew Laski","email":"andrew@lascii.com","username":"alaski"},"change_message_id":"38934fad85df08d0d64bcb311f9a37ee5c9104fd","unresolved":false,"context_lines":[{"line_number":354,"context_line":"        self.KeyPairController \u003d keypairs.KeypairController()"},{"line_number":355,"context_line":""},{"line_number":356,"context_line":"    def test_keypair_list_restricted_by_project(self):"},{"line_number":357,"context_line":"        rules \u003d policy.Rules({\u0027compute_extension:keypais:index\u0027:"},{"line_number":358,"context_line":"                             policy.parse_rule(\u0027role:admin\u0027)})"},{"line_number":359,"context_line":"        policy.set_rules(rules)"},{"line_number":360,"context_line":""}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAAPn%2F%2FdeY%3D","line":357,"updated":"2013-07-01 14:08:40.000000000","message":"You used keypais rather than keypairs throughout the file.  While I understand, and mostly agree with, your argument for not having positive tests I keep bringing them up because you\u0027re not testing what you think you\u0027re testing here.  This raises exception.NotAuthorized because there\u0027s no policy set for keypairs, not because the admin policy check fails.","commit_id":"261b995bf929e33730488c30d8d4a6eb66fe4f23"},{"author":{"_account_id":782,"name":"John Garbutt","email":"john@johngarbutt.com","username":"johngarbutt"},"change_message_id":"8699c4d1ad4f9d88f0386decac043a08994b9e0e","unresolved":false,"context_lines":[{"line_number":356,"context_line":"    def test_keypair_list_restricted_by_project(self):"},{"line_number":357,"context_line":"        rules \u003d policy.Rules({\u0027compute_extension:keypais:index\u0027:"},{"line_number":358,"context_line":"                             policy.parse_rule(\u0027role:admin\u0027)})"},{"line_number":359,"context_line":"        policy.set_rules(rules)"},{"line_number":360,"context_line":""},{"line_number":361,"context_line":"        req \u003d fakes.HTTPRequest.blank(\u0027/v2/fake/os-keypairs\u0027)"},{"line_number":362,"context_line":"        self.assertRaises(exception.NotAuthorized,"}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAAPn%2F%2FaBo%3D","line":359,"updated":"2013-07-02 16:02:58.000000000","message":"Maybe just use the rules from the fake_policy here, and add this into a setUp method?","commit_id":"261b995bf929e33730488c30d8d4a6eb66fe4f23"},{"author":{"_account_id":782,"name":"John Garbutt","email":"john@johngarbutt.com","username":"johngarbutt"},"change_message_id":"5ea33f9d573b252e5b040c736b8080ef81326bcf","unresolved":false,"context_lines":[{"line_number":353,"context_line":"        super(KeypairPolicyTest, self).setUp()"},{"line_number":354,"context_line":"        self.KeyPairController \u003d keypairs.KeypairController()"},{"line_number":355,"context_line":""},{"line_number":356,"context_line":"        def _db_key_pair_get(context, user_id, name):"},{"line_number":357,"context_line":"            return {\u0027name\u0027: \u0027foo\u0027, \u0027public_key\u0027: \u0027XXX\u0027, \u0027fingerprint\u0027: \u0027YYY\u0027}"},{"line_number":358,"context_line":""},{"line_number":359,"context_line":"        self.stubs.Set(db, \"key_pair_get\","}],"source_content_type":"text/x-python","patch_set":6,"id":"AAAAPn%2F%2FXY0%3D","line":356,"updated":"2013-07-03 08:37:35.000000000","message":"Is this similar to this?\nhttps://github.com/openstack/nova/blob/master/nova/tests/api/openstack/fakes.py#L127","commit_id":"6464bebedad3d1bea8eb389b11484f277ebe41ce"},{"author":{"_account_id":5441,"name":"Andrew Laski","email":"andrew@lascii.com","username":"alaski"},"change_message_id":"dbb332d2b54af2603e5327f38503f5de3e26e6f0","unresolved":false,"context_lines":[{"line_number":353,"context_line":"        super(KeypairPolicyTest, self).setUp()"},{"line_number":354,"context_line":"        self.KeyPairController \u003d keypairs.KeypairController()"},{"line_number":355,"context_line":""},{"line_number":356,"context_line":"        def _db_key_pair_get(context, user_id, name):"},{"line_number":357,"context_line":"            return {\u0027name\u0027: \u0027foo\u0027, \u0027public_key\u0027: \u0027XXX\u0027, \u0027fingerprint\u0027: \u0027YYY\u0027}"},{"line_number":358,"context_line":""},{"line_number":359,"context_line":"        self.stubs.Set(db, \"key_pair_get\","}],"source_content_type":"text/x-python","patch_set":6,"id":"AAAAP3%2F%2F53E%3D","line":356,"in_reply_to":"AAAAPn%2F%2FXY0%3D","updated":"2013-07-09 13:59:31.000000000","message":"It would be nice to use the already existing stubs.","commit_id":"6464bebedad3d1bea8eb389b11484f277ebe41ce"},{"author":{"_account_id":782,"name":"John Garbutt","email":"john@johngarbutt.com","username":"johngarbutt"},"change_message_id":"5ea33f9d573b252e5b040c736b8080ef81326bcf","unresolved":false,"context_lines":[{"line_number":366,"context_line":"                       db_key_pair_destroy)"},{"line_number":367,"context_line":""},{"line_number":368,"context_line":"    def test_keypair_list_fail_policy(self):"},{"line_number":369,"context_line":"        rules \u003d policy.Rules({\u0027compute_extension:keypairs:index\u0027:"},{"line_number":370,"context_line":"                             policy.parse_rule(\u0027role:admin\u0027)})"},{"line_number":371,"context_line":"        policy.set_rules(rules)"},{"line_number":372,"context_line":"        req \u003d fakes.HTTPRequest.blank(\u0027/v2/fake/os-keypairs\u0027)"}],"source_content_type":"text/x-python","patch_set":6,"id":"AAAAPn%2F%2FXYg%3D","line":369,"updated":"2013-07-03 08:37:35.000000000","message":"I would change the fake_policy so you don\u0027t need this here, and just use an admin context vs non admin context?\n\nSee how the fake policy is applied to all tests:\nhttps://github.com/openstack/nova/blob/master/nova/test.py#L250\n\nSee how to choose between admin and non-admin requests so you can pass and fail appropriately:\nhttps://github.com/openstack/nova/blob/master/nova/tests/api/openstack/fakes.py#L330","commit_id":"6464bebedad3d1bea8eb389b11484f277ebe41ce"},{"author":{"_account_id":782,"name":"John Garbutt","email":"john@johngarbutt.com","username":"johngarbutt"},"change_message_id":"4760c775a3cc423397ccc49355c59432e701d59e","unresolved":false,"context_lines":[{"line_number":366,"context_line":"                       db_key_pair_destroy)"},{"line_number":367,"context_line":""},{"line_number":368,"context_line":"    def test_keypair_list_fail_policy(self):"},{"line_number":369,"context_line":"        rules \u003d policy.Rules({\u0027compute_extension:keypairs:index\u0027:"},{"line_number":370,"context_line":"                             policy.parse_rule(\u0027role:admin\u0027)})"},{"line_number":371,"context_line":"        policy.set_rules(rules)"},{"line_number":372,"context_line":"        req \u003d fakes.HTTPRequest.blank(\u0027/v2/fake/os-keypairs\u0027)"}],"source_content_type":"text/x-python","patch_set":6,"id":"AAAAP3%2F%2F55c%3D","line":369,"in_reply_to":"AAAAPn%2F%2FXYg%3D","updated":"2013-07-09 13:46:24.000000000","message":"Aarti wants to keep this explicit for readability, which is reasonable I guess.","commit_id":"6464bebedad3d1bea8eb389b11484f277ebe41ce"}],"nova/tests/api/openstack/compute/plugins/v3/test_keypairs.py":[{"author":{"_account_id":5441,"name":"Andrew Laski","email":"andrew@lascii.com","username":"alaski"},"change_message_id":"9f9200812ebf57a8ee546f66189ff2914c67992a","unresolved":false,"context_lines":[{"line_number":355,"context_line":"        self.KeyPairController \u003d keypairs.KeypairController()"},{"line_number":356,"context_line":""},{"line_number":357,"context_line":"    def test_keypair_list_restricted_by_project(self):"},{"line_number":358,"context_line":"        rules \u003d policy.Rules({\u0027compute_extension:keypairs:index\u0027:"},{"line_number":359,"context_line":"                             policy.parse_rule(\u0027project_id:%(project_id)s\u0027)})"},{"line_number":360,"context_line":"        policy.set_rules(rules)"},{"line_number":361,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAPn%2F%2Fk9Y%3D","line":358,"updated":"2013-06-27 13:40:51.000000000","message":"This is the wrong policy name to set here, it should be \u0027compute_extension:v3:keypairs:index\u0027.  Which means you should add positive tests to show a value request, not just ones that fail.","commit_id":"54008634d280a142d62574ad2ab668d397adb8a8"},{"author":{"_account_id":5441,"name":"Andrew Laski","email":"andrew@lascii.com","username":"alaski"},"change_message_id":"9f9200812ebf57a8ee546f66189ff2914c67992a","unresolved":false,"context_lines":[{"line_number":356,"context_line":""},{"line_number":357,"context_line":"    def test_keypair_list_restricted_by_project(self):"},{"line_number":358,"context_line":"        rules \u003d policy.Rules({\u0027compute_extension:keypairs:index\u0027:"},{"line_number":359,"context_line":"                             policy.parse_rule(\u0027project_id:%(project_id)s\u0027)})"},{"line_number":360,"context_line":"        policy.set_rules(rules)"},{"line_number":361,"context_line":""},{"line_number":362,"context_line":"        req \u003d fakes.HTTPRequestV3.blank(\u0027/v3/os-keypairs\u0027)"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAPn%2F%2Fk9I%3D","line":359,"updated":"2013-06-27 13:40:51.000000000","message":"project_id is not a good rule to use here.  The extension only checks role policies, project_id isn\u0027t checked until the compute/api layer.","commit_id":"54008634d280a142d62574ad2ab668d397adb8a8"}],"nova/tests/fake_policy.py":[{"author":{"_account_id":782,"name":"John Garbutt","email":"john@johngarbutt.com","username":"johngarbutt"},"change_message_id":"8699c4d1ad4f9d88f0386decac043a08994b9e0e","unresolved":false,"context_lines":[{"line_number":161,"context_line":"    \"compute_extension:instance_actions:events\": \"is_admin:True\","},{"line_number":162,"context_line":"    \"compute_extension:instance_usage_audit_log\": \"\","},{"line_number":163,"context_line":"    \"compute_extension:keypairs\": \"\","},{"line_number":164,"context_line":"    \"compute_extension:keypairs:index\": \"\","},{"line_number":165,"context_line":"    \"compute_extension:keypairs:show\": \"\","},{"line_number":166,"context_line":"    \"compute_extension:keypairs:create\": \"\","},{"line_number":167,"context_line":"    \"compute_extension:keypairs:delete\": \"\","}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAAPn%2F%2FaFw%3D","line":164,"updated":"2013-07-02 16:02:58.000000000","message":"adding is_admin:True, might make things simpler to test?","commit_id":"261b995bf929e33730488c30d8d4a6eb66fe4f23"},{"author":{"_account_id":782,"name":"John Garbutt","email":"john@johngarbutt.com","username":"johngarbutt"},"change_message_id":"5ea33f9d573b252e5b040c736b8080ef81326bcf","unresolved":false,"context_lines":[{"line_number":161,"context_line":"    \"compute_extension:instance_actions:events\": \"is_admin:True\","},{"line_number":162,"context_line":"    \"compute_extension:instance_usage_audit_log\": \"\","},{"line_number":163,"context_line":"    \"compute_extension:keypairs\": \"\","},{"line_number":164,"context_line":"    \"compute_extension:keypairs:index\": \"\","},{"line_number":165,"context_line":"    \"compute_extension:keypairs:show\": \"\","},{"line_number":166,"context_line":"    \"compute_extension:keypairs:create\": \"\","},{"line_number":167,"context_line":"    \"compute_extension:keypairs:delete\": \"\","}],"source_content_type":"text/x-python","patch_set":6,"id":"AAAAPn%2F%2FXZE%3D","line":164,"updated":"2013-07-03 08:37:35.000000000","message":"if you update this to is_admin:True, you can save a lot of your test code","commit_id":"6464bebedad3d1bea8eb389b11484f277ebe41ce"},{"author":{"_account_id":782,"name":"John Garbutt","email":"john@johngarbutt.com","username":"johngarbutt"},"change_message_id":"4760c775a3cc423397ccc49355c59432e701d59e","unresolved":false,"context_lines":[{"line_number":161,"context_line":"    \"compute_extension:instance_actions:events\": \"is_admin:True\","},{"line_number":162,"context_line":"    \"compute_extension:instance_usage_audit_log\": \"\","},{"line_number":163,"context_line":"    \"compute_extension:keypairs\": \"\","},{"line_number":164,"context_line":"    \"compute_extension:keypairs:index\": \"\","},{"line_number":165,"context_line":"    \"compute_extension:keypairs:show\": \"\","},{"line_number":166,"context_line":"    \"compute_extension:keypairs:create\": \"\","},{"line_number":167,"context_line":"    \"compute_extension:keypairs:delete\": \"\","}],"source_content_type":"text/x-python","patch_set":6,"id":"AAAAP3%2F%2F55Y%3D","line":164,"in_reply_to":"AAAAPn%2F%2FXZE%3D","updated":"2013-07-09 13:46:24.000000000","message":"Aarti, wasn\u0027t to leave this as it is, for readability.","commit_id":"6464bebedad3d1bea8eb389b11484f277ebe41ce"}]}
