)]}'
{"keystone/common/sql/core.py":[{"author":{"_account_id":5046,"name":"Lance Bragstad","email":"lbragstad@redhat.com","username":"ldbragst"},"change_message_id":"34bc70049cf39f741a5445e2bf1395c3c1e62a93","unresolved":false,"context_lines":[{"line_number":449,"context_line":"                # We want to store the duplicate objects name in the error"},{"line_number":450,"context_line":"                # message for the user. If name is not available we use the id."},{"line_number":451,"context_line":"                for arg in params:"},{"line_number":452,"context_line":"                    if isinstance(arg, dict):"},{"line_number":453,"context_line":"                        if \u0027name\u0027 in arg:"},{"line_number":454,"context_line":"                            field \u003d \u0027name\u0027"},{"line_number":455,"context_line":"                            name \u003d arg[\u0027name\u0027]"}],"source_content_type":"text/x-python","patch_set":1,"id":"ba2be162_c1e85d13","line":452,"updated":"2017-03-01 22:39:00.000000000","message":"Nice, are we able to recreate the issue with a test at all?","commit_id":"79fcecb09e8e61a555161527a1f81436f26df750"},{"author":{"_account_id":11022,"name":"Rodrigo Duarte Sousa","email":"rodrigodsousa@gmail.com","username":"rodrigods"},"change_message_id":"b6a6acacac0af3f94ae16c43ab7ab5ec92babb81","unresolved":false,"context_lines":[{"line_number":449,"context_line":"                # We want to store the duplicate objects name in the error"},{"line_number":450,"context_line":"                # message for the user. If name is not available we use the id."},{"line_number":451,"context_line":"                for arg in params:"},{"line_number":452,"context_line":"                    if isinstance(arg, dict):"},{"line_number":453,"context_line":"                        if \u0027name\u0027 in arg:"},{"line_number":454,"context_line":"                            field \u003d \u0027name\u0027"},{"line_number":455,"context_line":"                            name \u003d arg[\u0027name\u0027]"}],"source_content_type":"text/x-python","patch_set":1,"id":"ba2be162_d2fe4637","line":452,"in_reply_to":"ba2be162_c1e85d13","updated":"2017-03-02 13:43:35.000000000","message":"Think it can be easily reproduced by a test.","commit_id":"79fcecb09e8e61a555161527a1f81436f26df750"}],"keystone/tests/unit/common/test_database_conflicts.py":[{"author":{"_account_id":11022,"name":"Rodrigo Duarte Sousa","email":"rodrigodsousa@gmail.com","username":"rodrigods"},"change_message_id":"7c8c06a262442570cd1acc1ebe628055acf97262","unresolved":false,"context_lines":[{"line_number":139,"context_line":"        self.mapping[\u0027id\u0027] \u003d \u0027mapping_with_id_in_the_id\u0027"},{"line_number":140,"context_line":"        self.federation_api.create_mapping(self.mapping[\u0027id\u0027],"},{"line_number":141,"context_line":"                                           self.mapping)"},{"line_number":142,"context_line":"        try:"},{"line_number":143,"context_line":"            self.federation_api.create_mapping(self.mapping[\u0027id\u0027],"},{"line_number":144,"context_line":"                                               self.mapping)"},{"line_number":145,"context_line":"        except exception.Conflict as e:"},{"line_number":146,"context_line":"            self.assertIn(\"Duplicate entry found with ID %s\""},{"line_number":147,"context_line":"                          % self.mapping[\u0027id\u0027], repr(e))"},{"line_number":148,"context_line":"        # Any other exception will cause the test to fail"},{"line_number":149,"context_line":""},{"line_number":150,"context_line":"    def test_region_duplicate_conflict_gives_name(self):"}],"source_content_type":"text/x-python","patch_set":2,"id":"ba2be162_bfb18849","line":147,"range":{"start_line":142,"start_character":0,"end_line":147,"end_character":56},"updated":"2017-03-02 18:40:08.000000000","message":"is there a reason besides being the pattern in this file for not using assertRaises? (here and in the other tests)","commit_id":"59d7b1fcd710a0eff289f467bbb82a07037a51b0"},{"author":{"_account_id":8482,"name":"Colleen Murphy","email":"colleen@gazlene.net","username":"krinkle"},"change_message_id":"4afd6c87050ad7cb19b356e3e9bdfe6c3bf3236a","unresolved":false,"context_lines":[{"line_number":139,"context_line":"        self.mapping[\u0027id\u0027] \u003d \u0027mapping_with_id_in_the_id\u0027"},{"line_number":140,"context_line":"        self.federation_api.create_mapping(self.mapping[\u0027id\u0027],"},{"line_number":141,"context_line":"                                           self.mapping)"},{"line_number":142,"context_line":"        try:"},{"line_number":143,"context_line":"            self.federation_api.create_mapping(self.mapping[\u0027id\u0027],"},{"line_number":144,"context_line":"                                               self.mapping)"},{"line_number":145,"context_line":"        except exception.Conflict as e:"},{"line_number":146,"context_line":"            self.assertIn(\"Duplicate entry found with ID %s\""},{"line_number":147,"context_line":"                          % self.mapping[\u0027id\u0027], repr(e))"},{"line_number":148,"context_line":"        # Any other exception will cause the test to fail"},{"line_number":149,"context_line":""},{"line_number":150,"context_line":"    def test_region_duplicate_conflict_gives_name(self):"}],"source_content_type":"text/x-python","patch_set":2,"id":"ba2be162_e20b6728","line":147,"range":{"start_line":142,"start_character":0,"end_line":147,"end_character":56},"in_reply_to":"ba2be162_bfb18849","updated":"2017-03-02 19:20:35.000000000","message":"I just copied and pasted from other tests so I have no idea :)","commit_id":"59d7b1fcd710a0eff289f467bbb82a07037a51b0"},{"author":{"_account_id":5046,"name":"Lance Bragstad","email":"lbragstad@redhat.com","username":"ldbragst"},"change_message_id":"6b08d3f9325aafdcc6b13055483c203ae355cc6b","unresolved":false,"context_lines":[{"line_number":144,"context_line":"                                               self.mapping)"},{"line_number":145,"context_line":"        except exception.Conflict as e:"},{"line_number":146,"context_line":"            self.assertIn(\"Duplicate entry found with ID %s\""},{"line_number":147,"context_line":"                          % self.mapping[\u0027id\u0027], repr(e))"},{"line_number":148,"context_line":"        # Any other exception will cause the test to fail"},{"line_number":149,"context_line":""},{"line_number":150,"context_line":"    def test_region_duplicate_conflict_gives_name(self):"}],"source_content_type":"text/x-python","patch_set":2,"id":"ba2be162_29961f3f","line":147,"in_reply_to":"ba2be162_e20b6728","updated":"2017-03-03 15:17:54.000000000","message":"I did some digging on this because I was curious. It turns out that we could accomplish this same thing without the try/except by leveraging the context manager functionality of assertRaises [0]:\n\n\n    def test_domain_duplicate_conflict_gives_name(self):                          \n        domain \u003d unit.new_domain_ref()                                            \n        self.resource_api.create_domain(domain[\u0027id\u0027], domain)                     \n        domain[\u0027id\u0027] \u003d uuid.uuid4().hex                                           \n        with self.assertRaises(exception.Conflict) as context_manager:            \n            self.resource_api.create_domain(domain[\u0027id\u0027], domain)                                                                                                                                                                                                             \n            self.assertIn(                                                        \n                \"%s\" % domain[\u0027name\u0027], repr(context_manager.exception)            \n            )\n\n\nBut we effectively can\u0027t because we are using testtools. The testtools library reimplemented the assertRaises function but didn\u0027t include support for using assertRaises to return a context manager [1]. The above code snippet fails with the following [2].\n\n[0] https://docs.python.org/2/library/unittest.html#unittest.TestCase.assertRaises\n[1] https://github.com/testing-cabal/testtools/blob/a3c7102f42b220cc320fa28c8d5d82967e14931c/testtools/testcase.py#L464-L487\n[2] http://cdn.pasteraw.com/97zgb4zpyeqo436hj0de7fd6lx25zyb","commit_id":"59d7b1fcd710a0eff289f467bbb82a07037a51b0"}]}
