)]}'
{"openstack_auth/backend.py":[{"author":{"_account_id":5623,"name":"David Lyle","email":"dklyle0@gmail.com","username":"david-lyle"},"change_message_id":"ddf8432263777d153c3f4c16191757497c054e07","unresolved":false,"context_lines":[{"line_number":263,"context_line":"            request.user \u003d user"},{"line_number":264,"context_line":"            timeout \u003d getattr(settings, \"SESSION_TIMEOUT\", 3600)"},{"line_number":265,"context_line":"            token_life \u003d user.token.expires - datetime.datetime.now(pytz.utc)"},{"line_number":266,"context_line":"            session_time \u003d min(timeout, int(token_life.total_seconds()))"},{"line_number":267,"context_line":"            request.session.set_expiry(session_time)"},{"line_number":268,"context_line":""},{"line_number":269,"context_line":"            scoped_client \u003d keystone_client_class(session\u003dsession,"}],"source_content_type":"text/x-python","patch_set":6,"id":"1a122d0e_0ceb94b1","line":266,"updated":"2016-04-18 16:14:16.000000000","message":"The reason this only testing the min function is that to write a test, we will mock the value of user.token.expires, as all token data is mocked. So if we mock it to return the correct format of data (Note: this will not guard against upstream changes that may break us). So we are taking a mocked value in expires and subtracting. Then we call min(). So essentially the tests would be mocking:\nuser.token.expires \u003d datetime.datetime.now(pytz.utc) + 3601\nor\nuser.token.expires \u003d datetime.datetime.now(pytz.utc) + 3599\n\nThis is testing subtraction and min() not anything else. What is the point?","commit_id":"d7a2dce59d95979fb3d4ae5cdac9fd063c09d88d"},{"author":{"_account_id":841,"name":"Akihiro Motoki","email":"amotoki@gmail.com","username":"amotoki"},"change_message_id":"186c34d5d04651d631b9588a2d2ff7cb934fb375","unresolved":false,"context_lines":[{"line_number":263,"context_line":"            request.user \u003d user"},{"line_number":264,"context_line":"            timeout \u003d getattr(settings, \"SESSION_TIMEOUT\", 3600)"},{"line_number":265,"context_line":"            token_life \u003d user.token.expires - datetime.datetime.now(pytz.utc)"},{"line_number":266,"context_line":"            session_time \u003d min(timeout, int(token_life.total_seconds()))"},{"line_number":267,"context_line":"            request.session.set_expiry(session_time)"},{"line_number":268,"context_line":""},{"line_number":269,"context_line":"            scoped_client \u003d keystone_client_class(session\u003dsession,"}],"source_content_type":"text/x-python","patch_set":6,"id":"1a122d0e_85aea4e5","line":266,"in_reply_to":"1a122d0e_01160955","updated":"2016-04-21 16:04:50.000000000","message":"Another compromise is to make L.264-266 a separate method in utils.py. I am not sure it is what we want. Just an idea.","commit_id":"d7a2dce59d95979fb3d4ae5cdac9fd063c09d88d"},{"author":{"_account_id":12826,"name":"Rob Cresswell","display_name":"robcresswell","email":"robert.cresswell@outlook.com","username":"rob-cresswell"},"change_message_id":"7f72447dc5ae225987d63efd18ad017ba49717a7","unresolved":false,"context_lines":[{"line_number":263,"context_line":"            request.user \u003d user"},{"line_number":264,"context_line":"            timeout \u003d getattr(settings, \"SESSION_TIMEOUT\", 3600)"},{"line_number":265,"context_line":"            token_life \u003d user.token.expires - datetime.datetime.now(pytz.utc)"},{"line_number":266,"context_line":"            session_time \u003d min(timeout, int(token_life.total_seconds()))"},{"line_number":267,"context_line":"            request.session.set_expiry(session_time)"},{"line_number":268,"context_line":""},{"line_number":269,"context_line":"            scoped_client \u003d keystone_client_class(session\u003dsession,"}],"source_content_type":"text/x-python","patch_set":6,"id":"1a122d0e_33dc4874","line":266,"in_reply_to":"1a122d0e_0ceb94b1","updated":"2016-04-21 11:55:49.000000000","message":"I still don\u0027t see why we would be testing min. What we\u0027d actually want to do is set timeout to be something very high so as it to not interfere with min, then mock user.token.expires to be more than a day, then check that the session ends up with the correct expiry time.\n\nMin doesnt even factor in, because for the logic we want to test we\u0027d always want session_time to be int(token_life.total_seconds()), and then we can verify that the session has an expiry time of more than one day, which is what the change is implementing in the first place. That would stop any regression too, as if someone accidentally put seconds back (instead of total_seconds) then the session expiry would end up as \u003c1 day.","commit_id":"d7a2dce59d95979fb3d4ae5cdac9fd063c09d88d"},{"author":{"_account_id":841,"name":"Akihiro Motoki","email":"amotoki@gmail.com","username":"amotoki"},"change_message_id":"4dc34ac1344e6bba56c92610391586dab111fd62","unresolved":false,"context_lines":[{"line_number":263,"context_line":"            request.user \u003d user"},{"line_number":264,"context_line":"            timeout \u003d getattr(settings, \"SESSION_TIMEOUT\", 3600)"},{"line_number":265,"context_line":"            token_life \u003d user.token.expires - datetime.datetime.now(pytz.utc)"},{"line_number":266,"context_line":"            session_time \u003d min(timeout, int(token_life.total_seconds()))"},{"line_number":267,"context_line":"            request.session.set_expiry(session_time)"},{"line_number":268,"context_line":""},{"line_number":269,"context_line":"            scoped_client \u003d keystone_client_class(session\u003dsession,"}],"source_content_type":"text/x-python","patch_set":6,"id":"1a122d0e_80b46ed1","line":266,"in_reply_to":"1a122d0e_0ceb94b1","updated":"2016-04-19 07:50:56.000000000","message":"The problem is that timedelta.secodns returns [0..86399).\nWhat we would like to test is that a case where timedelta (token_life) is longer than or equal one day.\n\n  In [35]: delta \u003d datetime.timedelta(days\u003d1, minutes\u003d10)\n  In [36]: delta\n  Out[36]: datetime.timedelta(1, 600)\n  In [37]: delta.seconds\n  Out[37]: 600\n  In [38]: delta.total_seconds()\n  Out[38]: 87000.0","commit_id":"d7a2dce59d95979fb3d4ae5cdac9fd063c09d88d"},{"author":{"_account_id":841,"name":"Akihiro Motoki","email":"amotoki@gmail.com","username":"amotoki"},"change_message_id":"f22731b82a30394a10b67bd78410cb1e65d73638","unresolved":false,"context_lines":[{"line_number":263,"context_line":"            request.user \u003d user"},{"line_number":264,"context_line":"            timeout \u003d getattr(settings, \"SESSION_TIMEOUT\", 3600)"},{"line_number":265,"context_line":"            token_life \u003d user.token.expires - datetime.datetime.now(pytz.utc)"},{"line_number":266,"context_line":"            session_time \u003d min(timeout, int(token_life.total_seconds()))"},{"line_number":267,"context_line":"            request.session.set_expiry(session_time)"},{"line_number":268,"context_line":""},{"line_number":269,"context_line":"            scoped_client \u003d keystone_client_class(session\u003dsession,"}],"source_content_type":"text/x-python","patch_set":6,"id":"1a122d0e_01160955","line":266,"in_reply_to":"1a122d0e_33dc4874","updated":"2016-04-21 16:02:45.000000000","message":"Rob, you are right. What we are requesting does not mean testing the functionality of min. I tend to agree that we should have a test coverage.\n\nOn the other hand, after I looked into the current tests.\nThe existing tests check openstack_auth as a whole, and it is not easy to add a test to cover this change. I first thought to mock datetime.datetime.now() but it failed with the following error.\n\n  TypeError: can\u0027t set attributes of built-in/extension type \u0027datetime.datetime\u0027\n\nAfter a glance, I could not figure out what should be changed and how to write a test easily. More investigation seems required.\n\nThe best thing is to have a test, but I am not sure which is better to hold this patch until a test is available or to go as-is.\n\nIt would be great if some volunteer steps up.","commit_id":"d7a2dce59d95979fb3d4ae5cdac9fd063c09d88d"}]}
