<s> from os_client_config import cloud_config <EOL> from os_client_config import config <EOL> from os_client_config import exceptions <EOL> from os_client_config . tests import base <EOL> import fixtures <EOL> class TestEnviron ( base . TestCase ) : <EOL> def setUp ( self ) : <EOL> super ( TestEnviron , self ) . setUp ( ) <EOL> self . useFixture ( <EOL> fixtures . EnvironmentVariable ( '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> self . useFixture ( <EOL> fixtures . EnvironmentVariable ( '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> self . useFixture ( <EOL> fixtures . EnvironmentVariable ( '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> self . useFixture ( <EOL> fixtures . EnvironmentVariable ( '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> self . useFixture ( <EOL> fixtures . EnvironmentVariable ( '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> def test_get_one_cloud ( self ) : <EOL> c = config . OpenStackConfig ( config_files = [ self . cloud_yaml ] , <EOL> vendor_files = [ self . vendor_yaml ] ) <EOL> self . assertIsInstance ( c . get_one_cloud ( ) , cloud_config . CloudConfig ) <EOL> def test_no_fallthrough ( self ) : <EOL> c = config . OpenStackConfig ( config_files = [ self . cloud_yaml ] , <EOL> vendor_files = [ self . vendor_yaml ] ) <EOL> self . assertRaises ( <EOL> exceptions . OpenStackConfigException , c . get_one_cloud , '<STR_LIT>' ) <EOL> def test_envvar_name_override ( self ) : <EOL> self . useFixture ( <EOL> fixtures . EnvironmentVariable ( '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> c = config . OpenStackConfig ( config_files = [ self . cloud_yaml ] , <EOL> vendor_files = [ self . vendor_yaml ] ) <EOL> cc = c . get_one_cloud ( '<STR_LIT>' ) <EOL> self . _assert_cloud_details ( cc ) <EOL> def test_envvar_prefer_ipv6_override ( self ) : <EOL> self . useFixture ( <EOL> fixtures . EnvironmentVariable ( '<STR_LIT>' , '<STR_LIT:false>' ) ) <EOL> c = config . OpenStackConfig ( config_files = [ self . cloud_yaml ] , <EOL> vendor_files = [ self . vendor_yaml ] , <EOL> secure_files = [ self . secure_yaml ] ) <EOL> cc = c . get_one_cloud ( '<STR_LIT>' ) <EOL> self . assertFalse ( cc . prefer_ipv6 ) <EOL> def test_environ_exists ( self ) : <EOL> c = config . OpenStackConfig ( config_files = [ self . cloud_yaml ] , <EOL> vendor_files = [ self . vendor_yaml ] , <EOL> secure_files = [ self . secure_yaml ] ) <EOL> cc = c . get_one_cloud ( '<STR_LIT>' ) <EOL> self . _assert_cloud_details ( cc ) <EOL> self . assertNotIn ( '<STR_LIT>' , cc . config ) <EOL> self . assertIn ( '<STR_LIT>' , cc . config [ '<STR_LIT>' ] ) <EOL> self . assertNotIn ( '<STR_LIT>' , cc . config [ '<STR_LIT>' ] ) <EOL> self . assertNotIn ( '<STR_LIT>' , cc . config ) <EOL> cc = c . get_one_cloud ( '<STR_LIT>' ) <EOL> self . _assert_cloud_details ( cc ) <EOL> cc = c . get_one_cloud ( '<STR_LIT>' ) <EOL> self . _assert_cloud_details ( cc ) <EOL> def test_environ_prefix ( self ) : <EOL> c = config . OpenStackConfig ( config_files = [ self . cloud_yaml ] , <EOL> vendor_files = [ self . vendor_yaml ] , <EOL> envvar_prefix = '<STR_LIT>' , <EOL> secure_files = [ self . secure_yaml ] ) <EOL> cc = c . get_one_cloud ( '<STR_LIT>' ) <EOL> self . _assert_cloud_details ( cc ) <EOL> self . assertNotIn ( '<STR_LIT>' , cc . config ) <EOL> self . assertIn ( '<STR_LIT>' , cc . config [ '<STR_LIT>' ] ) <EOL> self . assertIn ( '<STR_LIT>' , cc . config [ '<STR_LIT>' ] ) <EOL> self . assertNotIn ( '<STR_LIT>' , cc . config ) <EOL> cc = c . get_one_cloud ( '<STR_LIT>' ) <EOL> self . _assert_cloud_details ( cc ) <EOL> cc = c . get_one_cloud ( '<STR_LIT>' ) <EOL> self . _assert_cloud_details ( cc ) <EOL> def test_get_one_cloud_with_config_files ( self ) : <EOL> c = config . OpenStackConfig ( config_files = [ self . cloud_yaml ] , <EOL> vendor_files = [ self . vendor_yaml ] , <EOL> secure_files = [ self . secure_yaml ] ) <EOL> self . assertIsInstance ( c . cloud_config , dict ) <EOL> self . assertIn ( '<STR_LIT>' , c . cloud_config ) <EOL> self . assertIsInstance ( c . cloud_config [ '<STR_LIT>' ] , dict ) <EOL> self . assertIn ( '<STR_LIT>' , c . cloud_config [ '<STR_LIT>' ] ) <EOL> self . assertIn ( '<STR_LIT:path>' , c . cloud_config [ '<STR_LIT>' ] ) <EOL> cc = c . get_one_cloud ( '<STR_LIT>' ) <EOL> self . _assert_cloud_details ( cc ) <EOL> cc = c . get_one_cloud ( '<STR_LIT>' ) <EOL> self . _assert_cloud_details ( cc ) <EOL> def test_config_file_override ( self ) : <EOL> self . useFixture ( <EOL> fixtures . EnvironmentVariable ( <EOL> '<STR_LIT>' , self . cloud_yaml ) ) <EOL> c = config . OpenStackConfig ( config_files = [ ] , <EOL> vendor_files = [ self . vendor_yaml ] ) <EOL> cc = c . get_one_cloud ( '<STR_LIT>' ) <EOL> self . _assert_cloud_details ( cc ) <EOL> class TestEnvvars ( base . TestCase ) : <EOL> def test_no_envvars ( self ) : <EOL> self . useFixture ( <EOL> fixtures . EnvironmentVariable ( '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> c = config . OpenStackConfig ( config_files = [ self . cloud_yaml ] , <EOL> vendor_files = [ self . vendor_yaml ] ) <EOL> self . assertRaises ( <EOL> exceptions . OpenStackConfigException , c . get_one_cloud , '<STR_LIT>' ) <EOL> def test_test_envvars ( self ) : <EOL> self . useFixture ( <EOL> fixtures . EnvironmentVariable ( '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> self . useFixture ( <EOL> fixtures . EnvironmentVariable ( '<STR_LIT>' , '<STR_LIT:True>' ) ) <EOL> c = config . OpenStackConfig ( config_files = [ self . cloud_yaml ] , <EOL> vendor_files = [ self . vendor_yaml ] ) <EOL> self . assertRaises ( <EOL> exceptions . OpenStackConfigException , c . get_one_cloud , '<STR_LIT>' ) <EOL> def test_have_envvars ( self ) : <EOL> self . useFixture ( <EOL> fixtures . EnvironmentVariable ( '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> self . useFixture ( <EOL> fixtures . EnvironmentVariable ( '<STR_LIT>' , '<STR_LIT:user>' ) ) <EOL> c = config . OpenStackConfig ( config_files = [ self . cloud_yaml ] , <EOL> vendor_files = [ self . vendor_yaml ] ) <EOL> cc = c . get_one_cloud ( '<STR_LIT>' ) <EOL> self . assertEqual ( cc . config [ '<STR_LIT>' ] [ '<STR_LIT:username>' ] , '<STR_LIT:user>' ) <EOL> def test_old_envvars ( self ) : <EOL> self . useFixture ( <EOL> fixtures . EnvironmentVariable ( '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> c = config . OpenStackConfig ( config_files = [ self . cloud_yaml ] , <EOL> vendor_files = [ self . vendor_yaml ] , <EOL> envvar_prefix = '<STR_LIT>' ) <EOL> cc = c . get_one_cloud ( '<STR_LIT>' ) <EOL> self . assertEqual ( cc . config [ '<STR_LIT>' ] [ '<STR_LIT:username>' ] , '<STR_LIT>' ) </s>
