mirror of
https://github.com/containers/podman-compose.git
synced 2025-05-31 23:45:51 +02:00
tests: Rewrite test_normalize_depends_on to unittest
This test was forgotten about during initial migration. Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
This commit is contained in:
parent
b86f8b1d61
commit
225999eab1
@ -1,43 +1,45 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import copy
|
import copy
|
||||||
|
import unittest
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
|
from parameterized import parameterized
|
||||||
|
|
||||||
from podman_compose import normalize_service
|
from podman_compose import normalize_service
|
||||||
|
|
||||||
test_cases_simple = [
|
|
||||||
(
|
class TestNormalizeServicesSimple(unittest.TestCase):
|
||||||
{"depends_on": "my_service"},
|
@parameterized.expand([
|
||||||
{"depends_on": {"my_service": {"condition": "service_started"}}},
|
(
|
||||||
),
|
{"depends_on": "my_service"},
|
||||||
(
|
{"depends_on": {"my_service": {"condition": "service_started"}}},
|
||||||
{"depends_on": ["my_service"]},
|
),
|
||||||
{"depends_on": {"my_service": {"condition": "service_started"}}},
|
(
|
||||||
),
|
{"depends_on": ["my_service"]},
|
||||||
(
|
{"depends_on": {"my_service": {"condition": "service_started"}}},
|
||||||
{"depends_on": ["my_service1", "my_service2"]},
|
),
|
||||||
{
|
(
|
||||||
"depends_on": {
|
{"depends_on": ["my_service1", "my_service2"]},
|
||||||
"my_service1": {"condition": "service_started"},
|
{
|
||||||
"my_service2": {"condition": "service_started"},
|
"depends_on": {
|
||||||
|
"my_service1": {"condition": "service_started"},
|
||||||
|
"my_service2": {"condition": "service_started"},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
),
|
||||||
),
|
(
|
||||||
(
|
{"depends_on": {"my_service": {"condition": "service_started"}}},
|
||||||
{"depends_on": {"my_service": {"condition": "service_started"}}},
|
{"depends_on": {"my_service": {"condition": "service_started"}}},
|
||||||
{"depends_on": {"my_service": {"condition": "service_started"}}},
|
),
|
||||||
),
|
(
|
||||||
(
|
{"depends_on": {"my_service": {"condition": "service_healthy"}}},
|
||||||
{"depends_on": {"my_service": {"condition": "service_healthy"}}},
|
{"depends_on": {"my_service": {"condition": "service_healthy"}}},
|
||||||
{"depends_on": {"my_service": {"condition": "service_healthy"}}},
|
),
|
||||||
),
|
])
|
||||||
]
|
def test_normalize_service_simple(
|
||||||
|
self, test_case: dict[str, Any], expected: dict[str, Any]
|
||||||
|
) -> None:
|
||||||
def test_normalize_service_simple():
|
copy.deepcopy(test_case)
|
||||||
for test_case, expected in copy.deepcopy(test_cases_simple):
|
result = normalize_service(test_case)
|
||||||
test_original = copy.deepcopy(test_case)
|
self.assertEqual(result, expected)
|
||||||
test_case = normalize_service(test_case)
|
|
||||||
test_result = expected == test_case
|
|
||||||
if not test_result:
|
|
||||||
print("test: ", test_original)
|
|
||||||
print("expected: ", expected)
|
|
||||||
print("actual: ", test_case)
|
|
||||||
assert test_result
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user