<s> import mock <EOL> from oslo_config import cfg <EOL> from nova . api . openstack import extensions as api_extensions <EOL> from nova . tests . functional . api_sample_tests import api_sample_base <EOL> CONF = cfg . CONF <EOL> CONF . import_opt ( '<STR_LIT>' , <EOL> '<STR_LIT>' ) <EOL> def fake_soft_extension_authorizer ( extension_name , core = False ) : <EOL> def authorize ( context , action = None ) : <EOL> return True <EOL> return authorize <EOL> class ExtensionInfoAllSamplesJsonTest ( api_sample_base . ApiSampleTestBaseV21 ) : <EOL> all_extensions = True <EOL> @ mock . patch . object ( api_extensions , '<STR_LIT>' ) <EOL> def test_list_extensions ( self , soft_auth ) : <EOL> soft_auth . side_effect = fake_soft_extension_authorizer <EOL> response = self . _do_get ( '<STR_LIT>' ) <EOL> template = '<STR_LIT>' <EOL> if self . api_major_version == '<STR_LIT>' : <EOL> if self . _legacy_v2_code : <EOL> template = '<STR_LIT>' <EOL> else : <EOL> template = '<STR_LIT>' <EOL> self . _verify_response ( template , { } , response , <NUM_LIT:200> ) <EOL> class ExtensionInfoSamplesJsonTest ( api_sample_base . ApiSampleTestBaseV21 ) : <EOL> sample_dir = "<STR_LIT>" <EOL> all_extensions = True <EOL> @ mock . patch . object ( api_extensions , '<STR_LIT>' ) <EOL> def test_get_extensions ( self , soft_auth ) : <EOL> soft_auth . side_effect = fake_soft_extension_authorizer <EOL> response = self . _do_get ( '<STR_LIT>' ) <EOL> template = '<STR_LIT>' <EOL> if self . _legacy_v2_code : <EOL> template = '<STR_LIT>' <EOL> self . _verify_response ( template , { } , response , <NUM_LIT:200> ) </s>
