<s> import os <EOL> import shutil <EOL> import fixtures <EOL> from oslo_config import cfg <EOL> from oslotest import base <EOL> import six <EOL> import glance_store as store <EOL> from glance_store import location <EOL> class StoreBaseTest ( base . BaseTestCase ) : <EOL> _CONF = cfg . ConfigOpts ( ) <EOL> def setUp ( self ) : <EOL> super ( StoreBaseTest , self ) . setUp ( ) <EOL> self . conf = self . _CONF <EOL> self . conf ( args = [ ] ) <EOL> store . register_opts ( self . conf ) <EOL> self . config ( stores = [ ] ) <EOL> location . SCHEME_TO_CLS_MAP = { } <EOL> store . create_stores ( self . conf ) <EOL> self . addCleanup ( setattr , location , '<STR_LIT>' , dict ( ) ) <EOL> self . test_dir = self . useFixture ( fixtures . TempDir ( ) ) . path <EOL> self . addCleanup ( self . conf . reset ) <EOL> def copy_data_file ( self , file_name , dst_dir ) : <EOL> src_file_name = os . path . join ( '<STR_LIT>' , file_name ) <EOL> shutil . copy ( src_file_name , dst_dir ) <EOL> dst_file_name = os . path . join ( dst_dir , file_name ) <EOL> return dst_file_name <EOL> def config ( self , ** kw ) : <EOL> """<STR_LIT>""" <EOL> group = kw . pop ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> for k , v in six . iteritems ( kw ) : <EOL> self . conf . set_override ( k , v , group ) <EOL> def register_store_schemes ( self , store , store_entry ) : <EOL> schemes = store . get_schemes ( ) <EOL> scheme_map = { } <EOL> loc_cls = store . get_store_location_class ( ) <EOL> for scheme in schemes : <EOL> scheme_map [ scheme ] = { <EOL> '<STR_LIT:store>' : store , <EOL> '<STR_LIT>' : loc_cls , <EOL> '<STR_LIT>' : store_entry <EOL> } <EOL> location . register_scheme_map ( scheme_map ) </s>
