From 319803da4da42b37acf56dc83ff78f04a2051f69 Mon Sep 17 00:00:00 2001 From: Federico Ressi Date: Mon, 31 May 2021 12:41:54 +0200 Subject: [PATCH] Remove podman unit tests Change-Id: I5ec97b6cd76ff4030d76617310e03fbd35247850 --- tobiko/tests/unit/__init__.py | 3 - tobiko/tests/unit/podman/__init__.py | 0 tobiko/tests/unit/podman/_mocked_service.py | 60 ---------------- tobiko/tests/unit/podman/test_shell.py | 76 --------------------- 4 files changed, 139 deletions(-) delete mode 100644 tobiko/tests/unit/podman/__init__.py delete mode 100644 tobiko/tests/unit/podman/_mocked_service.py delete mode 100644 tobiko/tests/unit/podman/test_shell.py diff --git a/tobiko/tests/unit/__init__.py b/tobiko/tests/unit/__init__.py index 57d89a5d3..94aa9e9a1 100644 --- a/tobiko/tests/unit/__init__.py +++ b/tobiko/tests/unit/__init__.py @@ -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 diff --git a/tobiko/tests/unit/podman/__init__.py b/tobiko/tests/unit/podman/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/tobiko/tests/unit/podman/_mocked_service.py b/tobiko/tests/unit/podman/_mocked_service.py deleted file mode 100644 index 233839d5d..000000000 --- a/tobiko/tests/unit/podman/_mocked_service.py +++ /dev/null @@ -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 diff --git a/tobiko/tests/unit/podman/test_shell.py b/tobiko/tests/unit/podman/test_shell.py deleted file mode 100644 index 1718bc11d..000000000 --- a/tobiko/tests/unit/podman/test_shell.py +++ /dev/null @@ -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)