)]}'
{"nova/api/openstack/compute/legacy_v2/contrib/flavormanage.py":[{"author":{"_account_id":8866,"name":"Raildo Mascena de Sousa Filho","email":"rmascena@redhat.com","username":"raildo"},"change_message_id":"3eea1e6f6eb50673d3720bd267b75e533f114111","unresolved":false,"context_lines":[{"line_number":37,"context_line":"        authorize(context)"},{"line_number":38,"context_line":""},{"line_number":39,"context_line":"        flavor \u003d objects.Flavor(context\u003dcontext, flavorid\u003did)"},{"line_number":40,"context_line":"        try:"},{"line_number":41,"context_line":"            flavor.destroy()"},{"line_number":42,"context_line":"        except exception.FlavorNotFound as e:"},{"line_number":43,"context_line":"            raise webob.exc.HTTPNotFound(explanation\u003de.format_message())"}],"source_content_type":"text/x-python","patch_set":1,"id":"ba8a016a_ac97d1ea","line":40,"updated":"2015-11-18 16:44:24.000000000","message":"sometimes yo\u0027ure using flavor_id and sometimes you\u0027re using flavorid, Can you choose one way, if it\u0027s possible?","commit_id":"7c970202b25bc875257671b8d6495cd3fc8535fb"}],"nova/objects/flavor.py":[{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"e7b054758eaa6a392357fab37e6738efe2e010f0","unresolved":false,"context_lines":[{"line_number":168,"context_line":""},{"line_number":169,"context_line":""},{"line_number":170,"context_line":"@db_api.api_context_manager.writer"},{"line_number":171,"context_line":"def _flavor_destroy(context, id\u003dNone, flavorid\u003dNone):"},{"line_number":172,"context_line":"    query \u003d context.session.query(api_models.Flavors)"},{"line_number":173,"context_line":""},{"line_number":174,"context_line":"    if id is not None:"}],"source_content_type":"text/x-python","patch_set":9,"id":"9a061dce_7e54b353","line":171,"range":{"start_line":171,"start_character":29,"end_line":171,"end_character":36},"updated":"2016-04-04 14:55:43.000000000","message":"Can you not rename this argument to id? Using id just eclipses the id builtin, which is why I chose something else.\n\nI\u0027m okay with flavor_id\u003d\u003did and flavorid\u003d\u003dflavorid, but if you\u0027re worried about the confusion, you could use id_ for the former.","commit_id":"d8e8472edf6564e0f85cc3fe101e7266fafbf188"},{"author":{"_account_id":6450,"name":"Hans Lindgren","email":"hanlind@kth.se","username":"hanlind"},"change_message_id":"48f08be255f1c0f2bcfa345560c2a4d73b2a7491","unresolved":false,"context_lines":[{"line_number":168,"context_line":""},{"line_number":169,"context_line":""},{"line_number":170,"context_line":"@db_api.api_context_manager.writer"},{"line_number":171,"context_line":"def _flavor_destroy(context, id\u003dNone, flavorid\u003dNone):"},{"line_number":172,"context_line":"    query \u003d context.session.query(api_models.Flavors)"},{"line_number":173,"context_line":""},{"line_number":174,"context_line":"    if id is not None:"}],"source_content_type":"text/x-python","patch_set":9,"id":"9a061dce_f9b6133c","line":171,"range":{"start_line":171,"start_character":29,"end_line":171,"end_character":36},"in_reply_to":"9a061dce_7e54b353","updated":"2016-04-04 17:40:30.000000000","message":"Done","commit_id":"d8e8472edf6564e0f85cc3fe101e7266fafbf188"}],"nova/tests/unit/api/openstack/compute/test_flavors.py":[{"author":{"_account_id":6508,"name":"Dmitry Stepanenko","email":"dstepanenko@mirantis.com","username":"dstepanenko"},"change_message_id":"85dbba3b2169f86f3596fb7e08a6992f82e53040","unresolved":false,"context_lines":[{"line_number":592,"context_line":"                self.admin_context)"},{"line_number":593,"context_line":"        self.controller \u003d self.Controller()"},{"line_number":594,"context_line":""},{"line_number":595,"context_line":"    def tearDown(self):"},{"line_number":596,"context_line":"        db.flavor_destroy("},{"line_number":597,"context_line":"                self.admin_context, self.disabled_type[\u0027name\u0027])"},{"line_number":598,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"7a5de9d1_5df1b194","side":"PARENT","line":595,"updated":"2016-02-02 14:50:11.000000000","message":"As we can see, setUp method creates new flavor using _create_disabled_instance_type method, which every time creates flavor with id \u003d (maximum of flavor ids of existing flavors) + 1.\nSo, if you remove tearDown at all, this logic will not be broken, but all the created flavors will remain in the database.\nThe concept of unit test is to have separate independent space for each of testcases. If you remove tearDown method at all, this concept would be broken.\n\nWhy don\u0027t you reimplement tearDown method using new destroy() method?\n\nFor example, you can do in the following way:\n\ninst_types \u003d db.flavor_get_all(self.admin_context)\nflavor_id \u003d max([int(flavor[\u0027flavorid\u0027]) for flavor in inst_types]) + 1)\nflavor \u003d objects.Flavor(context\u003dself.admin_context, flavorid\u003dflavor_id)\nflavor.destroy()","commit_id":"9af1de66e4ab8e63eada3a7d24fccf59a3785f11"},{"author":{"_account_id":15334,"name":"Stephen Finucane","display_name":"stephenfin","email":"stephenfin@redhat.com","username":"sfinucan"},"change_message_id":"8dc77e4a9ec9d8244615796dc9ee1cbc58a92b4f","unresolved":false,"context_lines":[{"line_number":592,"context_line":"                self.admin_context)"},{"line_number":593,"context_line":"        self.controller \u003d self.Controller()"},{"line_number":594,"context_line":""},{"line_number":595,"context_line":"    def tearDown(self):"},{"line_number":596,"context_line":"        db.flavor_destroy("},{"line_number":597,"context_line":"                self.admin_context, self.disabled_type[\u0027name\u0027])"},{"line_number":598,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"5aef4532_0405ea44","side":"PARENT","line":595,"in_reply_to":"5a5ae5dd_0fd9adf3","updated":"2016-03-09 14:07:47.000000000","message":"You should probably put this in a separate change, or at least the commit message?","commit_id":"9af1de66e4ab8e63eada3a7d24fccf59a3785f11"},{"author":{"_account_id":6450,"name":"Hans Lindgren","email":"hanlind@kth.se","username":"hanlind"},"change_message_id":"47e58a9e2ff1f7e82ea9e6de75951cfe408c266f","unresolved":false,"context_lines":[{"line_number":592,"context_line":"                self.admin_context)"},{"line_number":593,"context_line":"        self.controller \u003d self.Controller()"},{"line_number":594,"context_line":""},{"line_number":595,"context_line":"    def tearDown(self):"},{"line_number":596,"context_line":"        db.flavor_destroy("},{"line_number":597,"context_line":"                self.admin_context, self.disabled_type[\u0027name\u0027])"},{"line_number":598,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"7a5de9d1_e4d792eb","side":"PARENT","line":595,"in_reply_to":"7a5de9d1_5df1b194","updated":"2016-02-02 20:48:54.000000000","message":"All unit tests in need of a \"real\" database use a fixture to make sure each test starts with a fresh database. This is most likely a left-over from before that fixture was introduced.","commit_id":"9af1de66e4ab8e63eada3a7d24fccf59a3785f11"},{"author":{"_account_id":6508,"name":"Dmitry Stepanenko","email":"dstepanenko@mirantis.com","username":"dstepanenko"},"change_message_id":"3b54efba423440a7078b5783fb31fa65ff6fd42c","unresolved":false,"context_lines":[{"line_number":592,"context_line":"                self.admin_context)"},{"line_number":593,"context_line":"        self.controller \u003d self.Controller()"},{"line_number":594,"context_line":""},{"line_number":595,"context_line":"    def tearDown(self):"},{"line_number":596,"context_line":"        db.flavor_destroy("},{"line_number":597,"context_line":"                self.admin_context, self.disabled_type[\u0027name\u0027])"},{"line_number":598,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"5a5ae5dd_0fd9adf3","side":"PARENT","line":595,"in_reply_to":"7a5de9d1_e4d792eb","updated":"2016-02-03 14:16:29.000000000","message":"Oh, now I see. Right","commit_id":"9af1de66e4ab8e63eada3a7d24fccf59a3785f11"}],"nova/tests/unit/test_flavors.py":[{"author":{"_account_id":6508,"name":"Dmitry Stepanenko","email":"dstepanenko@mirantis.com","username":"dstepanenko"},"change_message_id":"85dbba3b2169f86f3596fb7e08a6992f82e53040","unresolved":false,"context_lines":[{"line_number":61,"context_line":""},{"line_number":62,"context_line":"class InstanceTypeTestCase(test.TestCase):"},{"line_number":63,"context_line":"    \"\"\"Test cases for flavor  code.\"\"\""},{"line_number":64,"context_line":"    def test_non_existent_inst_type_should_not_delete(self):"},{"line_number":65,"context_line":"        # Ensures that flavor creation fails with invalid args."},{"line_number":66,"context_line":"        self.assertRaises(exception.FlavorNotFoundByName,"},{"line_number":67,"context_line":"                          flavors.destroy,"}],"source_content_type":"text/x-python","patch_set":4,"id":"7a5de9d1_3d1cf576","side":"PARENT","line":64,"updated":"2016-02-02 14:50:11.000000000","message":"What do you think about implement test which check if FlavorNotFound is raised when someone tries to destroy not existing flavor?","commit_id":"9af1de66e4ab8e63eada3a7d24fccf59a3785f11"},{"author":{"_account_id":6508,"name":"Dmitry Stepanenko","email":"dstepanenko@mirantis.com","username":"dstepanenko"},"change_message_id":"3b54efba423440a7078b5783fb31fa65ff6fd42c","unresolved":false,"context_lines":[{"line_number":61,"context_line":""},{"line_number":62,"context_line":"class InstanceTypeTestCase(test.TestCase):"},{"line_number":63,"context_line":"    \"\"\"Test cases for flavor  code.\"\"\""},{"line_number":64,"context_line":"    def test_non_existent_inst_type_should_not_delete(self):"},{"line_number":65,"context_line":"        # Ensures that flavor creation fails with invalid args."},{"line_number":66,"context_line":"        self.assertRaises(exception.FlavorNotFoundByName,"},{"line_number":67,"context_line":"                          flavors.destroy,"}],"source_content_type":"text/x-python","patch_set":4,"id":"5a5ae5dd_af93b9f9","side":"PARENT","line":64,"in_reply_to":"7a5de9d1_246fea93","updated":"2016-02-03 14:16:29.000000000","message":"Right","commit_id":"9af1de66e4ab8e63eada3a7d24fccf59a3785f11"},{"author":{"_account_id":6450,"name":"Hans Lindgren","email":"hanlind@kth.se","username":"hanlind"},"change_message_id":"47e58a9e2ff1f7e82ea9e6de75951cfe408c266f","unresolved":false,"context_lines":[{"line_number":61,"context_line":""},{"line_number":62,"context_line":"class InstanceTypeTestCase(test.TestCase):"},{"line_number":63,"context_line":"    \"\"\"Test cases for flavor  code.\"\"\""},{"line_number":64,"context_line":"    def test_non_existent_inst_type_should_not_delete(self):"},{"line_number":65,"context_line":"        # Ensures that flavor creation fails with invalid args."},{"line_number":66,"context_line":"        self.assertRaises(exception.FlavorNotFoundByName,"},{"line_number":67,"context_line":"                          flavors.destroy,"}],"source_content_type":"text/x-python","patch_set":4,"id":"7a5de9d1_246fea93","side":"PARENT","line":64,"in_reply_to":"7a5de9d1_3d1cf576","updated":"2016-02-02 20:48:54.000000000","message":"See https://github.com/openstack/nova/blob/master/nova/tests/unit/db/test_db_api.py#L3982","commit_id":"9af1de66e4ab8e63eada3a7d24fccf59a3785f11"}],"nova/tests/unit/test_instance_types_extra_specs.py":[{"author":{"_account_id":6508,"name":"Dmitry Stepanenko","email":"dstepanenko@mirantis.com","username":"dstepanenko"},"change_message_id":"85dbba3b2169f86f3596fb7e08a6992f82e53040","unresolved":false,"context_lines":[{"line_number":43,"context_line":"        self.instance_type_id \u003d ref[\"id\"]"},{"line_number":44,"context_line":"        self.flavorid \u003d ref[\"flavorid\"]"},{"line_number":45,"context_line":""},{"line_number":46,"context_line":"    def tearDown(self):"},{"line_number":47,"context_line":"        # Remove the instance type from the database"},{"line_number":48,"context_line":"        db.flavor_destroy(self.context, \"cg1.4xlarge\")"},{"line_number":49,"context_line":"        super(InstanceTypeExtraSpecsTestCase, self).tearDown()"}],"source_content_type":"text/x-python","patch_set":4,"id":"7a5de9d1_6845c9b1","side":"PARENT","line":46,"updated":"2016-02-02 14:50:11.000000000","message":"Same here. What do you think about reimplementing tearDown with updated db api?","commit_id":"9af1de66e4ab8e63eada3a7d24fccf59a3785f11"}]}
