Remove podman unit tests

Change-Id: I5ec97b6cd76ff4030d76617310e03fbd35247850
This commit is contained in:
Federico Ressi 2021-05-31 12:41:54 +02:00
parent a84c78515a
commit 319803da4d
4 changed files with 0 additions and 139 deletions

View File

@ -15,13 +15,10 @@ from __future__ import absolute_import
from tobiko.tests.unit import _case
from tobiko.tests.unit import _patch
from tobiko.tests.unit.podman import _mocked_service
TobikoUnitTest = _case.TobikoUnitTest
mocked_service = _mocked_service
PatchFixture = _patch.PatchFixture
PatchMixin = _patch.PatchMixin

View File

@ -1,60 +0,0 @@
types = """
type ListPodData (
id: string,
name: string,
createdat: string,
cgroup: string,
status: string,
labels: [string]string,
numberofcontainers: string,
containersinfo: []ListPodContainerInfo
)
type ListPodContainerInfo (
name: string,
id: string,
status: string
)
"""
class ServicePod:
def StartPod(self, name: str) -> str:
"""return pod"""
return { # type: ignore
"pod": "135d71b9495f7c3967f536edad57750bfd"
"b569336cd107d8aabab45565ffcfb6",
"name": name
}
def GetPod(self, name: str) -> str:
"""return pod: ListPodData"""
return { # type: ignore
"pod": {
"cgroup": "machine.slice",
"containersinfo": [
{
"id": "1840835294cf076a822e4e12ba4152411f131"
"bd869e7f6a4e8b16df9b0ea5c7f",
"name": "1840835294cf-infra",
"status": "running"
},
{
"id": "49a5cce72093a5ca47c6de86f10ad7bb36391e2"
"d89cef765f807e460865a0ec6",
"name": "upbeat_murdock",
"status": "running"
}
],
"createdat": "2018-12-07 13:10:15.014139258 -0600 CST",
"id": "135d71b9495f7c3967f536edad57750bfdb569336cd"
"107d8aabab45565ffcfb6",
"name": name,
"numberofcontainers": "2",
"status": "Running"
}
}
def GetVersion(self) -> str:
"""return version"""
return {"version": "testing"} # type: ignore

View File

@ -1,76 +0,0 @@
# Copyright 2018 Red Hat
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from __future__ import absolute_import
import mock
from tobiko import podman
from tobiko.tests import unit
class TestShell(unit.TobikoUnitTest):
@mock.patch('tobiko.shell.sh.execute')
def test_discover_podman_socket(self, mock_execute):
class FakeProcess:
exit_status = 0
stdout = '/run/podman/io.podman'
stderr = ''
mock_execute.return_value = FakeProcess()
self.assertEqual(
podman.discover_podman_socket(),
'/run/podman/io.podman'
)
@mock.patch('tobiko.shell.sh.execute')
def test_discover_podman_socket_none_result(self, mock_execute):
class FakeProcess:
exit_status = 1
stdout = ''
stderr = 'boom'
mock_execute.return_value = FakeProcess()
self.assertRaises(
podman.PodmanSocketNotFoundError,
podman.discover_podman_socket
)
@mock.patch('tobiko.shell.sh.execute')
def test_discover_podman_socket_with_exit_code(self, mock_execute):
class FakeProcess:
exit_status = 0
stdout = ''
stderr = 'boom'
mock_execute.return_value = FakeProcess()
self.assertRaises(
podman.PodmanSocketNotFoundError,
podman.discover_podman_socket
)
@mock.patch('tobiko.shell.sh.execute')
def test_is_podman_running(self, mock_execute):
class FakeProcess:
exit_status = 0
stdout = '/run/podman/io.podman'
stderr = ''
mock_execute.return_value = FakeProcess()
self.assertEqual(podman.is_podman_running(), True)
@mock.patch('tobiko.shell.sh.execute')
def test_is_podman_running_without_socket(self, mock_execute):
class FakeProcess:
exit_status = 1
stdout = ''
stderr = 'boom'
mock_execute.return_value = FakeProcess()
self.assertEqual(podman.is_podman_running(), False)