Skip to content
Snippets Groups Projects
Commit cd6fbdaf authored by Taya Snijder's avatar Taya Snijder
Browse files

added unit test for docker device

parent e1bc4227
No related branches found
No related tags found
1 merge request!434Resolve L2SS-982 "Update docker device"
# -*- coding: utf-8 -*-
#
# This file is part of the LOFAR 2.0 Station Software
#
#
#
# Distributed under the terms of the APACHE license.
# See LICENSE.txt for more info.
from tango.test_context import DeviceTestContext
from tangostationcontrol.devices import docker_device
import numpy
from tangostationcontrol.test.devices import device_base
class TestDockerDevice(device_base.DeviceTestCase):
DOCKER_PROPERTIES = {'Docker_Base_URL': "unix:///var/run/docker.sock"}
def setUp(self):
# DeviceTestCase setUp patches lofar_device DeviceProxy
super(TestDockerDevice, self).setUp()
def test_read(self):
"""Test whether the device-docker container is running"""
with DeviceTestContext(docker_device.Docker, properties=self.DOCKER_PROPERTIES, process=True) as proxy:
self.assertEqual(proxy.device_docker_R, True)
def test_toggle(self):
"""
Test turning off and on a running docker container
"""
with DeviceTestContext(docker_device.Docker, properties=self.DOCKER_PROPERTIES, process=True) as proxy:
# Turn the recv container off and check that it is indeed turned off
proxy.device_recv_RW = False
self.assertEqual(self.device_recv_R, False)
# Turn the recv container on and check that it is indeed turned on
proxy.device_recv_RW = True
self.assertEqual(self.device_recv_R, True)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment