)]}'
{"keystone/tests/unit/test_v3_trust.py":[{"author":{"_account_id":11022,"name":"Rodrigo Duarte Sousa","email":"rodrigodsousa@gmail.com","username":"rodrigods"},"change_message_id":"918a4a468eda8e43c20b7584bec6003a5f4f80fb","unresolved":false,"context_lines":[{"line_number":450,"context_line":"    def test_trust_deleted_when_user_deleted(self):"},{"line_number":451,"context_line":"        # create trust"},{"line_number":452,"context_line":"        ref \u003d unit.new_trust_ref("},{"line_number":453,"context_line":"            trustor_user_id\u003dself.user_id,"},{"line_number":454,"context_line":"            trustee_user_id\u003dself.trustee_user_id,"},{"line_number":455,"context_line":"            project_id\u003dself.project_id,"},{"line_number":456,"context_line":"            impersonation\u003dFalse,"}],"source_content_type":"text/x-python","patch_set":2,"id":"7a8ec9b2_f1d6b54d","line":453,"range":{"start_line":453,"start_character":28,"end_line":453,"end_character":40},"updated":"2016-09-16 16:17:21.000000000","message":"create another user to be the trustor (one that is only used in this test)","commit_id":"c04e35c107e08f61d194a056b5c762cbd5d50af5"},{"author":{"_account_id":13063,"name":"WEI CHEN","email":"dave.jungler@gmail.com","username":"wei.d.chen"},"change_message_id":"90878d6a7b02945240c639a3bf1916c13ed2df43","unresolved":false,"context_lines":[{"line_number":450,"context_line":"    def test_trust_deleted_when_user_deleted(self):"},{"line_number":451,"context_line":"        # create trust"},{"line_number":452,"context_line":"        ref \u003d unit.new_trust_ref("},{"line_number":453,"context_line":"            trustor_user_id\u003dself.user_id,"},{"line_number":454,"context_line":"            trustee_user_id\u003dself.trustee_user_id,"},{"line_number":455,"context_line":"            project_id\u003dself.project_id,"},{"line_number":456,"context_line":"            impersonation\u003dFalse,"}],"source_content_type":"text/x-python","patch_set":2,"id":"7a8ec9b2_71ba3ec2","line":453,"range":{"start_line":453,"start_character":28,"end_line":453,"end_character":40},"in_reply_to":"7a8ec9b2_5ef1f594","updated":"2016-09-20 01:49:21.000000000","message":"Not quite follow you, do you mean the following call make it inconsistent?\n    self.trust_api.get_trust(...)\n\nwe didn\u0027t mock anything in this testcase and I think there is no need to mock anything in this testcase in the future.\n\npls take a look at these lines:\nhttps://github.com/openstack/keystone/blob/master/keystone/tests/unit/test_v3.py#L430-L431\n\nIt is using self.user to get the scoped token for authentication, and the policy requires the trustor must be self.user. We cannot change to another user or else the trust won\u0027t be created sucessfully. This is all the reason about it.","commit_id":"c04e35c107e08f61d194a056b5c762cbd5d50af5"},{"author":{"_account_id":11022,"name":"Rodrigo Duarte Sousa","email":"rodrigodsousa@gmail.com","username":"rodrigods"},"change_message_id":"f54f01c9b2abea5f9c910a35974a7ade9ec472bc","unresolved":false,"context_lines":[{"line_number":450,"context_line":"    def test_trust_deleted_when_user_deleted(self):"},{"line_number":451,"context_line":"        # create trust"},{"line_number":452,"context_line":"        ref \u003d unit.new_trust_ref("},{"line_number":453,"context_line":"            trustor_user_id\u003dself.user_id,"},{"line_number":454,"context_line":"            trustee_user_id\u003dself.trustee_user_id,"},{"line_number":455,"context_line":"            project_id\u003dself.project_id,"},{"line_number":456,"context_line":"            impersonation\u003dFalse,"}],"source_content_type":"text/x-python","patch_set":2,"id":"7a8ec9b2_c6489d8a","line":453,"range":{"start_line":453,"start_character":28,"end_line":453,"end_character":40},"in_reply_to":"7a8ec9b2_71ba3ec2","updated":"2016-09-20 10:54:38.000000000","message":"calling \"self.trust_api.get_trust(...)\" doesn\u0027t guarantee the exception raised is thrown in the controller layer. The mock example was just o illustrate one of the issues that might arise if calling the backend directly.\n\nNow I see that creating a new user and getting a token might be more hassle than a I initially thought. This is not good for our tests :(","commit_id":"c04e35c107e08f61d194a056b5c762cbd5d50af5"},{"author":{"_account_id":13063,"name":"WEI CHEN","email":"dave.jungler@gmail.com","username":"wei.d.chen"},"change_message_id":"2812817383c49047a5da3946c3d66810753f3c5a","unresolved":false,"context_lines":[{"line_number":450,"context_line":"    def test_trust_deleted_when_user_deleted(self):"},{"line_number":451,"context_line":"        # create trust"},{"line_number":452,"context_line":"        ref \u003d unit.new_trust_ref("},{"line_number":453,"context_line":"            trustor_user_id\u003dself.user_id,"},{"line_number":454,"context_line":"            trustee_user_id\u003dself.trustee_user_id,"},{"line_number":455,"context_line":"            project_id\u003dself.project_id,"},{"line_number":456,"context_line":"            impersonation\u003dFalse,"}],"source_content_type":"text/x-python","patch_set":2,"id":"7a8ec9b2_9a16574a","line":453,"range":{"start_line":453,"start_character":28,"end_line":453,"end_character":40},"in_reply_to":"7a8ec9b2_9728f09b","updated":"2016-09-17 05:50:35.000000000","message":"http request below use self.user_id to authenticate, and policy that is defined make the trustor user id must be the self.user_id. The change here won\u0027t impact other testcases I think.","commit_id":"c04e35c107e08f61d194a056b5c762cbd5d50af5"},{"author":{"_account_id":11022,"name":"Rodrigo Duarte Sousa","email":"rodrigodsousa@gmail.com","username":"rodrigods"},"change_message_id":"99a185b29d8f3139d6453a0b42b964abf40ff2e3","unresolved":false,"context_lines":[{"line_number":450,"context_line":"    def test_trust_deleted_when_user_deleted(self):"},{"line_number":451,"context_line":"        # create trust"},{"line_number":452,"context_line":"        ref \u003d unit.new_trust_ref("},{"line_number":453,"context_line":"            trustor_user_id\u003dself.user_id,"},{"line_number":454,"context_line":"            trustee_user_id\u003dself.trustee_user_id,"},{"line_number":455,"context_line":"            project_id\u003dself.project_id,"},{"line_number":456,"context_line":"            impersonation\u003dFalse,"}],"source_content_type":"text/x-python","patch_set":2,"id":"7a8ec9b2_5ef1f594","line":453,"range":{"start_line":453,"start_character":28,"end_line":453,"end_character":40},"in_reply_to":"7a8ec9b2_9a16574a","updated":"2016-09-19 12:38:30.000000000","message":"the authentication should be just one call, think that keeping consistency in the layer being called is more important. Imagine that in the future, we could mock the result returned by the manager in the controller tests.","commit_id":"c04e35c107e08f61d194a056b5c762cbd5d50af5"},{"author":{"_account_id":13063,"name":"WEI CHEN","email":"dave.jungler@gmail.com","username":"wei.d.chen"},"change_message_id":"6e49b76a79d19b8e5b6b77fedbb8336f585b589a","unresolved":false,"context_lines":[{"line_number":450,"context_line":"    def test_trust_deleted_when_user_deleted(self):"},{"line_number":451,"context_line":"        # create trust"},{"line_number":452,"context_line":"        ref \u003d unit.new_trust_ref("},{"line_number":453,"context_line":"            trustor_user_id\u003dself.user_id,"},{"line_number":454,"context_line":"            trustee_user_id\u003dself.trustee_user_id,"},{"line_number":455,"context_line":"            project_id\u003dself.project_id,"},{"line_number":456,"context_line":"            impersonation\u003dFalse,"}],"source_content_type":"text/x-python","patch_set":2,"id":"7a8ec9b2_9728f09b","line":453,"range":{"start_line":453,"start_character":28,"end_line":453,"end_character":40},"in_reply_to":"7a8ec9b2_f1d6b54d","updated":"2016-09-17 05:44:44.000000000","message":"seems there is no easy way to change the trustor as the policy has defined as this.\n\n    \"identity:create_trust\": \"user_id:%(trust.trustor_user_id)s\",\n\n\nIf using another user, the http request below must change the user to authenticate which makes the testcase unnecessary complicated.","commit_id":"c04e35c107e08f61d194a056b5c762cbd5d50af5"},{"author":{"_account_id":11022,"name":"Rodrigo Duarte Sousa","email":"rodrigodsousa@gmail.com","username":"rodrigods"},"change_message_id":"918a4a468eda8e43c20b7584bec6003a5f4f80fb","unresolved":false,"context_lines":[{"line_number":488,"context_line":"        self.delete("},{"line_number":489,"context_line":"            \u0027/users/%(user_id)s\u0027 % {\u0027user_id\u0027: trust[\u0027trustor_user_id\u0027]})"},{"line_number":490,"context_line":""},{"line_number":491,"context_line":"        # call the backend method directly to bypass authentication since the"},{"line_number":492,"context_line":"        # user has been deleted."},{"line_number":493,"context_line":"        self.assertRaises(exception.TrustNotFound,"},{"line_number":494,"context_line":"                          self.trust_api.get_trust,"},{"line_number":495,"context_line":"                          trust[\u0027id\u0027])"}],"source_content_type":"text/x-python","patch_set":2,"id":"7a8ec9b2_31f65df9","line":492,"range":{"start_line":491,"start_character":8,"end_line":492,"end_character":31},"updated":"2016-09-16 16:17:21.000000000","message":"you should be able to call using another user.","commit_id":"c04e35c107e08f61d194a056b5c762cbd5d50af5"},{"author":{"_account_id":13063,"name":"WEI CHEN","email":"dave.jungler@gmail.com","username":"wei.d.chen"},"change_message_id":"6e49b76a79d19b8e5b6b77fedbb8336f585b589a","unresolved":false,"context_lines":[{"line_number":488,"context_line":"        self.delete("},{"line_number":489,"context_line":"            \u0027/users/%(user_id)s\u0027 % {\u0027user_id\u0027: trust[\u0027trustor_user_id\u0027]})"},{"line_number":490,"context_line":""},{"line_number":491,"context_line":"        # call the backend method directly to bypass authentication since the"},{"line_number":492,"context_line":"        # user has been deleted."},{"line_number":493,"context_line":"        self.assertRaises(exception.TrustNotFound,"},{"line_number":494,"context_line":"                          self.trust_api.get_trust,"},{"line_number":495,"context_line":"                          trust[\u0027id\u0027])"}],"source_content_type":"text/x-python","patch_set":2,"id":"7a8ec9b2_970f1036","line":492,"range":{"start_line":491,"start_character":8,"end_line":492,"end_character":31},"in_reply_to":"7a8ec9b2_31f65df9","updated":"2016-09-17 05:44:44.000000000","message":"due to the reason above, have to do it like this.","commit_id":"c04e35c107e08f61d194a056b5c762cbd5d50af5"}],"keystone/trust/backends/sql.py":[{"author":{"_account_id":6482,"name":"Steve Martinelli","email":"s.martinelli@gmail.com","username":"stevemar"},"change_message_id":"b104fed243345370893a4c28e9402407c506b568","unresolved":false,"context_lines":[{"line_number":183,"context_line":"                raise exception.TrustNotFound(trust_id\u003dtrust_id)"},{"line_number":184,"context_line":"            trust_ref.deleted_at \u003d timeutils.utcnow()"},{"line_number":185,"context_line":""},{"line_number":186,"context_line":"    def delete_trust_by_user_id(self, user_id):"},{"line_number":187,"context_line":"        with sql.session_for_write() as session:"},{"line_number":188,"context_line":"            query \u003d session.query(TrustModel)"},{"line_number":189,"context_line":"            trusts \u003d query.filter(or_(TrustModel.trustor_user_id \u003d\u003d user_id,"}],"source_content_type":"text/x-python","patch_set":4,"id":"fa6399be_e84d5f73","line":186,"range":{"start_line":186,"start_character":8,"end_line":186,"end_character":31},"updated":"2016-10-12 04:26:20.000000000","message":"rather than create a new method, can\u0027t we just call\n\n  trusts \u003d list_trusts_for_trustee(user_id)\n  trusts \u003d trusts + list_trusts_for_trustor(user_id)\n  for trust in trusts:\n    delete_trust(trust)","commit_id":"7a6ac8aed8597e1d074a090982092437350e83d8"},{"author":{"_account_id":13063,"name":"WEI CHEN","email":"dave.jungler@gmail.com","username":"wei.d.chen"},"change_message_id":"51bb553742489359e07fe4a70536b10631625cdd","unresolved":false,"context_lines":[{"line_number":183,"context_line":"                raise exception.TrustNotFound(trust_id\u003dtrust_id)"},{"line_number":184,"context_line":"            trust_ref.deleted_at \u003d timeutils.utcnow()"},{"line_number":185,"context_line":""},{"line_number":186,"context_line":"    def delete_trust_by_user_id(self, user_id):"},{"line_number":187,"context_line":"        with sql.session_for_write() as session:"},{"line_number":188,"context_line":"            query \u003d session.query(TrustModel)"},{"line_number":189,"context_line":"            trusts \u003d query.filter(or_(TrustModel.trustor_user_id \u003d\u003d user_id,"}],"source_content_type":"text/x-python","patch_set":4,"id":"fa6399be_56f7ccf4","line":186,"range":{"start_line":186,"start_character":8,"end_line":186,"end_character":31},"in_reply_to":"fa6399be_e84d5f73","updated":"2016-10-12 06:01:12.000000000","message":"I like this approach!","commit_id":"7a6ac8aed8597e1d074a090982092437350e83d8"}],"keystone/trust/controllers.py":[{"author":{"_account_id":5046,"name":"Lance Bragstad","email":"lbragstad@redhat.com","username":"ldbragst"},"change_message_id":"3fb7ae2ce1a771568fed23fe099cea4828ee1fdf","unresolved":false,"context_lines":[{"line_number":42,"context_line":""},{"line_number":43,"context_line":"    def __init__(self):"},{"line_number":44,"context_line":"        super(TrustV3, self).__init__()"},{"line_number":45,"context_line":"        notifications.register_event_callback("},{"line_number":46,"context_line":"            notifications.ACTIONS.deleted, \u0027user\u0027,"},{"line_number":47,"context_line":"            self._on_user_delete)"},{"line_number":48,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"3a98d1f4_673ac7e8","line":45,"updated":"2016-10-03 16:59:24.000000000","message":"Aren\u0027t notification callbacks typically registered in the Manager layer?\n\nhttps://github.com/openstack/keystone/blob/cd23e776b7631d2f7b9465ef29789fd354f7d66a/keystone/token/provider.py#L152  for example.\n\nI think the controller layer should only handle web things and this seems like keystone logic.","commit_id":"bcfac0110c0c7de8843ed22081a3d1f78c1a88c9"},{"author":{"_account_id":13063,"name":"WEI CHEN","email":"dave.jungler@gmail.com","username":"wei.d.chen"},"change_message_id":"fe3e36aea37145e8f8d16775eb864dcf49eb5eb2","unresolved":false,"context_lines":[{"line_number":42,"context_line":""},{"line_number":43,"context_line":"    def __init__(self):"},{"line_number":44,"context_line":"        super(TrustV3, self).__init__()"},{"line_number":45,"context_line":"        notifications.register_event_callback("},{"line_number":46,"context_line":"            notifications.ACTIONS.deleted, \u0027user\u0027,"},{"line_number":47,"context_line":"            self._on_user_delete)"},{"line_number":48,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"1a95cdbc_2f06ec1f","line":45,"in_reply_to":"3a98d1f4_673ac7e8","updated":"2016-10-09 02:40:36.000000000","message":"@lance, Good call! I think you show us another inconsistencies keystone has. `endpoint_policy` and `catalog` register the call back in the controller layer while others in manager layer.\n\nhttps://github.com/openstack/keystone/blob/master/keystone/catalog/controllers.py#L400-L405\n\nI agree with your point, will update soon!","commit_id":"bcfac0110c0c7de8843ed22081a3d1f78c1a88c9"}],"keystone/trust/core.py":[{"author":{"_account_id":6482,"name":"Steve Martinelli","email":"s.martinelli@gmail.com","username":"stevemar"},"change_message_id":"b104fed243345370893a4c28e9402407c506b568","unresolved":false,"context_lines":[{"line_number":51,"context_line":""},{"line_number":52,"context_line":"    def _on_user_delete(self, service, resource_type, operation,"},{"line_number":53,"context_line":"                        payload):"},{"line_number":54,"context_line":"        # NOTE(davechen): Only delete the user that is maintained by"},{"line_number":55,"context_line":"        # keystone will delete the related trust, since we don\u0027t know"},{"line_number":56,"context_line":"        # when a LDAP user or federation user is deleted."},{"line_number":57,"context_line":"        user_id \u003d payload[\u0027resource_info\u0027]"},{"line_number":58,"context_line":"        self.delete_trust_by_user_id(user_id)"},{"line_number":59,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"fa6399be_c8197b7b","line":56,"range":{"start_line":54,"start_character":0,"end_line":56,"end_character":57},"updated":"2016-10-12 04:26:20.000000000","message":"great comment","commit_id":"7a6ac8aed8597e1d074a090982092437350e83d8"},{"author":{"_account_id":6482,"name":"Steve Martinelli","email":"s.martinelli@gmail.com","username":"stevemar"},"change_message_id":"b104fed243345370893a4c28e9402407c506b568","unresolved":false,"context_lines":[{"line_number":55,"context_line":"        # keystone will delete the related trust, since we don\u0027t know"},{"line_number":56,"context_line":"        # when a LDAP user or federation user is deleted."},{"line_number":57,"context_line":"        user_id \u003d payload[\u0027resource_info\u0027]"},{"line_number":58,"context_line":"        self.delete_trust_by_user_id(user_id)"},{"line_number":59,"context_line":""},{"line_number":60,"context_line":"    @staticmethod"},{"line_number":61,"context_line":"    def _validate_redelegation(redelegated_trust, trust):"}],"source_content_type":"text/x-python","patch_set":4,"id":"fa6399be_6814ef43","line":58,"range":{"start_line":58,"start_character":8,"end_line":58,"end_character":36},"updated":"2016-10-12 04:26:20.000000000","message":"shouldn\u0027t this call the driver?\n\n  self.driver.delete_trust_by_user_id","commit_id":"7a6ac8aed8597e1d074a090982092437350e83d8"}]}
