def setUp(self):
        docker_client = VirtualDockerClient.with_containers()
        image_dict = docker_client.inspect_image(
            'simphonyproject/simphony-mayavi:0.6.0')
        self.image_1 = Image.from_docker_dict(image_dict)

        image_dict = docker_client.inspect_image(
            'simphonyproject/ubuntu-image:latest')
        self.image_2 = Image.from_docker_dict(image_dict)
Пример #2
0
    def setUp(self):
        docker_client = VirtualDockerClient.with_containers()
        image_dict = docker_client.inspect_image(
            'simphonyproject/simphony-mayavi:0.6.0')
        self.image_1 = Image.from_docker_dict(image_dict)

        image_dict = docker_client.inspect_image(
            'simphonyproject/ubuntu-image:latest')
        self.image_2 = Image.from_docker_dict(image_dict)
Пример #3
0
    def test_missing_image_type(self):
        docker_client = VirtualDockerClient.with_containers()
        image_dict = docker_client.inspect_image(
            'simphonyproject/ubuntu-image:latest')  # noqa
        image = Image.from_docker_dict(image_dict)

        self.assertEqual(image.type, '')
        self.assertEqual(image.env, {})
    def image(self, image_id_or_name):
        """Returns the Image object associated to a given id
        """
        try:
            image_dict = yield self._docker_client.inspect_image(
                image_id_or_name)
        except NotFound:
            return None

        return Image.from_docker_dict(image_dict)
Пример #5
0
    def test_from_docker_dict_images(self):
        docker_client = VirtualDockerClient.with_containers()
        image_dict = docker_client.images()[0]
        image = Image.from_docker_dict(image_dict)

        self.assertEqual(image.docker_id, image_dict["Id"])
        self.assertEqual(image.name, image_dict["RepoTags"][0])
        self.assertEqual(image.description,
                         image_dict["Labels"][SIMPHONY_NS.description])
        self.assertEqual(image.ui_name,
                         image_dict["Labels"][SIMPHONY_NS.ui_name])
        self.assertEqual(image.type, 'vncapp')
Пример #6
0
    def test_from_docker_dict_inspect_image(self):
        docker_client = VirtualDockerClient.with_containers()
        image_dict = docker_client.inspect_image(
            'simphonyproject/simphony-mayavi:0.6.0')  # noqa

        labels = image_dict['Config']['Labels']
        # Insert an unpalatable label for the envs.
        labels[SIMPHONY_NS_ENV["x11-height"] + ".whatever"] = None

        image = Image.from_docker_dict(image_dict)

        self.assertEqual(image.docker_id, image_dict["Id"])
        self.assertEqual(image.name, image_dict["RepoTags"][0])
        self.assertEqual(
            image.description,
            image_dict['Config']["Labels"][SIMPHONY_NS.description])
        self.assertEqual(image.ui_name,
                         image_dict['Config']["Labels"][SIMPHONY_NS.ui_name])
        self.assertEqual(image.type, 'vncapp')
        self.assertEqual(image.env, {
            "X11_WIDTH": "",
            "X11_DEPTH": "",
            "X11_HEIGHT": "",
        })