def test_unicode_bytes_path(self): filename = self.create_config_file(b'aws_config_unicode\xe2\x9c\x93') with mock.patch('sys.getfilesystemencoding') as encoding: encoding.return_value = 'utf-8' loaded_config = load_config(filename) self.assertIn('default', loaded_config['profiles']) self.assertIn('personal', loaded_config['profiles'])
def test_nested_hierarchy_parsing(self): filename = path('aws_config_nested') loaded_config = load_config(filename) config = loaded_config['profiles']['default'] self.assertEqual(config['aws_access_key_id'], 'foo') self.assertEqual(config['region'], 'us-west-2') self.assertEqual(config['s3']['signature_version'], 's3v4') self.assertEqual(config['cloudwatch']['signature_version'], 'v4')
def test_bad_profiles_are_ignored(self): filename = path('aws_bad_profile') loaded_config = load_config(filename) self.assertEqual(len(loaded_config['profiles']), 3) profiles = loaded_config['profiles'] self.assertIn('my profile', profiles) self.assertIn('personal1', profiles) self.assertIn('default', profiles)
def test_nested_bad_config(self): filename = path('aws_config_nested_bad') with self.assertRaises(ibm_botocore.exceptions.ConfigParseError): loaded_config = load_config(filename)
def test_profile_map_conversion(self): loaded_config = load_config(path('aws_config')) self.assertIn('profiles', loaded_config) self.assertEqual(sorted(loaded_config['profiles'].keys()), ['default', 'personal'])
def test_unicode_bytes_path_not_found_filesystem_encoding_none(self): with mock.patch('sys.getfilesystemencoding') as encoding: encoding.return_value = None with self.assertRaises(ibm_botocore.exceptions.ConfigNotFound): load_config(path(b'\xe2\x9c\x93'))
def test_nested_bad_config_filesystem_encoding_none(self): filename = path('aws_config_nested_bad') with mock.patch('sys.getfilesystemencoding') as encoding: encoding.return_value = None with self.assertRaises(ibm_botocore.exceptions.ConfigParseError): load_config(filename)