Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Help patching boto3 #20

Closed
jacobeatsspam opened this issue Mar 18, 2020 · 2 comments
Closed

Help patching boto3 #20

jacobeatsspam opened this issue Mar 18, 2020 · 2 comments

Comments

@jacobeatsspam
Copy link

jacobeatsspam commented Mar 18, 2020

I need some help trying to patch boto3. I've been trying the following:

snippet:

@unittest.mock.patch.object(boto3, 'resource', new=localstack_client.session.resource)
@unittest.mock.patch.object(boto3, 'client', new=localstack_client.session.client)
class MyTestCase(unittest.TestCase):

    @classmethod
    def setUp(cls):
        try:
            infra.start_infra(asynchronous=True)
        except Exception as e:
            infra.stop_infra()
            raise e

    @classmethod
    def tearDownClass(cls):
        infra.stop_infra()

    def test_ls(self):
        sqs = boto3.client('sqs')
        print(sqs.list_queues())

run:

nosetests -s

output:

botocore.exceptions.EndpointConnectionError: Could not connect to the endpoint URL: "http://localhost:4576/"
@jacobeatsspam
Copy link
Author

jacobeatsspam commented Mar 19, 2020

PEBKAC. I've updated the issue snippet for any wayward travelers.

@Alexander-Serov
Copy link

@jacobisaliveandwell Do you remember how this was solved?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants