Add missing fedora_container platform members

The fedora_container platform was missing User and Group members.

Add test case to verify that all known platforms define correct module
API.

Fixes: https://pagure.io/freeipa/issue/8519
Signed-off-by: Christian Heimes <cheimes@redhat.com>
Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
This commit is contained in:
Christian Heimes 2020-09-29 10:30:42 +02:00
parent 9f0ec27e9f
commit 1684b0f2c3
2 changed files with 45 additions and 1 deletions

View File

@ -3,7 +3,10 @@
#
"""Fedora container constants
"""
from ipaplatform.fedora.constants import FedoraConstantsNamespace
from ipaplatform.fedora.constants import FedoraConstantsNamespace, User, Group
__all__ = ("constants", "User", "Group")
class FedoraContainerConstantsNamespace(FedoraConstantsNamespace):

View File

@ -0,0 +1,41 @@
#
# Copyright (C) 2020 FreeIPA Contributors see COPYING for license
#
"""Test import and basic properties of platforms
"""
from importlib import import_module
import pytest
from ipaplatform.base.constants import BaseConstantsNamespace, User, Group
from ipaplatform.base.paths import BasePathNamespace
from ipaplatform.base.services import KnownServices
from ipaplatform.base.tasks import BaseTaskNamespace
PLATFORMS = [
"debian",
"fedora",
"fedora_container",
"rhel",
"rhel_container",
"suse",
]
@pytest.mark.parametrize("name", PLATFORMS)
def test_import_platform(name):
constants = import_module(f"ipaplatform.{name}.constants")
assert isinstance(constants.constants, BaseConstantsNamespace)
assert issubclass(constants.User, User)
assert issubclass(constants.Group, Group)
paths = import_module(f"ipaplatform.{name}.paths")
assert isinstance(paths.paths, BasePathNamespace)
services = import_module(f"ipaplatform.{name}.services")
assert isinstance(services.knownservices, KnownServices)
assert isinstance(services.timedate_services, list)
assert callable(services.service)
tasks = import_module(f"ipaplatform.{name}.tasks")
assert isinstance(tasks.tasks, BaseTaskNamespace)