python-botocore/tests/functional/test_client.py

22 lines
804 B
Python
Raw Normal View History

2021-01-26 16:12:20 +01:00
import unittest
import botocore
2021-11-03 18:14:15 +01:00
2021-01-26 16:12:20 +01:00
class TestCreateClients(unittest.TestCase):
def setUp(self):
self.session = botocore.session.get_session()
def test_client_can_clone_with_service_events(self):
# We should also be able to create a client object.
client = self.session.create_client('s3', region_name='us-west-2')
# We really just want to ensure create_client doesn't raise
# an exception, but we'll double check that the client looks right.
self.assertTrue(hasattr(client, 'list_buckets'))
def test_client_raises_exception_invalid_region(self):
2021-09-22 22:53:42 +02:00
with self.assertRaisesRegex(ValueError, ('invalid region name')):
2021-01-26 16:12:20 +01:00
self.session.create_client(
2022-05-26 00:10:07 +02:00
'cloudformation', region_name='invalid region name'
)