Unit Tests

Utilities

Testing resources may be located in arbitrary locations relative to the cwd.

class diana.utils.endpoint.Containerized(dkr_name='Endpoint', dkr_image=None, dkr_ports=NOTHING, dkr_command=None, dkr_env=NOTHING, dkr_links=NOTHING, dkr_remove=True)

Many test fixtures create disposable Docker services to mock Diana platform connectivity. These are managed through the Containerized class. This class can be easily mixed into any endpoint, as demonstrated in the unit test suite.

Includes methods for starting containers and swarm services.

classmethod api_client()
classmethod clean_swarm()
classmethod docker_client()
start_container()

Run the dkr_image as a container with appropriate configuration

start_service()

Run the dkr_image as a swarm service with appropriate configuration

classmethod start_swarm()
stop_container()

Stop the running container associated with this endpoint.

stop_service()

Stop the running swarm service associated with this endpoint.