)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":12299,"name":"Paweł Koniszewski","email":"pawel.koniszewski@gmail.com","username":"pawel.koniszewski"},"change_message_id":"0871e8d4bb1c30d38c35283b2fd001848afc9caa","unresolved":false,"context_lines":[{"line_number":14,"context_line":"db_unload_metadefs"},{"line_number":15,"context_line":"db_export_metadefs"},{"line_number":16,"context_line":""},{"line_number":17,"context_line":"This tests also concerns json files stored in /glance/etc/metadefs."},{"line_number":18,"context_line":""},{"line_number":19,"context_line":"Change-Id: Ia288ec5e79487557166384f857b629c5e58f11f4"},{"line_number":20,"context_line":"Closes-Bug: #1373936"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":6,"id":"baa201ad_a5b32a09","line":17,"updated":"2014-10-09 20:57:26.000000000","message":"Is it still valid? I see that the only json used is a stub for tests.","commit_id":"bb0a82d70779eea335cfab5395b6d4a377ea5ebd"}],"glance/tests/etc/metadefs/TestDisplayName2.json":[{"author":{"_account_id":12299,"name":"Paweł Koniszewski","email":"pawel.koniszewski@gmail.com","username":"pawel.koniszewski"},"change_message_id":"52cb8c91fb41e161348b046a8b23d2ff7fd83b4d","unresolved":false,"context_lines":[{"line_number":3,"context_line":"    \"display_name\": \"TestDisplayName2\","},{"line_number":4,"context_line":"    \"description\": \"TestDescription2\","},{"line_number":5,"context_line":"    \"visibility\": \"public\","},{"line_number":6,"context_line":"    \"protected\": true,"},{"line_number":7,"context_line":"    \"resource_type_associations\": ["},{"line_number":8,"context_line":"        {"},{"line_number":9,"context_line":"            \"name\": \"TestAssociationName2\","}],"source_content_type":"application/json","patch_set":12,"id":"9aa7fdbe_4261c0d1","line":6,"updated":"2014-10-28 07:44:14.000000000","message":"Change this to \u0027false\u0027 please, so you can validate the insert of the boolean to DB.","commit_id":"8075ee9355e453604dfd88a40163e8d84b7bbd41"}],"glance/tests/functional/__init__.py":[{"author":{"_account_id":12299,"name":"Paweł Koniszewski","email":"pawel.koniszewski@gmail.com","username":"pawel.koniszewski"},"change_message_id":"0b2ae2f5d32da8cd9b5b36ef4bd8885c7dbc122c","unresolved":false,"context_lines":[{"line_number":565,"context_line":"        self.policy_file \u003d os.path.join(conf_dir, \u0027policy.json\u0027)"},{"line_number":566,"context_line":"        self.metadefs_dir \u003d os.path.join(conf_dir, \u0027metadefs\u0027)"},{"line_number":567,"context_line":"        utils.safe_mkdirs(self.metadefs_dir)"},{"line_number":568,"context_line":"        self.copy_metadefs_file(\u0027TestDisplayName.json\u0027,"},{"line_number":569,"context_line":"                                self.metadefs_dir)"},{"line_number":570,"context_line":"        self.metadefs_filepath \u003d os.path.join(self.metadefs_dir,"},{"line_number":571,"context_line":"                                              \u0027TestDisplayName.json\u0027)"}],"source_content_type":"text/x-python","patch_set":10,"id":"9aa7fdbe_ae3e2026","line":568,"updated":"2014-10-24 07:07:57.000000000","message":"I think that you should use wildcard (*) to copy all the .json files from metadefs directory","commit_id":"ad7e1a5e8be4b1c6a344f9bfb6469ad5c1c237a7"},{"author":{"_account_id":12299,"name":"Paweł Koniszewski","email":"pawel.koniszewski@gmail.com","username":"pawel.koniszewski"},"change_message_id":"0b2ae2f5d32da8cd9b5b36ef4bd8885c7dbc122c","unresolved":false,"context_lines":[{"line_number":567,"context_line":"        utils.safe_mkdirs(self.metadefs_dir)"},{"line_number":568,"context_line":"        self.copy_metadefs_file(\u0027TestDisplayName.json\u0027,"},{"line_number":569,"context_line":"                                self.metadefs_dir)"},{"line_number":570,"context_line":"        self.metadefs_filepath \u003d os.path.join(self.metadefs_dir,"},{"line_number":571,"context_line":"                                              \u0027TestDisplayName.json\u0027)"},{"line_number":572,"context_line":"        self.api_server \u003d ApiServer(self.test_dir,"},{"line_number":573,"context_line":"                                    self.api_port,"}],"source_content_type":"text/x-python","patch_set":10,"id":"9aa7fdbe_2e331064","line":570,"updated":"2014-10-24 07:07:57.000000000","message":"Small thing - it is a single metadef so it should be metadef_filepath","commit_id":"ad7e1a5e8be4b1c6a344f9bfb6469ad5c1c237a7"},{"author":{"_account_id":6159,"name":"Flavio Percoco Premoli","display_name":"flaper87","email":"flavio.percoco@flyrlabs.com","username":"flaper87"},"change_message_id":"f25899fd23e71b9d9facdb18ae3e92d6dfaccf48","unresolved":false,"context_lines":[{"line_number":873,"context_line":"        dst_file_name \u003d os.path.join(dst_dir, file_name)"},{"line_number":874,"context_line":"        return dst_file_name"},{"line_number":875,"context_line":""},{"line_number":876,"context_line":"    def copy_metadefs_files(self, file_name, dst_dir):"},{"line_number":877,"context_line":"        src_file_name \u003d os.path.join(\u0027glance/tests/etc/metadefs\u0027, file_name)"},{"line_number":878,"context_line":"        for f in glob.glob(src_file_name):"},{"line_number":879,"context_line":"            shutil.copy(f, dst_dir)"}],"source_content_type":"text/x-python","patch_set":24,"id":"7a2fa921_fce55308","line":876,"updated":"2015-10-09 11:27:29.000000000","message":"I think it\u0027d be better to change the `copu_data_file` function to accept a `src_dir` keyword. The default can be `glance/tests/etc`","commit_id":"a2b2891e2216574f8d883e4d38a0d82ef4b6fefb"}],"glance/tests/functional/test_glance_manage.py":[{"author":{"_account_id":12395,"name":"Roman Vasylets","email":"pomeo92@gmail.com","username":"rvasilets"},"change_message_id":"6450080e5fb0c21a795ab3e516cded94fb5d1a47","unresolved":false,"context_lines":[{"line_number":90,"context_line":"            \u0027CREATE TABLE image_properties\u0027 in out)"},{"line_number":91,"context_line":""},{"line_number":92,"context_line":"    def _assert_execute_no_error(self, exitcode, out, err):"},{"line_number":93,"context_line":"        self.assertEqual(exitcode, 0)"},{"line_number":94,"context_line":"        self.assertEqual(out, \u0027\u0027)"},{"line_number":95,"context_line":"        self.assertEqual(err, \u0027\u0027)"},{"line_number":96,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"baa201ad_5501a504","line":93,"updated":"2014-10-07 07:04:40.000000000","message":"You need to have the right order of parameters here due to https://bugs.launchpad.net/ceilometer/+bug/1277104/","commit_id":"00d9bc952c693ec2576af4e01c57e8d0040dfb33"},{"author":{"_account_id":12395,"name":"Roman Vasylets","email":"pomeo92@gmail.com","username":"rvasilets"},"change_message_id":"6450080e5fb0c21a795ab3e516cded94fb5d1a47","unresolved":false,"context_lines":[{"line_number":91,"context_line":""},{"line_number":92,"context_line":"    def _assert_execute_no_error(self, exitcode, out, err):"},{"line_number":93,"context_line":"        self.assertEqual(exitcode, 0)"},{"line_number":94,"context_line":"        self.assertEqual(out, \u0027\u0027)"},{"line_number":95,"context_line":"        self.assertEqual(err, \u0027\u0027)"},{"line_number":96,"context_line":""},{"line_number":97,"context_line":"    def _assert_count_metadefs_in_db(self):"}],"source_content_type":"text/x-python","patch_set":3,"id":"baa201ad_d80cec3d","line":94,"updated":"2014-10-07 07:04:40.000000000","message":"same as line 93","commit_id":"00d9bc952c693ec2576af4e01c57e8d0040dfb33"},{"author":{"_account_id":12395,"name":"Roman Vasylets","email":"pomeo92@gmail.com","username":"rvasilets"},"change_message_id":"6450080e5fb0c21a795ab3e516cded94fb5d1a47","unresolved":false,"context_lines":[{"line_number":92,"context_line":"    def _assert_execute_no_error(self, exitcode, out, err):"},{"line_number":93,"context_line":"        self.assertEqual(exitcode, 0)"},{"line_number":94,"context_line":"        self.assertEqual(out, \u0027\u0027)"},{"line_number":95,"context_line":"        self.assertEqual(err, \u0027\u0027)"},{"line_number":96,"context_line":""},{"line_number":97,"context_line":"    def _assert_count_metadefs_in_db(self):"},{"line_number":98,"context_line":"        db_dict \u003d {"}],"source_content_type":"text/x-python","patch_set":3,"id":"baa201ad_b8072817","line":95,"updated":"2014-10-07 07:04:40.000000000","message":"same as line 93","commit_id":"00d9bc952c693ec2576af4e01c57e8d0040dfb33"},{"author":{"_account_id":12395,"name":"Roman Vasylets","email":"pomeo92@gmail.com","username":"rvasilets"},"change_message_id":"6450080e5fb0c21a795ab3e516cded94fb5d1a47","unresolved":false,"context_lines":[{"line_number":142,"context_line":"                    for attribute_key, attribute_value in \\"},{"line_number":143,"context_line":"                            property_value.items():"},{"line_number":144,"context_line":"                        self.assertEqual(attribute_value, db_record["},{"line_number":145,"context_line":"                            attribute_key])"},{"line_number":146,"context_line":"                    i +\u003d 1"},{"line_number":147,"context_line":"            elif key \u003d\u003d \u0027objects\u0027:"},{"line_number":148,"context_line":"                i \u003d 0"}],"source_content_type":"text/x-python","patch_set":3,"id":"baa201ad_b81e485d","line":145,"updated":"2014-10-07 07:04:40.000000000","message":"same as line 93","commit_id":"00d9bc952c693ec2576af4e01c57e8d0040dfb33"},{"author":{"_account_id":12395,"name":"Roman Vasylets","email":"pomeo92@gmail.com","username":"rvasilets"},"change_message_id":"6450080e5fb0c21a795ab3e516cded94fb5d1a47","unresolved":false,"context_lines":[{"line_number":152,"context_line":"                    for attribute_key, attribute_value in \\"},{"line_number":153,"context_line":"                            json_record[\u0027properties\u0027].items():"},{"line_number":154,"context_line":"                        self.assertEqual(attribute_value, db_record["},{"line_number":155,"context_line":"                            attribute_key])"},{"line_number":156,"context_line":"                    i +\u003d 1"},{"line_number":157,"context_line":"            elif key \u003d\u003d \u0027resource_type_associations\u0027:"},{"line_number":158,"context_line":"                for k, v in value[0].items():"}],"source_content_type":"text/x-python","patch_set":3,"id":"baa201ad_383258f2","line":155,"updated":"2014-10-07 07:04:40.000000000","message":"same as line 93","commit_id":"00d9bc952c693ec2576af4e01c57e8d0040dfb33"},{"author":{"_account_id":12395,"name":"Roman Vasylets","email":"pomeo92@gmail.com","username":"rvasilets"},"change_message_id":"6450080e5fb0c21a795ab3e516cded94fb5d1a47","unresolved":false,"context_lines":[{"line_number":176,"context_line":"                            self.assertEqual(dict_row[\u0027id\u0027],"},{"line_number":177,"context_line":"                                             table_names[\u0027metadef_namespace_\u0027"},{"line_number":178,"context_line":"                                                         \u0027resource_types\u0027]"},{"line_number":179,"context_line":"                                             [\u0027resource_type_id\u0027])"},{"line_number":180,"context_line":"            else:"},{"line_number":181,"context_line":"                self.assertEqual(value, table_names[\u0027metadef_namespaces\u0027][key])"},{"line_number":182,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"baa201ad_b85568fb","line":179,"updated":"2014-10-07 07:04:40.000000000","message":"same as line 93","commit_id":"00d9bc952c693ec2576af4e01c57e8d0040dfb33"},{"author":{"_account_id":12299,"name":"Paweł Koniszewski","email":"pawel.koniszewski@gmail.com","username":"pawel.koniszewski"},"change_message_id":"722e08d582751e7604d4f37460b4cc7c98dd389e","unresolved":false,"context_lines":[{"line_number":103,"context_line":"            \u0027metadef_properties\u0027: 0"},{"line_number":104,"context_line":"        }"},{"line_number":105,"context_line":"        with sqlite3.connect(self.db_filepath) as conn:"},{"line_number":106,"context_line":"            for table_name, number in db_dict.items():"},{"line_number":107,"context_line":"                cursor \u003d conn.cursor()"},{"line_number":108,"context_line":"                cursor.execute(\u0027\u0027.join([\u0027SELECT count(*) FROM \u0027, table_name]))"},{"line_number":109,"context_line":"                row \u003d cursor.fetchone()"}],"source_content_type":"text/x-python","patch_set":5,"id":"baa201ad_09e433aa","line":106,"updated":"2014-10-08 21:46:02.000000000","message":"Use six.iteritems() instead of items()","commit_id":"5407877e71e7ff71086418b2a31b276c459ee428"},{"author":{"_account_id":12299,"name":"Paweł Koniszewski","email":"pawel.koniszewski@gmail.com","username":"pawel.koniszewski"},"change_message_id":"722e08d582751e7604d4f37460b4cc7c98dd389e","unresolved":false,"context_lines":[{"line_number":134,"context_line":"                                                    False)"},{"line_number":135,"context_line":""},{"line_number":136,"context_line":"    def _compare_json_file_with_db(self, metadata, table_names, expected_json):"},{"line_number":137,"context_line":"        for key, value in metadata.items():"},{"line_number":138,"context_line":"            if key \u003d\u003d \u0027properties\u0027:"},{"line_number":139,"context_line":"                i \u003d 0"},{"line_number":140,"context_line":"                for property_key, property_value in value.items():"}],"source_content_type":"text/x-python","patch_set":5,"id":"baa201ad_6c322da8","line":137,"updated":"2014-10-08 21:46:02.000000000","message":"six.iteritems","commit_id":"5407877e71e7ff71086418b2a31b276c459ee428"},{"author":{"_account_id":12299,"name":"Paweł Koniszewski","email":"pawel.koniszewski@gmail.com","username":"pawel.koniszewski"},"change_message_id":"722e08d582751e7604d4f37460b4cc7c98dd389e","unresolved":false,"context_lines":[{"line_number":137,"context_line":"        for key, value in metadata.items():"},{"line_number":138,"context_line":"            if key \u003d\u003d \u0027properties\u0027:"},{"line_number":139,"context_line":"                i \u003d 0"},{"line_number":140,"context_line":"                for property_key, property_value in value.items():"},{"line_number":141,"context_line":"                    db_record \u003d json.loads(table_names["},{"line_number":142,"context_line":"                        \u0027metadef_properties\u0027][i][3])"},{"line_number":143,"context_line":"                    for attribute_key, attribute_value in \\"}],"source_content_type":"text/x-python","patch_set":5,"id":"baa201ad_a9ea4771","line":140,"updated":"2014-10-08 21:46:02.000000000","message":"six.iteritems","commit_id":"5407877e71e7ff71086418b2a31b276c459ee428"},{"author":{"_account_id":12299,"name":"Paweł Koniszewski","email":"pawel.koniszewski@gmail.com","username":"pawel.koniszewski"},"change_message_id":"722e08d582751e7604d4f37460b4cc7c98dd389e","unresolved":false,"context_lines":[{"line_number":141,"context_line":"                    db_record \u003d json.loads(table_names["},{"line_number":142,"context_line":"                        \u0027metadef_properties\u0027][i][3])"},{"line_number":143,"context_line":"                    for attribute_key, attribute_value in \\"},{"line_number":144,"context_line":"                            property_value.items():"},{"line_number":145,"context_line":"                        if expected_json is True:"},{"line_number":146,"context_line":"                            self.assertEqual(attribute_value, db_record["},{"line_number":147,"context_line":"                                attribute_key])"}],"source_content_type":"text/x-python","patch_set":5,"id":"baa201ad_6cd6ad50","line":144,"updated":"2014-10-08 21:46:02.000000000","message":"six.iteritems","commit_id":"5407877e71e7ff71086418b2a31b276c459ee428"},{"author":{"_account_id":12299,"name":"Paweł Koniszewski","email":"pawel.koniszewski@gmail.com","username":"pawel.koniszewski"},"change_message_id":"722e08d582751e7604d4f37460b4cc7c98dd389e","unresolved":false,"context_lines":[{"line_number":143,"context_line":"                    for attribute_key, attribute_value in \\"},{"line_number":144,"context_line":"                            property_value.items():"},{"line_number":145,"context_line":"                        if expected_json is True:"},{"line_number":146,"context_line":"                            self.assertEqual(attribute_value, db_record["},{"line_number":147,"context_line":"                                attribute_key])"},{"line_number":148,"context_line":"                        else:"},{"line_number":149,"context_line":"                            self.assertEqual(db_record[attribute_key],"}],"source_content_type":"text/x-python","patch_set":5,"id":"baa201ad_ecf61dd6","line":146,"updated":"2014-10-08 21:46:02.000000000","message":"I don\u0027t think that we need to stick to correct order of parameters in this case... This is getting horrible...","commit_id":"5407877e71e7ff71086418b2a31b276c459ee428"},{"author":{"_account_id":12299,"name":"Paweł Koniszewski","email":"pawel.koniszewski@gmail.com","username":"pawel.koniszewski"},"change_message_id":"722e08d582751e7604d4f37460b4cc7c98dd389e","unresolved":false,"context_lines":[{"line_number":155,"context_line":"                    db_record \u003d json.loads(table_names["},{"line_number":156,"context_line":"                        \u0027metadef_objects\u0027][i][5])"},{"line_number":157,"context_line":"                    for attribute_key, attribute_value in \\"},{"line_number":158,"context_line":"                            json_record[\u0027properties\u0027].items():"},{"line_number":159,"context_line":"                        if expected_json \u003d\u003d True:"},{"line_number":160,"context_line":"                            self.assertEqual(attribute_value, db_record["},{"line_number":161,"context_line":"                                attribute_key])"}],"source_content_type":"text/x-python","patch_set":5,"id":"baa201ad_8c25915d","line":158,"updated":"2014-10-08 21:46:02.000000000","message":"six.iteritems","commit_id":"5407877e71e7ff71086418b2a31b276c459ee428"},{"author":{"_account_id":12299,"name":"Paweł Koniszewski","email":"pawel.koniszewski@gmail.com","username":"pawel.koniszewski"},"change_message_id":"722e08d582751e7604d4f37460b4cc7c98dd389e","unresolved":false,"context_lines":[{"line_number":156,"context_line":"                        \u0027metadef_objects\u0027][i][5])"},{"line_number":157,"context_line":"                    for attribute_key, attribute_value in \\"},{"line_number":158,"context_line":"                            json_record[\u0027properties\u0027].items():"},{"line_number":159,"context_line":"                        if expected_json \u003d\u003d True:"},{"line_number":160,"context_line":"                            self.assertEqual(attribute_value, db_record["},{"line_number":161,"context_line":"                                attribute_key])"},{"line_number":162,"context_line":"                        else:"}],"source_content_type":"text/x-python","patch_set":5,"id":"baa201ad_4c50090b","line":159,"updated":"2014-10-08 21:46:02.000000000","message":"if expected_json: is enough, but this correct order of parameters for assertEqual is not needed here IMHO...","commit_id":"5407877e71e7ff71086418b2a31b276c459ee428"},{"author":{"_account_id":12299,"name":"Paweł Koniszewski","email":"pawel.koniszewski@gmail.com","username":"pawel.koniszewski"},"change_message_id":"722e08d582751e7604d4f37460b4cc7c98dd389e","unresolved":false,"context_lines":[{"line_number":164,"context_line":"                                             attribute_value)"},{"line_number":165,"context_line":"                    i +\u003d 1"},{"line_number":166,"context_line":"            elif key \u003d\u003d \u0027resource_type_associations\u0027:"},{"line_number":167,"context_line":"                for k, v in value[0].items():"},{"line_number":168,"context_line":"                    # NOTE(bfic): there is a bug related to"},{"line_number":169,"context_line":"                    # exporting metadata"},{"line_number":170,"context_line":"                    # attribute \u0027protected\u0027 shouldnt be written"}],"source_content_type":"text/x-python","patch_set":5,"id":"baa201ad_09fb5347","line":167,"updated":"2014-10-08 21:46:02.000000000","message":"six.iteritems","commit_id":"5407877e71e7ff71086418b2a31b276c459ee428"},{"author":{"_account_id":12299,"name":"Paweł Koniszewski","email":"pawel.koniszewski@gmail.com","username":"pawel.koniszewski"},"change_message_id":"722e08d582751e7604d4f37460b4cc7c98dd389e","unresolved":false,"context_lines":[{"line_number":169,"context_line":"                    # exporting metadata"},{"line_number":170,"context_line":"                    # attribute \u0027protected\u0027 shouldnt be written"},{"line_number":171,"context_line":"                    # in json file because there isn\u0027t such"},{"line_number":172,"context_line":"                    # attribute in db record like \u0027protected\u0027"},{"line_number":173,"context_line":"                    if k !\u003d \u0027protected\u0027:"},{"line_number":174,"context_line":"                        if k !\u003d \u0027name\u0027:"},{"line_number":175,"context_line":"                            if expected_json is True:"}],"source_content_type":"text/x-python","patch_set":5,"id":"baa201ad_09051313","line":172,"updated":"2014-10-08 21:46:02.000000000","message":"Shouldnt this be fixed here? Or make another patch and set dependency on patch that fixes bugs found by these tests. I would like to see these tests failing for some good reason (invalid attribute saved in .json is one of good reasons).","commit_id":"5407877e71e7ff71086418b2a31b276c459ee428"},{"author":{"_account_id":12299,"name":"Paweł Koniszewski","email":"pawel.koniszewski@gmail.com","username":"pawel.koniszewski"},"change_message_id":"722e08d582751e7604d4f37460b4cc7c98dd389e","unresolved":false,"context_lines":[{"line_number":209,"context_line":"                       \u0027metadef_objects\u0027: None,"},{"line_number":210,"context_line":"                       \u0027metadef_properties\u0027: None}"},{"line_number":211,"context_line":"        with sqlite3.connect(self.db_filepath) as conn:"},{"line_number":212,"context_line":"            for table_name, value in table_names.items():"},{"line_number":213,"context_line":"                cursor \u003d conn.cursor()"},{"line_number":214,"context_line":"                cursor.execute(\u0027\u0027.join([\u0027SELECT * FROM \u0027, table_name]))"},{"line_number":215,"context_line":"                if table_name \u003d\u003d \u0027metadef_objects\u0027 or \\"}],"source_content_type":"text/x-python","patch_set":5,"id":"baa201ad_4c02c90a","line":212,"updated":"2014-10-08 21:46:02.000000000","message":"six.iteritems","commit_id":"5407877e71e7ff71086418b2a31b276c459ee428"},{"author":{"_account_id":12299,"name":"Paweł Koniszewski","email":"pawel.koniszewski@gmail.com","username":"pawel.koniszewski"},"change_message_id":"722e08d582751e7604d4f37460b4cc7c98dd389e","unresolved":false,"context_lines":[{"line_number":212,"context_line":"            for table_name, value in table_names.items():"},{"line_number":213,"context_line":"                cursor \u003d conn.cursor()"},{"line_number":214,"context_line":"                cursor.execute(\u0027\u0027.join([\u0027SELECT * FROM \u0027, table_name]))"},{"line_number":215,"context_line":"                if table_name \u003d\u003d \u0027metadef_objects\u0027 or \\"},{"line_number":216,"context_line":"                        table_name \u003d\u003d \u0027metadef_properties\u0027:"},{"line_number":217,"context_line":"                    rows \u003d cursor.fetchall()"},{"line_number":218,"context_line":"                    table_names[table_name] \u003d rows"}],"source_content_type":"text/x-python","patch_set":5,"id":"baa201ad_0c1c4169","line":215,"updated":"2014-10-08 21:46:02.000000000","message":"use parenthesis instead of backslash","commit_id":"5407877e71e7ff71086418b2a31b276c459ee428"},{"author":{"_account_id":12299,"name":"Paweł Koniszewski","email":"pawel.koniszewski@gmail.com","username":"pawel.koniszewski"},"change_message_id":"2bc19f6e187bbbb34f377b1cb24295bc3cbf56b4","unresolved":false,"context_lines":[{"line_number":15,"context_line":""},{"line_number":16,"context_line":"\"\"\"Functional test cases for glance-manage\"\"\""},{"line_number":17,"context_line":""},{"line_number":18,"context_line":"import six"},{"line_number":19,"context_line":""},{"line_number":20,"context_line":"import json"},{"line_number":21,"context_line":"import os"}],"source_content_type":"text/x-python","patch_set":6,"id":"baa201ad_22a9f024","line":18,"updated":"2014-10-09 20:53:06.000000000","message":"Import order: stdlib imports, then third party lib imports and then project imports","commit_id":"bb0a82d70779eea335cfab5395b6d4a377ea5ebd"},{"author":{"_account_id":12299,"name":"Paweł Koniszewski","email":"pawel.koniszewski@gmail.com","username":"pawel.koniszewski"},"change_message_id":"2bc19f6e187bbbb34f377b1cb24295bc3cbf56b4","unresolved":false,"context_lines":[{"line_number":136,"context_line":"                        source_metadata \u003d json.load(source_json_file)"},{"line_number":137,"context_line":"                        self.assertEqual(exported_metadata, source_metadata)"},{"line_number":138,"context_line":""},{"line_number":139,"context_line":"    def _compare_json_file_with_db(self, metadata, table_names):"},{"line_number":140,"context_line":"        for key, value in six.iteritems(metadata):"},{"line_number":141,"context_line":"            if key \u003d\u003d \u0027properties\u0027:"},{"line_number":142,"context_line":"                i \u003d 0"}],"source_content_type":"text/x-python","patch_set":6,"id":"baa201ad_62177855","line":139,"updated":"2014-10-09 20:53:06.000000000","message":"Can we split this method so it will compare one table with data under one key in json? We would get rid of these \"if key \u003d\u003d ...\" clauses. Also code would be easier to understand.","commit_id":"bb0a82d70779eea335cfab5395b6d4a377ea5ebd"},{"author":{"_account_id":12299,"name":"Paweł Koniszewski","email":"pawel.koniszewski@gmail.com","username":"pawel.koniszewski"},"change_message_id":"2bc19f6e187bbbb34f377b1cb24295bc3cbf56b4","unresolved":false,"context_lines":[{"line_number":139,"context_line":"    def _compare_json_file_with_db(self, metadata, table_names):"},{"line_number":140,"context_line":"        for key, value in six.iteritems(metadata):"},{"line_number":141,"context_line":"            if key \u003d\u003d \u0027properties\u0027:"},{"line_number":142,"context_line":"                i \u003d 0"},{"line_number":143,"context_line":"                for property_key, property_value in six.iteritems(value):"},{"line_number":144,"context_line":"                    db_record \u003d json.loads(table_names["},{"line_number":145,"context_line":"                        \u0027metadef_properties\u0027][i][3])"}],"source_content_type":"text/x-python","patch_set":6,"id":"baa201ad_a56deace","line":142,"updated":"2014-10-09 20:53:06.000000000","message":"Can you change \u0027i\u0027 to enumerate over six.iteritems(value)?\n\na, (b, c) \u003d enumerate(six.iteritems(value))\n\nor just iterate through table_names[...] ?","commit_id":"bb0a82d70779eea335cfab5395b6d4a377ea5ebd"},{"author":{"_account_id":12299,"name":"Paweł Koniszewski","email":"pawel.koniszewski@gmail.com","username":"pawel.koniszewski"},"change_message_id":"2bc19f6e187bbbb34f377b1cb24295bc3cbf56b4","unresolved":false,"context_lines":[{"line_number":142,"context_line":"                i \u003d 0"},{"line_number":143,"context_line":"                for property_key, property_value in six.iteritems(value):"},{"line_number":144,"context_line":"                    db_record \u003d json.loads(table_names["},{"line_number":145,"context_line":"                        \u0027metadef_properties\u0027][i][3])"},{"line_number":146,"context_line":"                    for attribute_key, attribute_value in \\"},{"line_number":147,"context_line":"                            six.iteritems(property_value):"},{"line_number":148,"context_line":"                        self.assertEqual(attribute_value, db_record["}],"source_content_type":"text/x-python","patch_set":6,"id":"baa201ad_0547961e","line":145,"updated":"2014-10-09 20:53:06.000000000","message":"Can you please add comments what is this and what is value[0] and what is table_names[\u0027metadef_objects\u0027][i][5]? I mean that [0], [3] and [5] does not mean anything to folk who is reading the code.","commit_id":"bb0a82d70779eea335cfab5395b6d4a377ea5ebd"},{"author":{"_account_id":12299,"name":"Paweł Koniszewski","email":"pawel.koniszewski@gmail.com","username":"pawel.koniszewski"},"change_message_id":"2bc19f6e187bbbb34f377b1cb24295bc3cbf56b4","unresolved":false,"context_lines":[{"line_number":149,"context_line":"                            attribute_key])"},{"line_number":150,"context_line":"                    i +\u003d 1"},{"line_number":151,"context_line":"            elif key \u003d\u003d \u0027objects\u0027:"},{"line_number":152,"context_line":"                i \u003d 0"},{"line_number":153,"context_line":"                for json_record in value:"},{"line_number":154,"context_line":"                    db_record \u003d json.loads(table_names["},{"line_number":155,"context_line":"                        \u0027metadef_objects\u0027][i][5])"}],"source_content_type":"text/x-python","patch_set":6,"id":"baa201ad_2561fad3","line":152,"updated":"2014-10-09 20:53:06.000000000","message":"ditto (iterate)","commit_id":"bb0a82d70779eea335cfab5395b6d4a377ea5ebd"},{"author":{"_account_id":12299,"name":"Paweł Koniszewski","email":"pawel.koniszewski@gmail.com","username":"pawel.koniszewski"},"change_message_id":"2bc19f6e187bbbb34f377b1cb24295bc3cbf56b4","unresolved":false,"context_lines":[{"line_number":152,"context_line":"                i \u003d 0"},{"line_number":153,"context_line":"                for json_record in value:"},{"line_number":154,"context_line":"                    db_record \u003d json.loads(table_names["},{"line_number":155,"context_line":"                        \u0027metadef_objects\u0027][i][5])"},{"line_number":156,"context_line":"                    for attribute_key, attribute_value in \\"},{"line_number":157,"context_line":"                            six.iteritems(json_record[\u0027properties\u0027]):"},{"line_number":158,"context_line":"                        self.assertEqual(attribute_value, db_record["}],"source_content_type":"text/x-python","patch_set":6,"id":"baa201ad_455efe13","line":155,"updated":"2014-10-09 20:53:06.000000000","message":"ditto (comment)","commit_id":"bb0a82d70779eea335cfab5395b6d4a377ea5ebd"},{"author":{"_account_id":12299,"name":"Paweł Koniszewski","email":"pawel.koniszewski@gmail.com","username":"pawel.koniszewski"},"change_message_id":"2bc19f6e187bbbb34f377b1cb24295bc3cbf56b4","unresolved":false,"context_lines":[{"line_number":159,"context_line":"                            attribute_key])"},{"line_number":160,"context_line":"                    i +\u003d 1"},{"line_number":161,"context_line":"            elif key \u003d\u003d \u0027resource_type_associations\u0027:"},{"line_number":162,"context_line":"                for k, v in six.iteritems(value[0]):"},{"line_number":163,"context_line":"                    if k !\u003d \u0027name\u0027:"},{"line_number":164,"context_line":"                        self.assertEqual(v, table_names["},{"line_number":165,"context_line":"                            \u0027metadef_namespace_resource_types\u0027][k])"}],"source_content_type":"text/x-python","patch_set":6,"id":"baa201ad_25b81a2a","line":162,"updated":"2014-10-09 20:53:06.000000000","message":"ditto (comment)","commit_id":"bb0a82d70779eea335cfab5395b6d4a377ea5ebd"},{"author":{"_account_id":12299,"name":"Paweł Koniszewski","email":"pawel.koniszewski@gmail.com","username":"pawel.koniszewski"},"change_message_id":"2bc19f6e187bbbb34f377b1cb24295bc3cbf56b4","unresolved":false,"context_lines":[{"line_number":163,"context_line":"                    if k !\u003d \u0027name\u0027:"},{"line_number":164,"context_line":"                        self.assertEqual(v, table_names["},{"line_number":165,"context_line":"                            \u0027metadef_namespace_resource_types\u0027][k])"},{"line_number":166,"context_line":"                    else:"},{"line_number":167,"context_line":"                        with sqlite3.connect(self.db_filepath) as conn:"},{"line_number":168,"context_line":"                            cursor \u003d conn.cursor()"},{"line_number":169,"context_line":"                            cursor.execute(\u0027SELECT id FROM \u0027"}],"source_content_type":"text/x-python","patch_set":6,"id":"baa201ad_e51e120d","line":166,"updated":"2014-10-09 20:53:06.000000000","message":"What this else is used for? It looks like you compare data from DB with data from DB (data that you selected the same way twice)","commit_id":"bb0a82d70779eea335cfab5395b6d4a377ea5ebd"},{"author":{"_account_id":12395,"name":"Roman Vasylets","email":"pomeo92@gmail.com","username":"rvasilets"},"change_message_id":"d09bfc15cc382b7aaa167c7cbc16fed0345a124c","unresolved":false,"context_lines":[{"line_number":171,"context_line":"                                           \u0027name \u003d \\\u0027{0}\\\u0027\u0027.format(v))"},{"line_number":172,"context_line":"                            row \u003d cursor.fetchone()"},{"line_number":173,"context_line":"                            dict_row \u003d self.dict_factory(cursor, row)"},{"line_number":174,"context_line":"                        self.assertEqual(dict_row[\u0027id\u0027], table_names["},{"line_number":175,"context_line":"                            \u0027metadef_namespace_resource_types\u0027]["},{"line_number":176,"context_line":"                            \u0027resource_type_id\u0027])"},{"line_number":177,"context_line":"            else:"}],"source_content_type":"text/x-python","patch_set":6,"id":"baa201ad_7349fd8d","line":174,"updated":"2014-10-10 10:31:29.000000000","message":"I thought that here is wrong order of parameter because table_names is a parameter of the function so maybe it\u0027s expected value","commit_id":"bb0a82d70779eea335cfab5395b6d4a377ea5ebd"},{"author":{"_account_id":12299,"name":"Paweł Koniszewski","email":"pawel.koniszewski@gmail.com","username":"pawel.koniszewski"},"change_message_id":"2bc19f6e187bbbb34f377b1cb24295bc3cbf56b4","unresolved":false,"context_lines":[{"line_number":177,"context_line":"            else:"},{"line_number":178,"context_line":"                self.assertEqual(value, table_names[\u0027metadef_namespaces\u0027][key])"},{"line_number":179,"context_line":""},{"line_number":180,"context_line":"    def _get_metadef_tables_from_sqlite_db(self):"},{"line_number":181,"context_line":"        table_names \u003d {\u0027metadef_namespace_resource_types\u0027: None,"},{"line_number":182,"context_line":"                       \u0027metadef_namespaces\u0027: None,"},{"line_number":183,"context_line":"                       \u0027metadef_objects\u0027: None,"}],"source_content_type":"text/x-python","patch_set":6,"id":"baa201ad_824e1c95","line":180,"updated":"2014-10-09 20:53:06.000000000","message":"Can we split this method to method per table? So we won\u0027t make any if-else clauses to determine if we need to fetch one or fetch many.","commit_id":"bb0a82d70779eea335cfab5395b6d4a377ea5ebd"},{"author":{"_account_id":12299,"name":"Paweł Koniszewski","email":"pawel.koniszewski@gmail.com","username":"pawel.koniszewski"},"change_message_id":"2bc19f6e187bbbb34f377b1cb24295bc3cbf56b4","unresolved":false,"context_lines":[{"line_number":183,"context_line":"                       \u0027metadef_objects\u0027: None,"},{"line_number":184,"context_line":"                       \u0027metadef_properties\u0027: None}"},{"line_number":185,"context_line":"        with sqlite3.connect(self.db_filepath) as conn:"},{"line_number":186,"context_line":"            for table_name, value in six.iteritems(table_names):"},{"line_number":187,"context_line":"                cursor \u003d conn.cursor()"},{"line_number":188,"context_line":"                cursor.execute(\u0027\u0027.join([\u0027SELECT * FROM \u0027, table_name]))"},{"line_number":189,"context_line":"                if (table_name \u003d\u003d \u0027metadef_objects\u0027 or"}],"source_content_type":"text/x-python","patch_set":6,"id":"baa201ad_62305808","line":186,"updated":"2014-10-09 20:53:06.000000000","message":"Value is not used, do you need to iterate over dictionary? List should be enough","commit_id":"bb0a82d70779eea335cfab5395b6d4a377ea5ebd"},{"author":{"_account_id":12299,"name":"Paweł Koniszewski","email":"pawel.koniszewski@gmail.com","username":"pawel.koniszewski"},"change_message_id":"20458e635ba1a627325cd1952c0dc3e8cdaa8fed","unresolved":false,"context_lines":[{"line_number":98,"context_line":"        self.assertEqual(\u0027\u0027, err)"},{"line_number":99,"context_line":""},{"line_number":100,"context_line":"    def _assert_count_metadefs_in_db(self):"},{"line_number":101,"context_line":"        db_dict \u003d {"},{"line_number":102,"context_line":"            \u0027metadef_namespace_resource_types\u0027: 0,"},{"line_number":103,"context_line":"            \u0027metadef_namespaces\u0027: 0,"},{"line_number":104,"context_line":"            \u0027metadef_objects\u0027: 0,"}],"source_content_type":"text/x-python","patch_set":7,"id":"baa201ad_aa474a4a","line":101,"updated":"2014-10-12 12:04:41.000000000","message":"Why do you need dict here?","commit_id":"7c88886944cd4393214aabc2508b3779f9d856a9"},{"author":{"_account_id":12299,"name":"Paweł Koniszewski","email":"pawel.koniszewski@gmail.com","username":"pawel.koniszewski"},"change_message_id":"20458e635ba1a627325cd1952c0dc3e8cdaa8fed","unresolved":false,"context_lines":[{"line_number":203,"context_line":"        self._validate_namespace(metadata, table_names[\u0027metadef_namespaces\u0027])"},{"line_number":204,"context_line":""},{"line_number":205,"context_line":"    def _get_metadef_tables_from_sqlite_db(self):"},{"line_number":206,"context_line":"        table_names \u003d {\u0027metadef_namespace_resource_types\u0027: None,"},{"line_number":207,"context_line":"                       \u0027metadef_namespaces\u0027: None,"},{"line_number":208,"context_line":"                       \u0027metadef_objects\u0027: None,"},{"line_number":209,"context_line":"                       \u0027metadef_properties\u0027: None}"}],"source_content_type":"text/x-python","patch_set":7,"id":"baa201ad_aab58a32","line":206,"updated":"2014-10-12 12:04:41.000000000","message":"This name \u0027table_names\u0027 is confusing. It contains more than just table names.","commit_id":"7c88886944cd4393214aabc2508b3779f9d856a9"},{"author":{"_account_id":12299,"name":"Paweł Koniszewski","email":"pawel.koniszewski@gmail.com","username":"pawel.koniszewski"},"change_message_id":"20458e635ba1a627325cd1952c0dc3e8cdaa8fed","unresolved":false,"context_lines":[{"line_number":208,"context_line":"                       \u0027metadef_objects\u0027: None,"},{"line_number":209,"context_line":"                       \u0027metadef_properties\u0027: None}"},{"line_number":210,"context_line":""},{"line_number":211,"context_line":"        table_names \u003d self._get_associations_from_sqlite(table_names)"},{"line_number":212,"context_line":"        table_names \u003d self._get_namespaces_from_sqlite(table_names)"},{"line_number":213,"context_line":"        table_names \u003d self._get_objects_from_sqlite(table_names)"},{"line_number":214,"context_line":"        table_names \u003d self._get_properties_from_sqlite(table_names)"}],"source_content_type":"text/x-python","patch_set":7,"id":"baa201ad_8ae60643","line":211,"updated":"2014-10-12 12:04:41.000000000","message":"No need to assign new value to \u0027table_names\u0027.","commit_id":"7c88886944cd4393214aabc2508b3779f9d856a9"},{"author":{"_account_id":12299,"name":"Paweł Koniszewski","email":"pawel.koniszewski@gmail.com","username":"pawel.koniszewski"},"change_message_id":"20458e635ba1a627325cd1952c0dc3e8cdaa8fed","unresolved":false,"context_lines":[{"line_number":215,"context_line":""},{"line_number":216,"context_line":"        return table_names"},{"line_number":217,"context_line":""},{"line_number":218,"context_line":"    def _get_associations_from_sqlite(self, table_names):"},{"line_number":219,"context_line":"        table_name \u003d \u0027metadef_namespace_resource_types\u0027"},{"line_number":220,"context_line":"        with sqlite3.connect(self.db_filepath) as conn:"},{"line_number":221,"context_line":"            cursor \u003d conn.cursor()"}],"source_content_type":"text/x-python","patch_set":7,"id":"baa201ad_aabaea07","line":218,"updated":"2014-10-12 12:04:41.000000000","message":"Why you can\u0027t use fetchall() in every \u0027get\u0027 method? You would reduce some code here.","commit_id":"7c88886944cd4393214aabc2508b3779f9d856a9"},{"author":{"_account_id":12299,"name":"Paweł Koniszewski","email":"pawel.koniszewski@gmail.com","username":"pawel.koniszewski"},"change_message_id":"20458e635ba1a627325cd1952c0dc3e8cdaa8fed","unresolved":false,"context_lines":[{"line_number":216,"context_line":"        return table_names"},{"line_number":217,"context_line":""},{"line_number":218,"context_line":"    def _get_associations_from_sqlite(self, table_names):"},{"line_number":219,"context_line":"        table_name \u003d \u0027metadef_namespace_resource_types\u0027"},{"line_number":220,"context_line":"        with sqlite3.connect(self.db_filepath) as conn:"},{"line_number":221,"context_line":"            cursor \u003d conn.cursor()"},{"line_number":222,"context_line":"            cursor.execute(\u0027\u0027.join([\u0027SELECT * FROM \u0027, table_name]))"}],"source_content_type":"text/x-python","patch_set":7,"id":"baa201ad_8ab8c62b","line":219,"updated":"2014-10-12 12:04:41.000000000","message":"You use table names in many places. Can you move it outside the class?","commit_id":"7c88886944cd4393214aabc2508b3779f9d856a9"},{"author":{"_account_id":12299,"name":"Paweł Koniszewski","email":"pawel.koniszewski@gmail.com","username":"pawel.koniszewski"},"change_message_id":"20458e635ba1a627325cd1952c0dc3e8cdaa8fed","unresolved":false,"context_lines":[{"line_number":221,"context_line":"            cursor \u003d conn.cursor()"},{"line_number":222,"context_line":"            cursor.execute(\u0027\u0027.join([\u0027SELECT * FROM \u0027, table_name]))"},{"line_number":223,"context_line":"            row \u003d cursor.fetchone()"},{"line_number":224,"context_line":"            dict_row \u003d self.dict_factory(cursor, row)"},{"line_number":225,"context_line":"            table_names[table_name] \u003d dict_row"},{"line_number":226,"context_line":"            return table_names"},{"line_number":227,"context_line":""}],"source_content_type":"text/x-python","patch_set":7,"id":"baa201ad_ca364eb4","line":224,"updated":"2014-10-12 12:04:41.000000000","message":"Is this needed only because you use fetchone here?","commit_id":"7c88886944cd4393214aabc2508b3779f9d856a9"},{"author":{"_account_id":12299,"name":"Paweł Koniszewski","email":"pawel.koniszewski@gmail.com","username":"pawel.koniszewski"},"change_message_id":"20458e635ba1a627325cd1952c0dc3e8cdaa8fed","unresolved":false,"context_lines":[{"line_number":277,"context_line":""},{"line_number":278,"context_line":"    @depends_on_exe(\u0027sqlite3\u0027)"},{"line_number":279,"context_line":"    @skip_if_disabled"},{"line_number":280,"context_line":"    def test_metadefs_lifecycle(self):"},{"line_number":281,"context_line":"        # executing db_sync to create database"},{"line_number":282,"context_line":"        self._sync_db(True)"},{"line_number":283,"context_line":""}],"source_content_type":"text/x-python","patch_set":7,"id":"baa201ad_6aaba2d6","line":280,"updated":"2014-10-12 12:04:41.000000000","message":"This lifecycle is a little bit confusing to me. What you do is:\nload -\u003e unload -\u003e load -\u003e export\n\nSuch cycle does not test e.g. this https://bugs.launchpad.net/glance/+bug/1367771\n\nI\u0027d rather go for something like:\n\nload -\u003e export -\u003e load -\u003e unload\n\nAnother thing is that second load should also be tested.","commit_id":"7c88886944cd4393214aabc2508b3779f9d856a9"},{"author":{"_account_id":12299,"name":"Paweł Koniszewski","email":"pawel.koniszewski@gmail.com","username":"pawel.koniszewski"},"change_message_id":"365e6d52fe33c90973f5db789c64d7f869f64dec","unresolved":false,"context_lines":[{"line_number":218,"context_line":"        with sqlite3.connect(self.db_filepath) as conn:"},{"line_number":219,"context_line":"            cursor \u003d conn.cursor()"},{"line_number":220,"context_line":"            cursor.execute(\u0027\u0027.join([\u0027SELECT * FROM \u0027, table_name]))"},{"line_number":221,"context_line":"            row \u003d cursor.fetchone()"},{"line_number":222,"context_line":"            dict_row \u003d self.dict_factory(cursor, row)"},{"line_number":223,"context_line":"            self.metadef_tables[table_name] \u003d dict_row"},{"line_number":224,"context_line":""}],"source_content_type":"text/x-python","patch_set":8,"id":"9aa7fdbe_a66da49a","line":221,"updated":"2014-10-22 10:56:16.000000000","message":"Please, you fetchall in every get method.","commit_id":"f19e4f588856fbae970a5fa0f20e13eea02c2273"},{"author":{"_account_id":12299,"name":"Paweł Koniszewski","email":"pawel.koniszewski@gmail.com","username":"pawel.koniszewski"},"change_message_id":"365e6d52fe33c90973f5db789c64d7f869f64dec","unresolved":false,"context_lines":[{"line_number":247,"context_line":"            rows \u003d cursor.fetchall()"},{"line_number":248,"context_line":"            self.metadef_tables[table_name] \u003d rows"},{"line_number":249,"context_line":""},{"line_number":250,"context_line":"    def dict_factory(self, cursor, row):"},{"line_number":251,"context_line":"        d \u003d {}"},{"line_number":252,"context_line":"        for idx, col in enumerate(cursor.description):"},{"line_number":253,"context_line":"            d[col[0]] \u003d row[idx]"}],"source_content_type":"text/x-python","patch_set":8,"id":"9aa7fdbe_06bf50d1","line":250,"updated":"2014-10-22 10:56:16.000000000","message":"Can you remove this method and use:\n\nconn \u003d sqlite3.connect(\u0027db\u0027, row_factory\u003dsqlite3.Row)\n\nor just:\n\nconn.row_factory \u003d sqlite3.Row\n\nYou can read more about row_factory in the documentation:\n\nhttps://docs.python.org/2/library/sqlite3.html","commit_id":"f19e4f588856fbae970a5fa0f20e13eea02c2273"},{"author":{"_account_id":12299,"name":"Paweł Koniszewski","email":"pawel.koniszewski@gmail.com","username":"pawel.koniszewski"},"change_message_id":"0b2ae2f5d32da8cd9b5b36ef4bd8885c7dbc122c","unresolved":false,"context_lines":[{"line_number":115,"context_line":""},{"line_number":116,"context_line":"    def _assert_database_loaded_from_json_file(self):"},{"line_number":117,"context_line":"        self._get_metadef_tables_from_sqlite_db()"},{"line_number":118,"context_line":"        with open(self.metadefs_filepath) as json_file:"},{"line_number":119,"context_line":"            metadata \u003d json.load(json_file)"},{"line_number":120,"context_line":"            self._compare_json_file_with_json_from_db(metadata)"},{"line_number":121,"context_line":""}],"source_content_type":"text/x-python","patch_set":10,"id":"9aa7fdbe_ee72e80f","line":118,"updated":"2014-10-24 07:07:57.000000000","message":"Please iterate over .json files","commit_id":"ad7e1a5e8be4b1c6a344f9bfb6469ad5c1c237a7"},{"author":{"_account_id":12299,"name":"Paweł Koniszewski","email":"pawel.koniszewski@gmail.com","username":"pawel.koniszewski"},"change_message_id":"0b2ae2f5d32da8cd9b5b36ef4bd8885c7dbc122c","unresolved":false,"context_lines":[{"line_number":134,"context_line":"                    self.assertEqual(namespace[0].encode(\u0027utf-8\u0027),"},{"line_number":135,"context_line":"                                     exported_metadata[\u0027display_name\u0027].encode("},{"line_number":136,"context_line":"                                         \u0027utf-8\u0027))"},{"line_number":137,"context_line":"                    with open(self.metadefs_filepath) as source_json_file:"},{"line_number":138,"context_line":"                        source_metadata \u003d json.load(source_json_file)"},{"line_number":139,"context_line":"                        self.assertEqual(exported_metadata, source_metadata)"},{"line_number":140,"context_line":""}],"source_content_type":"text/x-python","patch_set":10,"id":"9aa7fdbe_2e1a30cc","line":137,"updated":"2014-10-24 07:07:57.000000000","message":"This should not use metadefs_filepath as this always points to the same json file. As far as I know we keep one namespace per .json file, so if you iterate over namespaces then you should build new path for every namespace.","commit_id":"ad7e1a5e8be4b1c6a344f9bfb6469ad5c1c237a7"},{"author":{"_account_id":12363,"name":"Oleksii Chuprykov","email":"a.chuprikoff@gmail.com","username":"ochuprykov"},"change_message_id":"b8d98b6af9b230a699faf1601af5a21402641673","unresolved":false,"context_lines":[{"line_number":226,"context_line":"        self._sync_db(False)"},{"line_number":227,"context_line":""},{"line_number":228,"context_line":"        self._assert_tables()"},{"line_number":229,"context_line":"        self._assert_tables()"},{"line_number":230,"context_line":""},{"line_number":231,"context_line":"    @depends_on_exe(\u0027sqlite3\u0027)"},{"line_number":232,"context_line":"    @skip_if_disabled"}],"source_content_type":"text/x-python","patch_set":10,"id":"9aa7fdbe_3787f3d8","line":229,"updated":"2014-10-23 15:58:05.000000000","message":"redundant line","commit_id":"ad7e1a5e8be4b1c6a344f9bfb6469ad5c1c237a7"},{"author":{"_account_id":12299,"name":"Paweł Koniszewski","email":"pawel.koniszewski@gmail.com","username":"pawel.koniszewski"},"change_message_id":"0b2ae2f5d32da8cd9b5b36ef4bd8885c7dbc122c","unresolved":false,"context_lines":[{"line_number":248,"context_line":""},{"line_number":249,"context_line":"        # database metadefs should be exported to json files,"},{"line_number":250,"context_line":"        # default in \"/tmp/\""},{"line_number":251,"context_line":"        self._assert_export_metadefs()"},{"line_number":252,"context_line":""},{"line_number":253,"context_line":"        # unload metadefs"},{"line_number":254,"context_line":"        (exitcode, out, err) \u003d self._unload_metadefs()"}],"source_content_type":"text/x-python","patch_set":10,"id":"9aa7fdbe_4efdb46d","line":251,"updated":"2014-10-24 07:07:57.000000000","message":"Don\u0027t you need to cleanup files that you exported from database?","commit_id":"ad7e1a5e8be4b1c6a344f9bfb6469ad5c1c237a7"},{"author":{"_account_id":12299,"name":"Paweł Koniszewski","email":"pawel.koniszewski@gmail.com","username":"pawel.koniszewski"},"change_message_id":"52cb8c91fb41e161348b046a8b23d2ff7fd83b4d","unresolved":false,"context_lines":[{"line_number":106,"context_line":"        self.assertEqual(\u0027\u0027, out)"},{"line_number":107,"context_line":"        self.assertEqual(\u0027\u0027, err)"},{"line_number":108,"context_line":""},{"line_number":109,"context_line":"    def _assert_count_metadefs_in_db(self):"},{"line_number":110,"context_line":"        with sqlite3.connect(self.db_filepath) as conn:"},{"line_number":111,"context_line":"            for table_name in six.iterkeys(self.metadef_tables):"},{"line_number":112,"context_line":"                cursor \u003d conn.cursor()"}],"source_content_type":"text/x-python","patch_set":12,"id":"9aa7fdbe_e222b4a1","line":109,"updated":"2014-10-28 07:44:14.000000000","message":"This method checks whether or not DB is empty. Please rename it.","commit_id":"8075ee9355e453604dfd88a40163e8d84b7bbd41"},{"author":{"_account_id":12299,"name":"Paweł Koniszewski","email":"pawel.koniszewski@gmail.com","username":"pawel.koniszewski"},"change_message_id":"86cd7ef133f2a5ce7131122e79fe742eea71a7e5","unresolved":false,"context_lines":[{"line_number":141,"context_line":"                    ) as source_json_file:"},{"line_number":142,"context_line":"                        source_metadata \u003d json.load(source_json_file)"},{"line_number":143,"context_line":"                        self.assertEqual(exported_metadata, source_metadata)"},{"line_number":144,"context_line":"                if os.path.isfile(file_path):"},{"line_number":145,"context_line":"                    os.unlink(file_path)"},{"line_number":146,"context_line":""},{"line_number":147,"context_line":"    def _compare_json_file_with_json_from_db(self, metadata):"}],"source_content_type":"text/x-python","patch_set":14,"id":"9aa7fdbe_a6b35708","line":144,"updated":"2014-10-28 13:37:22.000000000","message":"I have one concern, this method says that it exports and asserts metadefs, but there is also a cleanup. Maybe you should add a method that does the cleanup after metadef export?","commit_id":"312aeae738ae0262d040c15d80b0a249b2d16a89"},{"author":{"_account_id":12814,"name":"Bartosz Fic","email":"bartosz.fic@intel.com","username":"bartosz-fic"},"change_message_id":"2b98a26b2a8191cb4f5f8c430c7734a5c131f3ab","unresolved":false,"context_lines":[{"line_number":141,"context_line":"                    ) as source_json_file:"},{"line_number":142,"context_line":"                        source_metadata \u003d json.load(source_json_file)"},{"line_number":143,"context_line":"                        self.assertEqual(exported_metadata, source_metadata)"},{"line_number":144,"context_line":"                if os.path.isfile(file_path):"},{"line_number":145,"context_line":"                    os.unlink(file_path)"},{"line_number":146,"context_line":""},{"line_number":147,"context_line":"    def _compare_json_file_with_json_from_db(self, metadata):"}],"source_content_type":"text/x-python","patch_set":14,"id":"9aa7fdbe_21e67144","line":144,"in_reply_to":"9aa7fdbe_a6b35708","updated":"2014-10-28 15:09:40.000000000","message":"Do we really need this ?\n\nI think that moving this 2-liner into separate method is overdone.","commit_id":"312aeae738ae0262d040c15d80b0a249b2d16a89"},{"author":{"_account_id":12299,"name":"Paweł Koniszewski","email":"pawel.koniszewski@gmail.com","username":"pawel.koniszewski"},"change_message_id":"51c2cbc09e521ec56b5dc8ff79b7dc32e792eaaf","unresolved":false,"context_lines":[{"line_number":76,"context_line":"                   self.conf_filepath})"},{"line_number":77,"context_line":"        return execute(cmd, raise_error\u003dTrue)"},{"line_number":78,"context_line":""},{"line_number":79,"context_line":"    def _export_metadefs(self, path\u003d\"/tmp/\"):"},{"line_number":80,"context_line":"        cmd \u003d (\u0027%(executable)s -m glance.cmd.manage --config-file \u0027"},{"line_number":81,"context_line":"               \u0027%(config_file)s db_export_metadefs %(path)s\u0027 %"},{"line_number":82,"context_line":"               {\u0027executable\u0027: sys.executable, \u0027config_file\u0027:"}],"source_content_type":"text/x-python","patch_set":15,"id":"7a8c0949_7c5fdee5","line":79,"updated":"2014-11-04 14:59:24.000000000","message":"Move default path to variable and use it in method that asserts file.","commit_id":"2214973fb468e4eb4238d7b78ac2b47fd9d822a5"},{"author":{"_account_id":12299,"name":"Paweł Koniszewski","email":"pawel.koniszewski@gmail.com","username":"pawel.koniszewski"},"change_message_id":"51c2cbc09e521ec56b5dc8ff79b7dc32e792eaaf","unresolved":false,"context_lines":[{"line_number":130,"context_line":"            for namespace in namespaces:"},{"line_number":131,"context_line":"                namespace_file_name \u003d \u0027\u0027.join([pattern.sub(\u0027\u0027, namespace[0]),"},{"line_number":132,"context_line":"                                               \u0027.json\u0027])"},{"line_number":133,"context_line":"                file_path \u003d \u0027/tmp/{0}\u0027.format(namespace_file_name)"},{"line_number":134,"context_line":"                with open(file_path) as exported_json_file:"},{"line_number":135,"context_line":"                    exported_metadata \u003d json.load(exported_json_file)"},{"line_number":136,"context_line":"                    self.assertEqual(namespace[0].encode(\u0027utf-8\u0027),"}],"source_content_type":"text/x-python","patch_set":15,"id":"7a8c0949_9c62caab","line":133,"updated":"2014-11-04 14:59:24.000000000","message":"Don\u0027t use hardcoded path. Move it to a variable.","commit_id":"2214973fb468e4eb4238d7b78ac2b47fd9d822a5"},{"author":{"_account_id":12299,"name":"Paweł Koniszewski","email":"pawel.koniszewski@gmail.com","username":"pawel.koniszewski"},"change_message_id":"51c2cbc09e521ec56b5dc8ff79b7dc32e792eaaf","unresolved":false,"context_lines":[{"line_number":137,"context_line":"                                     exported_metadata[\u0027display_name\u0027].encode("},{"line_number":138,"context_line":"                                         \u0027utf-8\u0027))"},{"line_number":139,"context_line":"                    with open("},{"line_number":140,"context_line":"                        os.path.join(self.metadefs_dir, namespace_file_name)"},{"line_number":141,"context_line":"                    ) as source_json_file:"},{"line_number":142,"context_line":"                        source_metadata \u003d json.load(source_json_file)"},{"line_number":143,"context_line":"                        self.assertEqual(exported_metadata, source_metadata)"}],"source_content_type":"text/x-python","patch_set":15,"id":"7a8c0949_3c6d5699","line":140,"updated":"2014-11-04 14:59:24.000000000","message":"You can move it to a variable so \u0027with ... as ...\u0027 statement will be in one line.","commit_id":"2214973fb468e4eb4238d7b78ac2b47fd9d822a5"},{"author":{"_account_id":12299,"name":"Paweł Koniszewski","email":"pawel.koniszewski@gmail.com","username":"pawel.koniszewski"},"change_message_id":"51c2cbc09e521ec56b5dc8ff79b7dc32e792eaaf","unresolved":false,"context_lines":[{"line_number":141,"context_line":"                    ) as source_json_file:"},{"line_number":142,"context_line":"                        source_metadata \u003d json.load(source_json_file)"},{"line_number":143,"context_line":"                        self.assertEqual(exported_metadata, source_metadata)"},{"line_number":144,"context_line":"                self._do_metadefs_cleanup(file_path)"},{"line_number":145,"context_line":""},{"line_number":146,"context_line":"    def _do_metadefs_cleanup(self, file_path):"},{"line_number":147,"context_line":"        if os.path.isfile(file_path):"}],"source_content_type":"text/x-python","patch_set":15,"id":"7a8c0949_5ce30233","line":144,"updated":"2014-11-04 14:59:24.000000000","message":"There is still cleanup done in method which is used to export metadefs. Please move it out from here.","commit_id":"2214973fb468e4eb4238d7b78ac2b47fd9d822a5"},{"author":{"_account_id":12299,"name":"Paweł Koniszewski","email":"pawel.koniszewski@gmail.com","username":"pawel.koniszewski"},"change_message_id":"3d132610b18a196f7cc4ae57eb9b3dff9d253692","unresolved":false,"context_lines":[{"line_number":140,"context_line":"                                         \u0027utf-8\u0027))"},{"line_number":141,"context_line":"                    source_path \u003d os.path.join(self.metadefs_dir,"},{"line_number":142,"context_line":"                                               namespace_file_name)"},{"line_number":143,"context_line":"                    with open(source_path) as source_json_file:"},{"line_number":144,"context_line":"                        source_metadata \u003d json.load(source_json_file)"},{"line_number":145,"context_line":"                        self.assertEqual(exported_metadata, source_metadata)"},{"line_number":146,"context_line":""}],"source_content_type":"text/x-python","patch_set":16,"id":"7a8c0949_7ffa57be","line":143,"updated":"2014-11-06 10:28:21.000000000","message":"Please merge this \u0027with\u0027 statement with the \u0027with\u0027 above.","commit_id":"81e9f6179d20c4fc75a3d4b36e9a2f4b9f50a8f5"},{"author":{"_account_id":12814,"name":"Bartosz Fic","email":"bartosz.fic@intel.com","username":"bartosz-fic"},"change_message_id":"71293dd5a1a9f2d87d03091a9d578be476207b52","unresolved":false,"context_lines":[{"line_number":140,"context_line":"                                         \u0027utf-8\u0027))"},{"line_number":141,"context_line":"                    source_path \u003d os.path.join(self.metadefs_dir,"},{"line_number":142,"context_line":"                                               namespace_file_name)"},{"line_number":143,"context_line":"                    with open(source_path) as source_json_file:"},{"line_number":144,"context_line":"                        source_metadata \u003d json.load(source_json_file)"},{"line_number":145,"context_line":"                        self.assertEqual(exported_metadata, source_metadata)"},{"line_number":146,"context_line":""}],"source_content_type":"text/x-python","patch_set":16,"id":"7a8c0949_d196dfef","line":143,"in_reply_to":"7a8c0949_7ffa57be","updated":"2014-11-06 11:22:29.000000000","message":"Done","commit_id":"81e9f6179d20c4fc75a3d4b36e9a2f4b9f50a8f5"}]}
