Skip to content

Commit

Permalink
Add tests for CustomContainer
Browse files Browse the repository at this point in the history
  • Loading branch information
vikahl committed Aug 25, 2022
1 parent 568f644 commit 6e3291a
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions tests/test_custom.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
from testcontainers.custom import CustomContainer


def test_custom_container():
"""Test that the settings are active on the instance.
The functionality of spinning up containers are handled by other classes,
so only make sure that configuration is set correctly.
"""
image = "google/cloud-sdk:latest" # Select a suitable image
command = "echo 'test'"
env = {"ENV1": "VAL1"}
name = "my-container"
ports = [8080, 8081]
volumes = [("/dev/null", "/dev/null2", "ro")]

with CustomContainer(
image=image, command=command, env=env, name=name, ports=ports, volumes=volumes
) as container:
assert container.image == image
assert container._command == command
assert container.env == env
assert container._name == name
assert list(container.ports.keys()) == ports
assert container.volumes == {"/dev/null": {"bind": "/dev/null2", "mode": "ro"}}

0 comments on commit 6e3291a

Please sign in to comment.