<s> import fixtures <EOL> from glance_store . _drivers . swift import utils as sutils <EOL> from glance_store import exceptions <EOL> from glance_store . tests import base <EOL> class TestSwiftParams ( base . StoreBaseTest ) : <EOL> def setUp ( self ) : <EOL> super ( TestSwiftParams , self ) . setUp ( ) <EOL> conf_file = "<STR_LIT>" <EOL> test_dir = self . useFixture ( fixtures . TempDir ( ) ) . path <EOL> self . swift_config_file = self . copy_data_file ( conf_file , test_dir ) <EOL> self . config ( swift_store_config_file = self . swift_config_file ) <EOL> def test_multiple_swift_account_enabled ( self ) : <EOL> self . config ( swift_store_config_file = "<STR_LIT>" ) <EOL> self . assertTrue ( <EOL> sutils . is_multiple_swift_store_accounts_enabled ( self . conf ) ) <EOL> def test_multiple_swift_account_disabled ( self ) : <EOL> self . config ( swift_store_config_file = None ) <EOL> self . assertFalse ( <EOL> sutils . is_multiple_swift_store_accounts_enabled ( self . conf ) ) <EOL> def test_swift_config_file_doesnt_exist ( self ) : <EOL> self . config ( swift_store_config_file = '<STR_LIT>' ) <EOL> self . assertRaises ( exceptions . BadStoreConfiguration , <EOL> sutils . SwiftParams , self . conf ) <EOL> def test_swift_config_uses_default_values_multiple_account_disabled ( self ) : <EOL> default_user = '<STR_LIT>' <EOL> default_key = '<STR_LIT>' <EOL> default_auth_address = '<STR_LIT>' <EOL> default_account_reference = '<STR_LIT>' <EOL> conf = { '<STR_LIT>' : None , <EOL> '<STR_LIT>' : default_user , <EOL> '<STR_LIT>' : default_key , <EOL> '<STR_LIT>' : default_auth_address , <EOL> '<STR_LIT>' : default_account_reference } <EOL> self . config ( ** conf ) <EOL> swift_params = sutils . SwiftParams ( self . conf ) . params <EOL> self . assertEqual ( <NUM_LIT:1> , len ( swift_params . keys ( ) ) ) <EOL> self . assertEqual ( default_user , <EOL> swift_params [ default_account_reference ] [ '<STR_LIT:user>' ] <EOL> ) <EOL> self . assertEqual ( default_key , <EOL> swift_params [ default_account_reference ] [ '<STR_LIT:key>' ] <EOL> ) <EOL> self . assertEqual ( default_auth_address , <EOL> swift_params [ default_account_reference ] <EOL> [ '<STR_LIT>' ] <EOL> ) <EOL> def test_swift_store_config_validates_for_creds_auth_address ( self ) : <EOL> swift_params = sutils . SwiftParams ( self . conf ) . params <EOL> self . assertEqual ( '<STR_LIT>' , <EOL> swift_params [ '<STR_LIT>' ] [ '<STR_LIT:user>' ] <EOL> ) <EOL> self . assertEqual ( '<STR_LIT>' , <EOL> swift_params [ '<STR_LIT>' ] [ '<STR_LIT:key>' ] <EOL> ) <EOL> self . assertEqual ( '<STR_LIT>' , <EOL> swift_params [ '<STR_LIT>' ] [ '<STR_LIT>' ] ) <EOL> self . assertEqual ( '<STR_LIT>' , <EOL> swift_params [ '<STR_LIT>' ] [ '<STR_LIT:user>' ] ) <EOL> self . assertEqual ( '<STR_LIT>' , <EOL> swift_params [ '<STR_LIT>' ] [ '<STR_LIT:key>' ] ) <EOL> self . assertEqual ( '<STR_LIT>' , <EOL> swift_params [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> ) </s>
