)]}'
{"keystone/tests/unit/token/test_fernet_provider.py":[{"author":{"_account_id":12606,"name":"Miguel Grinberg","email":"miguel.grinberg@gmail.com","username":"miguelgrinberg"},"change_message_id":"68c6d4f82a7163939b5bdb89f31846b1bde95c6d","unresolved":false,"context_lines":[{"line_number":59,"context_line":""},{"line_number":60,"context_line":"class TestTokenFormatter(tests.TestCase):"},{"line_number":61,"context_line":"    def test_restore_padding(self):"},{"line_number":62,"context_line":"        encoded_string \u003d base64.urlsafe_b64encode(uuid.uuid4().hex)"},{"line_number":63,"context_line":"        encoded_str_without_padding \u003d encoded_string.rstrip(\u0027\u003d\u0027)"},{"line_number":64,"context_line":"        self.assertFalse(encoded_str_without_padding.endswith(\u0027\u003d\u0027))"},{"line_number":65,"context_line":"        encoded_str_with_padding_restored \u003d ("}],"source_content_type":"text/x-python","patch_set":1,"id":"da20952f_9231f2ef","line":62,"updated":"2015-09-03 19:20:37.000000000","message":"For this to be an effective test, you need to try strings of different lengths, so that all the padding configurations of the b64 are exercised. You can start with the uuid, but then repeat the test with the last char removed, and then again with the last two chars removed.","commit_id":"66e8c89de811f6c0b0ab2cf433603e66bce766c9"},{"author":{"_account_id":5046,"name":"Lance Bragstad","email":"lbragstad@redhat.com","username":"ldbragst"},"change_message_id":"53c247b51c5da0137353d9968a7af4786291131f","unresolved":false,"context_lines":[{"line_number":59,"context_line":""},{"line_number":60,"context_line":"class TestTokenFormatter(tests.TestCase):"},{"line_number":61,"context_line":"    def test_restore_padding(self):"},{"line_number":62,"context_line":"        encoded_string \u003d base64.urlsafe_b64encode(uuid.uuid4().hex)"},{"line_number":63,"context_line":"        encoded_str_without_padding \u003d encoded_string.rstrip(\u0027\u003d\u0027)"},{"line_number":64,"context_line":"        self.assertFalse(encoded_str_without_padding.endswith(\u0027\u003d\u0027))"},{"line_number":65,"context_line":"        encoded_str_with_padding_restored \u003d ("}],"source_content_type":"text/x-python","patch_set":1,"id":"da20952f_52e915b6","line":62,"in_reply_to":"da20952f_9231f2ef","updated":"2015-09-03 21:31:55.000000000","message":"Done","commit_id":"66e8c89de811f6c0b0ab2cf433603e66bce766c9"},{"author":{"_account_id":7725,"name":"David Stanek","email":"dstanek@dstanek.com","username":"dstanek"},"change_message_id":"deb196cac2456d5e3460edc2833c54d9694f6ace","unresolved":false,"context_lines":[{"line_number":61,"context_line":"    def test_restore_padding(self):"},{"line_number":62,"context_line":"        encoded_string \u003d base64.urlsafe_b64encode(uuid.uuid4().hex)"},{"line_number":63,"context_line":"        encoded_str_without_padding \u003d encoded_string.rstrip(\u0027\u003d\u0027)"},{"line_number":64,"context_line":"        self.assertFalse(encoded_str_without_padding.endswith(\u0027\u003d\u0027))"},{"line_number":65,"context_line":"        encoded_str_with_padding_restored \u003d ("},{"line_number":66,"context_line":"            token_formatters.TokenFormatter.restore_padding("},{"line_number":67,"context_line":"                encoded_str_without_padding)"}],"source_content_type":"text/x-python","patch_set":1,"id":"da20952f_8feea9eb","line":64,"updated":"2015-09-03 19:19:17.000000000","message":"Python is not broken!","commit_id":"66e8c89de811f6c0b0ab2cf433603e66bce766c9"},{"author":{"_account_id":5046,"name":"Lance Bragstad","email":"lbragstad@redhat.com","username":"ldbragst"},"change_message_id":"53c247b51c5da0137353d9968a7af4786291131f","unresolved":false,"context_lines":[{"line_number":61,"context_line":"    def test_restore_padding(self):"},{"line_number":62,"context_line":"        encoded_string \u003d base64.urlsafe_b64encode(uuid.uuid4().hex)"},{"line_number":63,"context_line":"        encoded_str_without_padding \u003d encoded_string.rstrip(\u0027\u003d\u0027)"},{"line_number":64,"context_line":"        self.assertFalse(encoded_str_without_padding.endswith(\u0027\u003d\u0027))"},{"line_number":65,"context_line":"        encoded_str_with_padding_restored \u003d ("},{"line_number":66,"context_line":"            token_formatters.TokenFormatter.restore_padding("},{"line_number":67,"context_line":"                encoded_str_without_padding)"}],"source_content_type":"text/x-python","patch_set":1,"id":"da20952f_12d07df5","line":64,"in_reply_to":"da20952f_8feea9eb","updated":"2015-09-03 21:31:55.000000000","message":"++","commit_id":"66e8c89de811f6c0b0ab2cf433603e66bce766c9"}],"keystone/token/providers/fernet/token_formatters.py":[{"author":{"_account_id":12606,"name":"Miguel Grinberg","email":"miguel.grinberg@gmail.com","username":"miguelgrinberg"},"change_message_id":"68c6d4f82a7163939b5bdb89f31846b1bde95c6d","unresolved":false,"context_lines":[{"line_number":88,"context_line":""},{"line_number":89,"context_line":"        \"\"\""},{"line_number":90,"context_line":"        # Re-inflate the padding"},{"line_number":91,"context_line":"        missing_padding \u003d 4 - len(token) % 4"},{"line_number":92,"context_line":"        if missing_padding:"},{"line_number":93,"context_line":"            token +\u003d b\u0027\u003d\u0027 * missing_padding"},{"line_number":94,"context_line":"        return token"}],"source_content_type":"text/x-python","patch_set":1,"id":"da20952f_327ee66a","line":91,"updated":"2015-09-03 19:20:37.000000000","message":"If missing_padding \u003d\u003d 4, then you can skip the whole thing, right? That means the originally encoded token has a len that is a multiple of 4, so it does not need any padding.","commit_id":"66e8c89de811f6c0b0ab2cf433603e66bce766c9"},{"author":{"_account_id":5046,"name":"Lance Bragstad","email":"lbragstad@redhat.com","username":"ldbragst"},"change_message_id":"53c247b51c5da0137353d9968a7af4786291131f","unresolved":false,"context_lines":[{"line_number":88,"context_line":""},{"line_number":89,"context_line":"        \"\"\""},{"line_number":90,"context_line":"        # Re-inflate the padding"},{"line_number":91,"context_line":"        missing_padding \u003d 4 - len(token) % 4"},{"line_number":92,"context_line":"        if missing_padding:"},{"line_number":93,"context_line":"            token +\u003d b\u0027\u003d\u0027 * missing_padding"},{"line_number":94,"context_line":"        return token"}],"source_content_type":"text/x-python","patch_set":1,"id":"da20952f_1e23a959","line":91,"in_reply_to":"da20952f_327ee66a","updated":"2015-09-03 21:31:55.000000000","message":"new patch on the way.","commit_id":"66e8c89de811f6c0b0ab2cf433603e66bce766c9"},{"author":{"_account_id":7725,"name":"David Stanek","email":"dstanek@dstanek.com","username":"dstanek"},"change_message_id":"deb196cac2456d5e3460edc2833c54d9694f6ace","unresolved":false,"context_lines":[{"line_number":89,"context_line":"        \"\"\""},{"line_number":90,"context_line":"        # Re-inflate the padding"},{"line_number":91,"context_line":"        missing_padding \u003d 4 - len(token) % 4"},{"line_number":92,"context_line":"        if missing_padding:"},{"line_number":93,"context_line":"            token +\u003d b\u0027\u003d\u0027 * missing_padding"},{"line_number":94,"context_line":"        return token"},{"line_number":95,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"da20952f_2f851dce","line":92,"updated":"2015-09-03 19:19:17.000000000","message":"(nit) you can replace all three of these lines with \"return token +\u003d b\u0027\u003d\u0027 * missing_padding\"","commit_id":"66e8c89de811f6c0b0ab2cf433603e66bce766c9"},{"author":{"_account_id":5046,"name":"Lance Bragstad","email":"lbragstad@redhat.com","username":"ldbragst"},"change_message_id":"53c247b51c5da0137353d9968a7af4786291131f","unresolved":false,"context_lines":[{"line_number":89,"context_line":"        \"\"\""},{"line_number":90,"context_line":"        # Re-inflate the padding"},{"line_number":91,"context_line":"        missing_padding \u003d 4 - len(token) % 4"},{"line_number":92,"context_line":"        if missing_padding:"},{"line_number":93,"context_line":"            token +\u003d b\u0027\u003d\u0027 * missing_padding"},{"line_number":94,"context_line":"        return token"},{"line_number":95,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"da20952f_befdddb2","line":92,"in_reply_to":"da20952f_2f851dce","updated":"2015-09-03 21:31:55.000000000","message":"Done","commit_id":"66e8c89de811f6c0b0ab2cf433603e66bce766c9"},{"author":{"_account_id":4,"name":"Dolph Mathews","email":"dolph.mathews@gmail.com","username":"dolph"},"change_message_id":"63c9b636bda51fc3ffcc8250966bbf6b0a737191","unresolved":false,"context_lines":[{"line_number":190,"context_line":"        if not isinstance(token, six.binary_type):"},{"line_number":191,"context_line":"            token \u003d token.encode(\u0027ascii\u0027)"},{"line_number":192,"context_line":""},{"line_number":193,"context_line":"        serialized_payload \u003d self.unpack(token)"},{"line_number":194,"context_line":"        versioned_payload \u003d msgpack.unpackb(serialized_payload)"},{"line_number":195,"context_line":"        version, payload \u003d versioned_payload[0], versioned_payload[1:]"},{"line_number":196,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"da20952f_a89cbe6a","side":"PARENT","line":193,"updated":"2015-09-03 22:30:39.000000000","message":"move the call to restore_padding into unpack()","commit_id":"7f279ad636de8ccd8025dd1c7f079c29005f177a"},{"author":{"_account_id":5046,"name":"Lance Bragstad","email":"lbragstad@redhat.com","username":"ldbragst"},"change_message_id":"1b24ba2cadab2c3b4e34798eea905ed227d27ee3","unresolved":false,"context_lines":[{"line_number":190,"context_line":"        if not isinstance(token, six.binary_type):"},{"line_number":191,"context_line":"            token \u003d token.encode(\u0027ascii\u0027)"},{"line_number":192,"context_line":""},{"line_number":193,"context_line":"        serialized_payload \u003d self.unpack(token)"},{"line_number":194,"context_line":"        versioned_payload \u003d msgpack.unpackb(serialized_payload)"},{"line_number":195,"context_line":"        version, payload \u003d versioned_payload[0], versioned_payload[1:]"},{"line_number":196,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"da20952f_6bc8e022","side":"PARENT","line":193,"in_reply_to":"da20952f_a89cbe6a","updated":"2015-09-03 23:15:07.000000000","message":"Done","commit_id":"7f279ad636de8ccd8025dd1c7f079c29005f177a"},{"author":{"_account_id":4,"name":"Dolph Mathews","email":"dolph.mathews@gmail.com","username":"dolph"},"change_message_id":"63c9b636bda51fc3ffcc8250966bbf6b0a737191","unresolved":false,"context_lines":[{"line_number":184,"context_line":""},{"line_number":185,"context_line":"        versioned_payload \u003d (version,) + payload"},{"line_number":186,"context_line":"        serialized_payload \u003d msgpack.packb(versioned_payload)"},{"line_number":187,"context_line":"        token \u003d self.pack(serialized_payload).rstrip(\u0027\u003d\u0027)"},{"line_number":188,"context_line":""},{"line_number":189,"context_line":"        # NOTE(lbragstad): We should warn against Fernet tokens that are over"},{"line_number":190,"context_line":"        # 255 characters in length. This is mostly due to persisting the tokens"}],"source_content_type":"text/x-python","patch_set":2,"id":"da20952f_c899f27a","line":187,"updated":"2015-09-03 22:30:39.000000000","message":"move the call to rstrip() into pack()","commit_id":"4d6e357bdff0f1eeacfb168a004fc3b8fc496c65"},{"author":{"_account_id":7725,"name":"David Stanek","email":"dstanek@dstanek.com","username":"dstanek"},"change_message_id":"fece603203891868c21e1614d6b92a242793026a","unresolved":false,"context_lines":[{"line_number":184,"context_line":""},{"line_number":185,"context_line":"        versioned_payload \u003d (version,) + payload"},{"line_number":186,"context_line":"        serialized_payload \u003d msgpack.packb(versioned_payload)"},{"line_number":187,"context_line":"        token \u003d self.pack(serialized_payload).rstrip(\u0027\u003d\u0027)"},{"line_number":188,"context_line":""},{"line_number":189,"context_line":"        # NOTE(lbragstad): We should warn against Fernet tokens that are over"},{"line_number":190,"context_line":"        # 255 characters in length. This is mostly due to persisting the tokens"}],"source_content_type":"text/x-python","patch_set":2,"id":"da20952f_cbec8cbd","line":187,"in_reply_to":"da20952f_c899f27a","updated":"2015-09-03 23:08:36.000000000","message":"That\u0027s a good call.","commit_id":"4d6e357bdff0f1eeacfb168a004fc3b8fc496c65"},{"author":{"_account_id":5046,"name":"Lance Bragstad","email":"lbragstad@redhat.com","username":"ldbragst"},"change_message_id":"1b24ba2cadab2c3b4e34798eea905ed227d27ee3","unresolved":false,"context_lines":[{"line_number":184,"context_line":""},{"line_number":185,"context_line":"        versioned_payload \u003d (version,) + payload"},{"line_number":186,"context_line":"        serialized_payload \u003d msgpack.packb(versioned_payload)"},{"line_number":187,"context_line":"        token \u003d self.pack(serialized_payload).rstrip(\u0027\u003d\u0027)"},{"line_number":188,"context_line":""},{"line_number":189,"context_line":"        # NOTE(lbragstad): We should warn against Fernet tokens that are over"},{"line_number":190,"context_line":"        # 255 characters in length. This is mostly due to persisting the tokens"}],"source_content_type":"text/x-python","patch_set":2,"id":"da20952f_cb480cb6","line":187,"in_reply_to":"da20952f_cbec8cbd","updated":"2015-09-03 23:15:07.000000000","message":"Done","commit_id":"4d6e357bdff0f1eeacfb168a004fc3b8fc496c65"},{"author":{"_account_id":17123,"name":"Tom Cocozzello (tjcocozz)","email":"tjcocozz@us.ibm.com","username":"tcocozzello"},"change_message_id":"6cedb488b32cc6499df0078da4a6eb8a45e19e7b","unresolved":false,"context_lines":[{"line_number":105,"context_line":"        fernet_token \u003d six.binary_type(fernet_token)"},{"line_number":106,"context_line":""},{"line_number":107,"context_line":"        # Restore padding on token before decoding it"},{"line_number":108,"context_line":"        fernet_token \u003d TokenFormatter.restore_padding(fernet_token)"},{"line_number":109,"context_line":""},{"line_number":110,"context_line":"        # fernet tokens are base64 encoded, so we need to unpack them first"},{"line_number":111,"context_line":"        token_bytes \u003d base64.urlsafe_b64decode(fernet_token)"}],"source_content_type":"text/x-python","patch_set":3,"id":"da20952f_2e173fef","line":108,"updated":"2015-09-04 14:10:41.000000000","message":"Should we be using the class object to call restore_padding? i.e. \u0027cls.restore_padding(fernet_token)\u0027","commit_id":"6aa22404be3b30766e0b1d7fd54dfb9fef6493fc"},{"author":{"_account_id":7725,"name":"David Stanek","email":"dstanek@dstanek.com","username":"dstanek"},"change_message_id":"8c5f3fa29a3785694fe46bb51e66c7117c2e3779","unresolved":false,"context_lines":[{"line_number":105,"context_line":"        fernet_token \u003d six.binary_type(fernet_token)"},{"line_number":106,"context_line":""},{"line_number":107,"context_line":"        # Restore padding on token before decoding it"},{"line_number":108,"context_line":"        fernet_token \u003d TokenFormatter.restore_padding(fernet_token)"},{"line_number":109,"context_line":""},{"line_number":110,"context_line":"        # fernet tokens are base64 encoded, so we need to unpack them first"},{"line_number":111,"context_line":"        token_bytes \u003d base64.urlsafe_b64decode(fernet_token)"}],"source_content_type":"text/x-python","patch_set":3,"id":"da20952f_f931130c","line":108,"in_reply_to":"da20952f_2e173fef","updated":"2015-09-04 14:25:58.000000000","message":"While not necessary I prefer to call class methods using the class instead of the instance.","commit_id":"6aa22404be3b30766e0b1d7fd54dfb9fef6493fc"},{"author":{"_account_id":7725,"name":"David Stanek","email":"dstanek@dstanek.com","username":"dstanek"},"change_message_id":"d270e9aca1fe52b43767965b439ef30486627f7a","unresolved":false,"context_lines":[{"line_number":105,"context_line":"        fernet_token \u003d six.binary_type(fernet_token)"},{"line_number":106,"context_line":""},{"line_number":107,"context_line":"        # Restore padding on token before decoding it"},{"line_number":108,"context_line":"        fernet_token \u003d TokenFormatter.restore_padding(fernet_token)"},{"line_number":109,"context_line":""},{"line_number":110,"context_line":"        # fernet tokens are base64 encoded, so we need to unpack them first"},{"line_number":111,"context_line":"        token_bytes \u003d base64.urlsafe_b64decode(fernet_token)"}],"source_content_type":"text/x-python","patch_set":3,"id":"da20952f_f632425d","line":108,"in_reply_to":"da20952f_6de50136","updated":"2015-09-07 12:06:46.000000000","message":"Since it doesn\u0027t use the cls, I think it would be a fine candidate to be a static method.","commit_id":"6aa22404be3b30766e0b1d7fd54dfb9fef6493fc"},{"author":{"_account_id":8978,"name":"Marek Denis","email":"marek.denis+openstack@gmail.com","username":"marek-denis"},"change_message_id":"27e336a5cc4dfa788600b3fe0cdd754cfb38cc44","unresolved":false,"context_lines":[{"line_number":105,"context_line":"        fernet_token \u003d six.binary_type(fernet_token)"},{"line_number":106,"context_line":""},{"line_number":107,"context_line":"        # Restore padding on token before decoding it"},{"line_number":108,"context_line":"        fernet_token \u003d TokenFormatter.restore_padding(fernet_token)"},{"line_number":109,"context_line":""},{"line_number":110,"context_line":"        # fernet tokens are base64 encoded, so we need to unpack them first"},{"line_number":111,"context_line":"        token_bytes \u003d base64.urlsafe_b64decode(fernet_token)"}],"source_content_type":"text/x-python","patch_set":3,"id":"da20952f_a789f270","line":108,"in_reply_to":"da20952f_f632425d","updated":"2015-09-07 13:07:29.000000000","message":"i\u0027d simply make it cls so we don\u0027t close for some class overloading. I think this is what @classmethod is for, right?","commit_id":"6aa22404be3b30766e0b1d7fd54dfb9fef6493fc"},{"author":{"_account_id":17123,"name":"Tom Cocozzello (tjcocozz)","email":"tjcocozz@us.ibm.com","username":"tcocozzello"},"change_message_id":"b980ccbfbed19a393533dd179ff94f1931bfc48f","unresolved":false,"context_lines":[{"line_number":105,"context_line":"        fernet_token \u003d six.binary_type(fernet_token)"},{"line_number":106,"context_line":""},{"line_number":107,"context_line":"        # Restore padding on token before decoding it"},{"line_number":108,"context_line":"        fernet_token \u003d TokenFormatter.restore_padding(fernet_token)"},{"line_number":109,"context_line":""},{"line_number":110,"context_line":"        # fernet tokens are base64 encoded, so we need to unpack them first"},{"line_number":111,"context_line":"        token_bytes \u003d base64.urlsafe_b64decode(fernet_token)"}],"source_content_type":"text/x-python","patch_set":3,"id":"da20952f_941e9e0a","line":108,"in_reply_to":"da20952f_f931130c","updated":"2015-09-04 14:36:46.000000000","message":"Sounds good to me!  Should we do it to keep the same formatting of the file?","commit_id":"6aa22404be3b30766e0b1d7fd54dfb9fef6493fc"},{"author":{"_account_id":8978,"name":"Marek Denis","email":"marek.denis+openstack@gmail.com","username":"marek-denis"},"change_message_id":"d722724b6cd21d0a117b0b4440f1befbc7294593","unresolved":false,"context_lines":[{"line_number":105,"context_line":"        fernet_token \u003d six.binary_type(fernet_token)"},{"line_number":106,"context_line":""},{"line_number":107,"context_line":"        # Restore padding on token before decoding it"},{"line_number":108,"context_line":"        fernet_token \u003d TokenFormatter.restore_padding(fernet_token)"},{"line_number":109,"context_line":""},{"line_number":110,"context_line":"        # fernet tokens are base64 encoded, so we need to unpack them first"},{"line_number":111,"context_line":"        token_bytes \u003d base64.urlsafe_b64decode(fernet_token)"}],"source_content_type":"text/x-python","patch_set":3,"id":"da20952f_6de50136","line":108,"in_reply_to":"da20952f_f931130c","updated":"2015-09-07 11:38:25.000000000","message":"if you are constraining it to one class why not make it @staticmethod then?","commit_id":"6aa22404be3b30766e0b1d7fd54dfb9fef6493fc"}]}
