)]}'
{"nova/db/sqlalchemy/api.py":[{"author":{"_account_id":7494,"name":"Guangya Liu","email":"gyliu513@gmail.com","username":"JayLau"},"change_message_id":"26d313c48fadb7a86ab6e877ea93b3848c4a4c7b","unresolved":false,"context_lines":[{"line_number":2579,"context_line":""},{"line_number":2580,"context_line":"def quota_class_get_default(context):"},{"line_number":2581,"context_line":"    rows \u003d model_query(context, models.QuotaClass, read_deleted\u003d\"no\").\\"},{"line_number":2582,"context_line":"                   filter_by(class_name\u003d_DEFAULT_QUOTA_NAME).\\"},{"line_number":2583,"context_line":"                   all()"},{"line_number":2584,"context_line":""},{"line_number":2585,"context_line":"    result \u003d {\u0027class_name\u0027: _DEFAULT_QUOTA_NAME}"}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAAPH%2F%2F8kY%3D","line":2582,"updated":"2013-05-18 04:49:43.000000000","message":"Sorry for nitpick, long lines should be wrapped in parentheses in preference to using a backslash for line continuation.\n\nRefer to https://github.com/openstack/nova/blame/master/HACKING.rst#L14\n\nThough there are still some codes using \u0027\\\u0027 for long lines, but we should make new added code follow such style.","commit_id":"682fb1de14c142816df2a453062abfd351157a4b"},{"author":{"_account_id":679,"name":"Kevin L. Mitchell","email":"klmitch@mit.edu","username":"klmitch"},"change_message_id":"c92f2837da3efe6f73348a0987194392b07044c3","unresolved":false,"context_lines":[{"line_number":2579,"context_line":""},{"line_number":2580,"context_line":"def quota_class_get_default(context):"},{"line_number":2581,"context_line":"    rows \u003d model_query(context, models.QuotaClass, read_deleted\u003d\"no\").\\"},{"line_number":2582,"context_line":"                   filter_by(class_name\u003d_DEFAULT_QUOTA_NAME).\\"},{"line_number":2583,"context_line":"                   all()"},{"line_number":2584,"context_line":""},{"line_number":2585,"context_line":"    result \u003d {\u0027class_name\u0027: _DEFAULT_QUOTA_NAME}"}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAAPH%2F%2F6Dc%3D","line":2582,"in_reply_to":"AAAAPH%2F%2F8f8%3D","updated":"2013-05-20 16:10:22.000000000","message":"An explicit exception to that general preference is these method call chains in sqlalchemy/apy.py, actually.","commit_id":"682fb1de14c142816df2a453062abfd351157a4b"},{"author":{"_account_id":4428,"name":"Liyingjun","email":"yinjalee@163.com","username":"liyingjun"},"change_message_id":"6390542f0978afb77a7a9e9b699cdadd334eccda","unresolved":false,"context_lines":[{"line_number":2579,"context_line":""},{"line_number":2580,"context_line":"def quota_class_get_default(context):"},{"line_number":2581,"context_line":"    rows \u003d model_query(context, models.QuotaClass, read_deleted\u003d\"no\").\\"},{"line_number":2582,"context_line":"                   filter_by(class_name\u003d_DEFAULT_QUOTA_NAME).\\"},{"line_number":2583,"context_line":"                   all()"},{"line_number":2584,"context_line":""},{"line_number":2585,"context_line":"    result \u003d {\u0027class_name\u0027: _DEFAULT_QUOTA_NAME}"}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAAPH%2F%2F8f8%3D","line":2582,"in_reply_to":"AAAAPH%2F%2F8kY%3D","updated":"2013-05-18 06:09:53.000000000","message":"Thanks for the tip.","commit_id":"682fb1de14c142816df2a453062abfd351157a4b"}],"nova/tests/test_quota.py":[{"author":{"_account_id":679,"name":"Kevin L. Mitchell","email":"klmitch@mit.edu","username":"klmitch"},"change_message_id":"765a30a726a69f9186718f21da048bbfeaa07145","unresolved":false,"context_lines":[{"line_number":547,"context_line":"                use_admin_context\u003dTrue)"},{"line_number":548,"context_line":"        res_dict \u003d controller.update(req, \u0027default\u0027, quotas)"},{"line_number":549,"context_line":"        defaults \u003d quota_obj.get_defaults(context.get_admin_context())"},{"line_number":550,"context_line":"        self.assertEqual(res_dict[\u0027quota_class_set\u0027], defaults)"},{"line_number":551,"context_line":""},{"line_number":552,"context_line":"    def test_get_class_quotas(self):"},{"line_number":553,"context_line":"        context \u003d FakeContext(None, None)"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAPH%2F%2F9b8%3D","line":550,"updated":"2013-05-17 18:10:38.000000000","message":"Um…this isn\u0027t what I\u0027m looking for in test coverage.  I want *unit* tests on the functionality you added, not this integration test on something we already know works…","commit_id":"205afaf48480a7064b6729d4eb41ccf77ad66fda"},{"author":{"_account_id":679,"name":"Kevin L. Mitchell","email":"klmitch@mit.edu","username":"klmitch"},"change_message_id":"d5431cda0d0b096c5ff573e380911992a1c854f5","unresolved":false,"context_lines":[{"line_number":547,"context_line":"                use_admin_context\u003dTrue)"},{"line_number":548,"context_line":"        res_dict \u003d controller.update(req, \u0027default\u0027, quotas)"},{"line_number":549,"context_line":"        defaults \u003d quota_obj.get_defaults(context.get_admin_context())"},{"line_number":550,"context_line":"        self.assertEqual(res_dict[\u0027quota_class_set\u0027], defaults)"},{"line_number":551,"context_line":""},{"line_number":552,"context_line":"    def test_get_class_quotas(self):"},{"line_number":553,"context_line":"        context \u003d FakeContext(None, None)"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAPH%2F%2F9Xg%3D","line":550,"in_reply_to":"AAAAPH%2F%2F9aI%3D","updated":"2013-05-17 18:42:00.000000000","message":"Well, the test you added above tests that the QuotaClassSetsController can create a \"default\" quota class.  This is something that we already know works.  What I really want you to do is add a test on the quota_class_get_default() function you added to the DB API, to verify that it interprets the database contents correctly and returns the correct response; another test on DbQuotaDriver.get_defaults(), to verify that it correctly marries the database-defined quotas with the defaults drawn from the resource declarations; and one on DbQuotaDriver.get_project_quotas(), to ensure that it utilizes the default quotas as discovered by DbQuotaDriver.get_defaults().\n\nTo do this properly, as _unit_ tests that test the function of one unit, you will need to mock out the return values of some of the other functions and methods that are called by the functions under test; you should be able to get a good idea of how to do this by looking at some of the other tests defined in this file, but feel free to ask questions.  In the end, you should not need to draw in the QuotaClassSetsController.\n\nI should also point out that the test on the quota_class_get_default() function you defined should probably go in the test_db_api.py file, as opposed to this one.\n\nTesting is one of the hardest part of software development, not to mention one of the most tedious.  Unfortunately for lazy programmers like me, it\u0027s also one of the most essential; how else can you know that your code actually does what you want it to do?  :)","commit_id":"205afaf48480a7064b6729d4eb41ccf77ad66fda"},{"author":{"_account_id":4428,"name":"Liyingjun","email":"yinjalee@163.com","username":"liyingjun"},"change_message_id":"43bb0b6b507eabdb5c4b9d98b2687bf3c07a19f1","unresolved":false,"context_lines":[{"line_number":547,"context_line":"                use_admin_context\u003dTrue)"},{"line_number":548,"context_line":"        res_dict \u003d controller.update(req, \u0027default\u0027, quotas)"},{"line_number":549,"context_line":"        defaults \u003d quota_obj.get_defaults(context.get_admin_context())"},{"line_number":550,"context_line":"        self.assertEqual(res_dict[\u0027quota_class_set\u0027], defaults)"},{"line_number":551,"context_line":""},{"line_number":552,"context_line":"    def test_get_class_quotas(self):"},{"line_number":553,"context_line":"        context \u003d FakeContext(None, None)"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAPH%2F%2F9aI%3D","line":550,"in_reply_to":"AAAAPH%2F%2F9b8%3D","updated":"2013-05-17 18:22:35.000000000","message":"Sorry, I do not know much about test, could you please make it more clear. thanks !","commit_id":"205afaf48480a7064b6729d4eb41ccf77ad66fda"},{"author":{"_account_id":679,"name":"Kevin L. Mitchell","email":"klmitch@mit.edu","username":"klmitch"},"change_message_id":"942f98406b92c1536e3b8a38bf4193da5155514e","unresolved":false,"context_lines":[{"line_number":759,"context_line":""},{"line_number":760,"context_line":"    def _stub_quota_class_get_default(self):"},{"line_number":761,"context_line":"        # Stub out quota_class_get_default"},{"line_number":762,"context_line":"        def fake_qcgabn(context):"},{"line_number":763,"context_line":"            self.calls.append(\u0027quota_class_get_default\u0027)"},{"line_number":764,"context_line":"            return dict("},{"line_number":765,"context_line":"                instances\u003d5,"}],"source_content_type":"text/x-python","patch_set":4,"id":"AAAAPH%2F%2F9Js%3D","line":762,"updated":"2013-05-17 20:21:31.000000000","message":"Just so you know, the obscure name I picked in _stub_quota_class_get_all_by_name() is actually all the first letters of the function I\u0027m stubbing out; if you were to copy the same scheme here, the function would be named \"fake_qcgd\".\n\nThat said, I don\u0027t care to make you rename an inner function that will never be referenced by anything else :)","commit_id":"f7091e2534364b4c6079a6487ab2f6eb517c132d"}]}
