def get(key, record): bucket = CDSRecordDumpLoader._get_bucket(record=record) files = [ dump_object(obj) for obj in ObjectVersion.get_by_bucket(bucket=bucket) ] return [file_[key] for file_ in files]
def check_files(video): bucket = CDSRecordDumpLoader._get_bucket(record=video) files = [ dump_object(obj) for obj in ObjectVersion.get_by_bucket(bucket=bucket) ] for file_ in files: assert as_bucket(file_['bucket_id']) is not None assert 'checksum' in file_ assert 'content_type' in file_ assert 'context_type' in file_ assert FileInstance.query.filter_by( id=file_['file_id']) is not None assert 'key' in file_ assert 'links' in file_ assert 'content_type' in file_ assert 'context_type' in file_ assert 'media_type' in file_ assert 'tags' in file_ # check extracted metadata master_video = CDSVideosFilesIterator.get_master_video_file(video) assert any([ key in master_video['tags'] for key in ExtractMetadataTask._all_keys ]) assert any([ key in video['_cds']['extracted_metadata'] for key in ExtractMetadataTask._all_keys ])
def check_tag_master(record): bucket = CDSRecordDumpLoader._get_bucket(record=record) master = CDSVideosFilesIterator.get_master_video_file(record) files = [dump_object(obj) for obj in ObjectVersion.get_by_bucket(bucket=bucket) if obj.get_tags().get('master')] assert all([file_['tags']['master'] == master['version_id'] for file_ in files])