def _build_environment2_extension_fixture(): class ExtensionImpl(Extension): @staticmethod def get_supported_bases() -> Tuple[str, ...]: return ("core18", ) @staticmethod def get_supported_confinement() -> Tuple[str, ...]: return ("strict", ) def __init__(self, extension_name, yaml_data): super().__init__(extension_name=extension_name, yaml_data=yaml_data) self.root_snippet = {} self.app_snippet = {} self.part_snippet = { "after": ["extension-part2"], "build-environment": [ { "PATH": "$PATH:/extension-path2" }, { "EXTKEY": "EXTVAL2" }, ], } self.parts = {"extension-part2": {"plugin": "nil"}} return fixture_setup.FakeExtension("buildenvironment2", ExtensionImpl)
def _daemon_extension_fixture(): class DaemonExtension(Extension): supported_bases = ("core18", ) def __init__(self, yaml_data): super().__init__(yaml_data) self.app_snippet = {"daemon": "simple"} return fixture_setup.FakeExtension("daemon", DaemonExtension)
def _plug2_extension_fixture(): class Plug2Extension(Extension): supported_bases = ("core18", ) def __init__(self, yaml_data): super().__init__(yaml_data) self.app_snippet = {"plugs": ["test-plug2"]} return fixture_setup.FakeExtension("plug2", Plug2Extension)
def _test3_extension_fixture(): class Test3Extension(Extension): supported_bases = ("core16", "core18") def __init__(self, yaml_data): super().__init__(yaml_data) self.parts = {"extension-part": {"plugin": "nil"}} return fixture_setup.FakeExtension("test3", Test3Extension)
def _invalid_extension_fixture(): class InvalidExtension(Extension): supported_bases = ("core18", ) def __init__(self, yaml_data): super().__init__(yaml_data) self.app_snippet = {"unsupported-key": "value"} return fixture_setup.FakeExtension("invalid", InvalidExtension)
def _adopt_info_extension_fixture(): class AdoptExtension(Extension): supported_bases = ("core18", ) def __init__(self, yaml_data): super().__init__(yaml_data) self.root_snippet = {"adopt-info": "some-part-name"} return fixture_setup.FakeExtension("adopt", AdoptExtension)
def _test2_extension_fixture(): class Test2Extension(Extension): supported_bases = ("core16", ) def __init__(self, yaml_data): super().__init__(yaml_data) self.part_snippet = {"after": ["extension-part"]} self.parts = {"extension-part": {"plugin": "nil"}} return fixture_setup.FakeExtension("test2", Test2Extension)
def _environment_extension_fixture(): class EnvironmentExtension(Extension): supported_bases = ("core18", ) def __init__(self, yaml_data): super().__init__(yaml_data) self.app_snippet = {"environment": {"TEST_EXTENSION": 1}} self.part_snippet = {"after": ["extension-part"]} self.parts = {"extension-part": {"plugin": "nil"}} return fixture_setup.FakeExtension("environment", EnvironmentExtension)
def _test1_extension_fixture(): class Test1Extension(Extension): supported_bases = ("core16", ) def __init__(self, yaml_data): super().__init__(yaml_data) self.app_snippet = {"environment": {"EXTENSION_NAME": "test1"}} self.part_snippet = {"after": ["extension-part"]} self.parts = {"extension-part": {"plugin": "nil"}} return fixture_setup.FakeExtension("test1", Test1Extension)
def _test4_extension_fixture(): class ExtensionImpl(Extension): @staticmethod def get_supported_bases() -> Tuple[str, ...]: return ("core20", "core18") @staticmethod def get_supported_confinement() -> Tuple[str, ...]: return ("strict",) def __init__(self, extension_name, yaml_data): super().__init__(extension_name=extension_name, yaml_data=yaml_data) self.parts = {"extension-part": {"plugin": "nil"}} return fixture_setup.FakeExtension("_test4", ExtensionImpl)
def _daemon_extension_fixture(): class DaemonExtension(Extension): @staticmethod def get_supported_bases() -> Tuple[str, ...]: return ("core18", ) @staticmethod def get_supported_confinement() -> Tuple[str, ...]: return ("strict", ) def __init__(self, extension_name, yaml_data): super().__init__(extension_name=extension_name, yaml_data=yaml_data) self.app_snippet = {"daemon": "simple"} return fixture_setup.FakeExtension("daemon", DaemonExtension)
def _invalid_extension_fixture(): class ExtensionImpl(Extension): @staticmethod def get_supported_bases() -> Tuple[str, ...]: return ("core18", ) @staticmethod def get_supported_confinement() -> Tuple[str, ...]: return ("strict", ) def __init__(self, extension_name, yaml_data): super().__init__(extension_name=extension_name, yaml_data=yaml_data) self.app_snippet = {"unsupported-key": "value"} return fixture_setup.FakeExtension("invalid", ExtensionImpl)
def _adopt_info_extension_fixture(): class ExtensionImpl(Extension): @staticmethod def get_supported_bases() -> Tuple[str, ...]: return ("core18", ) @staticmethod def get_supported_confinement() -> Tuple[str, ...]: return ("strict", ) def __init__(self, extension_name, yaml_data): super().__init__(extension_name=extension_name, yaml_data=yaml_data) self.root_snippet = {"adopt-info": "some-part-name"} return fixture_setup.FakeExtension("adopt", ExtensionImpl)
def _plug2_extension_fixture(): class ExtensionImpl(Extension): @staticmethod def get_supported_bases() -> Tuple[str, ...]: return ("core18", ) @staticmethod def get_supported_confinement() -> Tuple[str, ...]: return ("strict", ) def __init__(self, extension_name, yaml_data): super().__init__(extension_name=extension_name, yaml_data=yaml_data) self.app_snippet = {"plugs": ["test-plug2"]} return fixture_setup.FakeExtension("plug2", ExtensionImpl)
def _environment_extension_fixture(): class ExtensionImpl(Extension): @staticmethod def get_supported_bases() -> Tuple[str, ...]: return ("core18", ) @staticmethod def get_supported_confinement() -> Tuple[str, ...]: return ("strict", ) def __init__(self, extension_name, yaml_data): super().__init__(extension_name=extension_name, yaml_data=yaml_data) self.root_snippet = {"environment": {"TEST_EXTENSION": 1}} self.app_snippet = {"environment": {"TEST_EXTENSION": 1}} self.part_snippet = {"after": ["extension-part"]} self.parts = {"extension-part": {"plugin": "nil"}} return fixture_setup.FakeExtension("environment", ExtensionImpl)
def _test2_extension_fixture(): class ExtensionImpl(Extension): """This is the Test2 extension. It does other stuff. """ @staticmethod def get_supported_bases() -> Tuple[str, ...]: return ("core16", ) @staticmethod def get_supported_confinement() -> Tuple[str, ...]: return ("strict", ) def __init__(self, extension_name, yaml_data): super().__init__(extension_name=extension_name, yaml_data=yaml_data) self.part_snippet = {"after": ["extension-part"]} self.parts = {"extension-part": {"plugin": "nil"}} return fixture_setup.FakeExtension("test2", ExtensionImpl)
def _test1_extension_fixture(): class Test1Extension(Extension): """This is the Test1 extension. It does stuff. """ @staticmethod def get_supported_bases() -> Tuple[str, ...]: return ("core16", ) @staticmethod def get_supported_confinement() -> Tuple[str, ...]: return ("strict", ) def __init__(self, extension_name, yaml_data): super().__init__(extension_name=extension_name, yaml_data=yaml_data) self.app_snippet = {"environment": {"EXTENSION_NAME": "test1"}} self.part_snippet = {"after": ["extension-part"]} self.parts = {"extension-part": {"plugin": "nil"}} return fixture_setup.FakeExtension("test1", Test1Extension)