)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":8482,"name":"Colleen Murphy","email":"colleen@gazlene.net","username":"krinkle"},"change_message_id":"6d11e80d8e8f52058aba87cfee2da1e115fcf31f","unresolved":false,"context_lines":[{"line_number":6,"context_line":""},{"line_number":7,"context_line":"Expose a bug when create trust with roles"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"The test here should pass with 403 Forbidden because"},{"line_number":10,"context_line":"that there is no valid roles in the request body."},{"line_number":11,"context_line":"But Keystone raise 500 error because that it doesn\u0027t"},{"line_number":12,"context_line":"check the roles key."}],"source_content_type":"text/x-gerrit-commit-message","patch_set":2,"id":"ff82abbf_a28afa66","line":9,"range":{"start_line":9,"start_character":31,"end_line":9,"end_character":44},"updated":"2017-11-27 10:48:36.000000000","message":"It\u0027s actually a 400 Bad Request","commit_id":"4c4d21cedfde1451ee876da965bc833838a7a531"}],"keystone/tests/unit/test_v3_trust.py":[{"author":{"_account_id":5046,"name":"Lance Bragstad","email":"lbragstad@redhat.com","username":"ldbragst"},"change_message_id":"a539e99bd732d0b552345be4f6bf6b594ca9e24f","unresolved":false,"context_lines":[{"line_number":297,"context_line":"        self.post(\u0027/OS-TRUST/trusts\u0027, body\u003d{\u0027trust\u0027: ref},"},{"line_number":298,"context_line":"                  expected_status\u003dhttp_client.NOT_FOUND)"},{"line_number":299,"context_line":""},{"line_number":300,"context_line":"    @test_utils.wip(\u0027Waiting on validation to be added from fixing bug1734244\u0027)"},{"line_number":301,"context_line":"    def test_create_trust_with_non_existant_role_id_or_name_returns_forbidden("},{"line_number":302,"context_line":"            self):"},{"line_number":303,"context_line":"        ref \u003d unit.new_trust_ref(trustor_user_id\u003dself.user_id,"}],"source_content_type":"text/x-python","patch_set":1,"id":"ff82abbf_6033a0f7","line":300,"updated":"2017-11-24 19:53:43.000000000","message":"nit: bug 1734244 \n\nbut since this is likely going to be removed in the next patch, I\u0027m not too concerned.","commit_id":"e4a8066851c16cabade06a6974bcdc0b27df1848"},{"author":{"_account_id":15054,"name":"wangxiyuan","email":"wangxiyuan1007@gmail.com","username":"wangxiyuan"},"change_message_id":"a8e81d3caba68ea49945e87a89f45b552add38ef","unresolved":false,"context_lines":[{"line_number":297,"context_line":"        self.post(\u0027/OS-TRUST/trusts\u0027, body\u003d{\u0027trust\u0027: ref},"},{"line_number":298,"context_line":"                  expected_status\u003dhttp_client.NOT_FOUND)"},{"line_number":299,"context_line":""},{"line_number":300,"context_line":"    @test_utils.wip(\u0027Waiting on validation to be added from fixing bug1734244\u0027)"},{"line_number":301,"context_line":"    def test_create_trust_with_non_existant_role_id_or_name_returns_forbidden("},{"line_number":302,"context_line":"            self):"},{"line_number":303,"context_line":"        ref \u003d unit.new_trust_ref(trustor_user_id\u003dself.user_id,"}],"source_content_type":"text/x-python","patch_set":1,"id":"ff82abbf_76527fe0","line":300,"in_reply_to":"ff82abbf_6033a0f7","updated":"2017-11-27 06:42:33.000000000","message":"Done","commit_id":"e4a8066851c16cabade06a6974bcdc0b27df1848"},{"author":{"_account_id":5046,"name":"Lance Bragstad","email":"lbragstad@redhat.com","username":"ldbragst"},"change_message_id":"a539e99bd732d0b552345be4f6bf6b594ca9e24f","unresolved":false,"context_lines":[{"line_number":298,"context_line":"                  expected_status\u003dhttp_client.NOT_FOUND)"},{"line_number":299,"context_line":""},{"line_number":300,"context_line":"    @test_utils.wip(\u0027Waiting on validation to be added from fixing bug1734244\u0027)"},{"line_number":301,"context_line":"    def test_create_trust_with_non_existant_role_id_or_name_returns_forbidden("},{"line_number":302,"context_line":"            self):"},{"line_number":303,"context_line":"        ref \u003d unit.new_trust_ref(trustor_user_id\u003dself.user_id,"},{"line_number":304,"context_line":"                                 trustee_user_id\u003dself.trustee_user_id,"}],"source_content_type":"text/x-python","patch_set":1,"id":"ff82abbf_803024ea","line":301,"range":{"start_line":301,"start_character":31,"end_line":301,"end_character":59},"updated":"2017-11-24 19:53:43.000000000","message":"nit: s/non_existant_role_id_or_name/invalid_key/\n\n  def test_create_trust_with_invalid_key_returns_forbidden\n\nor\n\n  def test_create_trust_with_invalid_key_returns_bad_request","commit_id":"e4a8066851c16cabade06a6974bcdc0b27df1848"},{"author":{"_account_id":15054,"name":"wangxiyuan","email":"wangxiyuan1007@gmail.com","username":"wangxiyuan"},"change_message_id":"a8e81d3caba68ea49945e87a89f45b552add38ef","unresolved":false,"context_lines":[{"line_number":298,"context_line":"                  expected_status\u003dhttp_client.NOT_FOUND)"},{"line_number":299,"context_line":""},{"line_number":300,"context_line":"    @test_utils.wip(\u0027Waiting on validation to be added from fixing bug1734244\u0027)"},{"line_number":301,"context_line":"    def test_create_trust_with_non_existant_role_id_or_name_returns_forbidden("},{"line_number":302,"context_line":"            self):"},{"line_number":303,"context_line":"        ref \u003d unit.new_trust_ref(trustor_user_id\u003dself.user_id,"},{"line_number":304,"context_line":"                                 trustee_user_id\u003dself.trustee_user_id,"}],"source_content_type":"text/x-python","patch_set":1,"id":"ff82abbf_b6756766","line":301,"range":{"start_line":301,"start_character":31,"end_line":301,"end_character":59},"in_reply_to":"ff82abbf_803024ea","updated":"2017-11-27 06:42:33.000000000","message":"Done","commit_id":"e4a8066851c16cabade06a6974bcdc0b27df1848"},{"author":{"_account_id":5046,"name":"Lance Bragstad","email":"lbragstad@redhat.com","username":"ldbragst"},"change_message_id":"a539e99bd732d0b552345be4f6bf6b594ca9e24f","unresolved":false,"context_lines":[{"line_number":307,"context_line":"        # Keystone should return 403 Forbidden, because there is project but no"},{"line_number":308,"context_line":"        # valid role in the request body."},{"line_number":309,"context_line":"        self.post(\u0027/OS-TRUST/trusts\u0027, body\u003d{\u0027trust\u0027: ref},"},{"line_number":310,"context_line":"                  expected_status\u003dhttp_client.FORBIDDEN)"},{"line_number":311,"context_line":""},{"line_number":312,"context_line":"    def test_create_trust_with_non_existant_role_name_returns_not_found(self):"},{"line_number":313,"context_line":"        ref \u003d unit.new_trust_ref("}],"source_content_type":"text/x-python","patch_set":1,"id":"ff82abbf_c03f0cb2","line":310,"range":{"start_line":310,"start_character":18,"end_line":310,"end_character":55},"updated":"2017-11-24 19:53:43.000000000","message":"Another acceptable return value might be 400 Bad Request, since it\u0027s a validation thing.\n\nI guess the following is how I think about it.\n\n  ref \u003d {\n      trustor_user_id: $TRUSTOR_USER_ID,\n      trustee_user_id: $TRUSTEE_USER_ID,\n      project_id: $PROJECT_ID,\n      roles: $MY_ROLE,\n      random: \u0027garbage\u0027\n  }\n\nShould return a 400 Bad Request because `random` isn\u0027t an attribute we accept to for trusts. Today this should return a 500.\n\n  ref \u003d {\n      trustor_user_id: $TRUSTOR_USER_ID,\n      trustee_user_id: $TRUSTEE_USER_ID,\n      project_id: $PROJECT_ID,\n      random: \u0027garbage\u0027\n  }\n\nShould return a 403 since `roles` are a required attribute of the request but they aren\u0027t included. Which should be the same outcome as:\n\n  ref \u003d {\n      trustor_user_id: $TRUSTOR_USER_ID,\n      trustee_user_id: $TRUSTEE_USER_ID,\n      project_id: $PROJECT_ID,\n  }\n\nWe could showcase this with a couple different test cases, one of which will likely be wip\u0027d.\n\n  def test_create_trust_with_extra_attributes_fails(self):\n      ref \u003d unit.new_trust_ref(trustor_user_id\u003dself.user_id,\n                               trustee_user_id\u003dself.trustee_user_id,\n                               project_id\u003dself.project_id,\n                               roles\u003dself.role_id)\n      ref.update({\u0027roles\u0027: {\u0027fake_key\u0027: \u0027fake_value\u0027}})\n\n      # Should return 400 Bad Request because `fake_key` is an extra\n      # attribute that keystone doesn\u0027t associate with trusts\n      self.post(\u0027/OS-TRUST/trusts\u0027, body\u003d{\u0027trust\u0027: ref},\n                expected_status\u003dhttp_client.BAD_REQUEST)\n\n  def test_create_trust_with_missing_attributes_and_extra_attributes_fails(self):\n      ref \u003d unit.new_trust_ref(trustor_user_id\u003dself.user_id,\n                               trustee_user_id\u003dself.trustee_user_id,\n                               project_id\u003dself.project_id)\n      ref.update({\u0027roles\u0027: {\u0027fake_key\u0027: \u0027fake_value\u0027}})\n\n      # Should return 403 Forbidden because `roles` is a required\n      # attribute\n      self.post(\u0027/OS-TRUST/trusts\u0027, body\u003d{\u0027trust\u0027: ref},\n                expected_status\u003dhttp_client.BAD_REQUEST)\n\n\nI would argue that both cases should return a 400 but apparently that\u0027s not the case the current trust API:\n\n  \u0027{\"error\": {\"title\": \"Forbidden\", \"message\": \"You are not authorized to perform the requested action: At least one valid role should be specified.\", \"code\": 403}}\u0027","commit_id":"e4a8066851c16cabade06a6974bcdc0b27df1848"},{"author":{"_account_id":15054,"name":"wangxiyuan","email":"wangxiyuan1007@gmail.com","username":"wangxiyuan"},"change_message_id":"a8e81d3caba68ea49945e87a89f45b552add38ef","unresolved":false,"context_lines":[{"line_number":307,"context_line":"        # Keystone should return 403 Forbidden, because there is project but no"},{"line_number":308,"context_line":"        # valid role in the request body."},{"line_number":309,"context_line":"        self.post(\u0027/OS-TRUST/trusts\u0027, body\u003d{\u0027trust\u0027: ref},"},{"line_number":310,"context_line":"                  expected_status\u003dhttp_client.FORBIDDEN)"},{"line_number":311,"context_line":""},{"line_number":312,"context_line":"    def test_create_trust_with_non_existant_role_name_returns_not_found(self):"},{"line_number":313,"context_line":"        ref \u003d unit.new_trust_ref("}],"source_content_type":"text/x-python","patch_set":1,"id":"ff82abbf_8cfdb2b2","line":310,"range":{"start_line":310,"start_character":18,"end_line":310,"end_character":55},"in_reply_to":"ff82abbf_c03f0cb2","updated":"2017-11-27 06:42:33.000000000","message":"Thought again. I think we should raise 400 if a invalid key is sent.\nPlease review the new PS. Thanks.","commit_id":"e4a8066851c16cabade06a6974bcdc0b27df1848"}]}
