forked from testcontainers/testcontainers-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_localstack.py
More file actions
24 lines (17 loc) · 877 Bytes
/
Copy pathtest_localstack.py
File metadata and controls
24 lines (17 loc) · 877 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import json
import urllib
from testcontainers.localstack import LocalStackContainer
def test_docker_run_localstack():
with LocalStackContainer() as localstack:
resp = urllib.request.urlopen(f'{localstack.get_url()}/health')
services = json.loads(resp.read().decode())['services']
# Check that all services are running
assert all(value == 'available' for value in services.values())
# Check that some of the services keys
assert all(test_service in services for test_service in ['dynamodb', 'sns', 'sqs'])
def test_localstack_boto3():
from testcontainers.localstack import LocalStackContainer
with LocalStackContainer(image="localstack/localstack:2.0.1") as localstack:
dynamo_client = localstack.get_client("dynamodb")
tables = dynamo_client.list_tables()
assert tables["TableNames"] == []