# Path: moduleframework/module_framework.py
# PROFILE = None
# def skipTestIf(value, text="Test not intended for this module profile"):


from moduleframework import module_framework
#



class ModuleLintSigning(module_framework.AvocadoTest):
    """
    :avocado: disable
    :avocado: tags=WIP,rhel,fedora,docker,module,package_signing_test,generic
    """

    def setUp(self):
        # it is not intended just for docker, but just docker packages are
        # actually properly signed
        if self.moduleType != "docker" and self.moduleType != "openshift":
            self.cancel("Docker or OpenShift specific test")
        super(self.__class__, self).setUp()

    def test(self):
        RHKEY = "fd431d51"
        FEDKEY = "73bde98381b46521"
        KEY = FEDKEY
        self.start()
        allpackages = self.run(
            r'rpm -qa --qf="%{{name}}-%{{version}}-%{{release}} %{{SIGPGP:pgpsig}}\n"').stdout
        for package in [x.strip() for x in allpackages.split('\n')]:
            pinfo = package.split(', ')
            if len(pinfo) == 3:
                self.assertIn(KEY, pinfo[2])



# Path: moduleframework/module_framework.py
# PROFILE = None
# def skipTestIf(value, text="Test not intended for this module profile"):


# Path: moduleframework/tests/generic/modulelint.py
from moduleframework import module_framework

#



class ModuleLintSigning(module_framework.AvocadoTest):
    """
    :avocado: disable
    :avocado: tags=WIP,rhel,fedora,docker,module,package_signing_test,generic
    """

    def setUp(self):
        # it is not intended just for docker, but just docker packages are
        # actually properly signed
        if self.moduleType != "docker" and self.moduleType != "openshift":
            self.cancel("Docker or OpenShift specific test")
        super(self.__class__, self).setUp()

    def test(self):
        RHKEY = "fd431d51"
        FEDKEY = "73bde98381b46521"
        KEY = FEDKEY
        self.start()
        allpackages = self.run(
            r'rpm -qa --qf="%{{name}}-%{{version}}-%{{release}} %{{SIGPGP:pgpsig}}\n"').stdout
        for package in [x.strip() for x in allpackages.split('\n')]:
            pinfo = package.split(', ')
            if len(pinfo) == 3:
                self.assertIn(KEY, pinfo[2])



class ModuleLintPackagesCheck(module_framework.AvocadoTest):