Пример #1
0
def test_docker_api_version(mock_docker, caplog, vers, res):
    mock_docker.return_value = mock.MagicMock(**{'version.return_value': vers})
    caplog.set_level(logging.INFO)
    DockerAPI().version()

    for ver in res:
        if ver not in caplog.text:
            pytest.fail('Version does not match expectation')
Пример #2
0
def docker_api():
    return DockerAPI()
Пример #3
0
 def set_docker_api(self):
     """Setting up Docker Python API client"""
     self.docker_api = DockerAPI()
Пример #4
0
def test_docker_api_init_raises(mock_docker, test_exception, res_exception):
    mock_docker.return_value = mock.MagicMock(**{'ping.side_effect': test_exception})
    with pytest.raises(res_exception):
        DockerAPI()