Commit 0c01dc7f authored by Yannick Kirschhoffer's avatar Yannick Kirschhoffer

Fix unit tests after Docker depdency upgrade.

parent b1d8f8d7
Pipeline #42248968 failed with stage
in 56 seconds
import unittest
from unittest.mock import patch
from docker import Client
from docker import APIClient
from docker_ascii_map.docker_config import ConfigParser, PortMapping
......@@ -11,14 +11,14 @@ class ConfigTests(unittest.TestCase):
self.assertEqual('80:8080', str(PortMapping(private_port=8080, public_port=80)))
def test_empty_config(self):
with patch.object(Client, 'containers', return_value=[]) as mock_method:
with patch.object(APIClient, 'containers', return_value=[]) as mock_method:
configuration_parser = ConfigParser()
self.assertEqual([], configuration_parser.get_configuration().containers)
mock_method.assert_called_once_with(all=True)
def test_single_container(self):
with patch.object(Client, 'containers', return_value=[
with patch.object(APIClient, 'containers', return_value=[
{'Names': ['/im1'], 'State': 'running', 'Image': 'ubuntu:latest',
'Mounts': [],
'NetworkSettings': {'Networks': {}}, 'Ports': []}]) as mock_method:
......@@ -28,7 +28,7 @@ class ConfigTests(unittest.TestCase):
mock_method.assert_called_once_with(all=True)
def test_volume(self):
with patch.object(Client, 'containers', return_value=[
with patch.object(APIClient, 'containers', return_value=[
{'Names': ['/im1'], 'State': 'running', 'Image': 'ubuntu:latest',
'Mounts': [{'Source': '/home/yk/Documents/hr/pg-data', 'RW': True, 'Mode': '',
'Type': 'bind', 'Destination': '/var/lib/postgresql/data', 'Propagation': ''}],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment