# Path: moduleframework/avocado_testers/container_avocado_test.py
# class ContainerAvocadoTest(avocado_test.AvocadoTest):
#     def setUp(self):
#     def checkLabel(self, key, value):


from moduleframework.avocado_testers import container_avocado_test
        """
        exts = ["solv", "solvx", "xml.gz", "rpm"]
        return self._check_container_files(exts, "dnf")

    def _yum_clean_all(self):
        """
        Function checks if files with relevant extensions exist in /var/cache/dnf directory
        :return: True if at least one file exists
                 False if no file exists
        """
        # extensions are taken from https://github.com/rpm-software-management/yum/blob/master/yum/__init__.py#L2854
        exts = ['rpm', 'sqlite', 'sqlite.bz2', 'xml.gz', 'asc', 'mirrorlist.txt', 'cachecookie', 'xml']
        return self._check_container_files(exts, "yum")

    def test_docker_clean_all(self):
        """
        This test checks if `dnf/yum clean all` was called in image

        :return: return True if clean all is called
                 return False if clean all is not called
        """
        self.start()
        # Detect distro in image
        distro = self.run("cat /etc/os-release").stdout
        if 'Fedora' in distro:
            self.assertFalse(self._dnf_clean_all(), msg="`dnf clean all` is not present in Dockerfile.")
        else:
            self.assertFalse(self._yum_clean_all(), msg="`yum clean all` is not present in Dockerfile.")



# Path: moduleframework/avocado_testers/container_avocado_test.py
# class ContainerAvocadoTest(avocado_test.AvocadoTest):
#     def setUp(self):
#     def checkLabel(self, key, value):


# Path: moduleframework/tests/generic/dockerlint.py
from moduleframework.avocado_testers import container_avocado_test

        """
        exts = ["solv", "solvx", "xml.gz", "rpm"]
        return self._check_container_files(exts, "dnf")

    def _yum_clean_all(self):
        """
        Function checks if files with relevant extensions exist in /var/cache/dnf directory
        :return: True if at least one file exists
                 False if no file exists
        """
        # extensions are taken from https://github.com/rpm-software-management/yum/blob/master/yum/__init__.py#L2854
        exts = ['rpm', 'sqlite', 'sqlite.bz2', 'xml.gz', 'asc', 'mirrorlist.txt', 'cachecookie', 'xml']
        return self._check_container_files(exts, "yum")

    def test_docker_clean_all(self):
        """
        This test checks if `dnf/yum clean all` was called in image

        :return: return True if clean all is called
                 return False if clean all is not called
        """
        self.start()
        # Detect distro in image
        distro = self.run("cat /etc/os-release").stdout
        if 'Fedora' in distro:
            self.assertFalse(self._dnf_clean_all(), msg="`dnf clean all` is not present in Dockerfile.")
        else:
            self.assertFalse(self._yum_clean_all(), msg="`yum clean all` is not present in Dockerfile.")



class DockerLint(container_avocado_test.ContainerAvocadoTest):