<s> import os <EOL> import fixtures <EOL> from oslo_config import cfg <EOL> from nova import paths <EOL> CONF = cfg . CONF <EOL> class ApiPasteV21Fixture ( fixtures . Fixture ) : <EOL> def _replace_line ( self , target_file , line ) : <EOL> target_file . write ( line . replace ( <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" ) ) <EOL> def setUp ( self ) : <EOL> super ( ApiPasteV21Fixture , self ) . setUp ( ) <EOL> CONF . set_default ( '<STR_LIT>' , <EOL> paths . state_path_def ( '<STR_LIT>' ) , <EOL> group = '<STR_LIT>' ) <EOL> tmp_api_paste_dir = self . useFixture ( fixtures . TempDir ( ) ) <EOL> tmp_api_paste_file_name = os . path . join ( tmp_api_paste_dir . path , <EOL> '<STR_LIT>' ) <EOL> with open ( CONF . wsgi . api_paste_config , '<STR_LIT:r>' ) as orig_api_paste : <EOL> with open ( tmp_api_paste_file_name , '<STR_LIT:w>' ) as tmp_file : <EOL> for line in orig_api_paste : <EOL> self . _replace_line ( tmp_file , line ) <EOL> CONF . set_override ( '<STR_LIT>' , tmp_api_paste_file_name , <EOL> group = '<STR_LIT>' ) <EOL> class ApiPasteLegacyV2Fixture ( ApiPasteV21Fixture ) : <EOL> def _replace_line ( self , target_file , line ) : <EOL> line = line . replace ( <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" ) <EOL> target_file . write ( line ) <EOL> class ApiPasteNoProjectId ( ApiPasteV21Fixture ) : <EOL> def _replace_line ( self , target_file , line ) : <EOL> line = line . replace ( <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> target_file . write ( line ) </s>
