Skip to content

Commit 6e3291a

Browse files
committed
Add tests for CustomContainer
1 parent 568f644 commit 6e3291a

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

tests/test_custom.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
from testcontainers.custom import CustomContainer
2+
3+
4+
def test_custom_container():
5+
"""Test that the settings are active on the instance.
6+
7+
The functionality of spinning up containers are handled by other classes,
8+
so only make sure that configuration is set correctly.
9+
"""
10+
image = "google/cloud-sdk:latest" # Select a suitable image
11+
command = "echo 'test'"
12+
env = {"ENV1": "VAL1"}
13+
name = "my-container"
14+
ports = [8080, 8081]
15+
volumes = [("/dev/null", "/dev/null2", "ro")]
16+
17+
with CustomContainer(
18+
image=image, command=command, env=env, name=name, ports=ports, volumes=volumes
19+
) as container:
20+
assert container.image == image
21+
assert container._command == command
22+
assert container.env == env
23+
assert container._name == name
24+
assert list(container.ports.keys()) == ports
25+
assert container.volumes == {"/dev/null": {"bind": "/dev/null2", "mode": "ro"}}

0 commit comments

Comments
 (0)