|
Packit Service |
21c75c |
# -*- coding: utf-8 -*-
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
from __future__ import absolute_import
|
|
Packit Service |
21c75c |
from __future__ import unicode_literals
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
import dnf
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
from .common import TestCase
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
class DnfConfTest(TestCase):
|
|
Packit Service |
21c75c |
def setUp(self):
|
|
Packit Service |
21c75c |
self.base = dnf.Base(dnf.conf.Conf())
|
|
Packit Service |
21c75c |
self.conf = self.base.conf
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
def tearDown(self):
|
|
Packit Service |
21c75c |
self.base.close()
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
def test_priorities(self):
|
|
Packit Service |
21c75c |
self.assertHasAttr(dnf.conf.config, "PRIO_EMPTY")
|
|
Packit Service |
21c75c |
self.assertHasType(dnf.conf.config.PRIO_EMPTY, int)
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
self.assertHasAttr(dnf.conf.config, "PRIO_DEFAULT")
|
|
Packit Service |
21c75c |
self.assertHasType(dnf.conf.config.PRIO_DEFAULT, int)
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
self.assertHasAttr(dnf.conf.config, "PRIO_MAINCONFIG")
|
|
Packit Service |
21c75c |
self.assertHasType(dnf.conf.config.PRIO_MAINCONFIG, int)
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
self.assertHasAttr(dnf.conf.config, "PRIO_AUTOMATICCONFIG")
|
|
Packit Service |
21c75c |
self.assertHasType(dnf.conf.config.PRIO_AUTOMATICCONFIG, int)
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
self.assertHasAttr(dnf.conf.config, "PRIO_REPOCONFIG")
|
|
Packit Service |
21c75c |
self.assertHasType(dnf.conf.config.PRIO_REPOCONFIG, int)
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
self.assertHasAttr(dnf.conf.config, "PRIO_PLUGINDEFAULT")
|
|
Packit Service |
21c75c |
self.assertHasType(dnf.conf.config.PRIO_PLUGINDEFAULT, int)
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
self.assertHasAttr(dnf.conf.config, "PRIO_PLUGINCONFIG")
|
|
Packit Service |
21c75c |
self.assertHasType(dnf.conf.config.PRIO_PLUGINCONFIG, int)
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
self.assertHasAttr(dnf.conf.config, "PRIO_COMMANDLINE")
|
|
Packit Service |
21c75c |
self.assertHasType(dnf.conf.config.PRIO_COMMANDLINE, int)
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
self.assertHasAttr(dnf.conf.config, "PRIO_RUNTIME")
|
|
Packit Service |
21c75c |
self.assertHasType(dnf.conf.config.PRIO_RUNTIME, int)
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
def test_get_reposdir(self):
|
|
Packit Service |
21c75c |
# Conf.get_reposdir
|
|
Packit Service |
21c75c |
self.conf.reposdir = ["."]
|
|
Packit Service |
21c75c |
self.assertHasAttr(self.conf, "get_reposdir")
|
|
Packit Service |
21c75c |
self.assertHasType(self.conf.get_reposdir, str)
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
def test_substitutions(self):
|
|
Packit Service |
21c75c |
# Conf.substitutions
|
|
Packit Service |
21c75c |
self.assertHasAttr(self.conf, "substitutions")
|
|
Packit Service |
21c75c |
self.assertHasType(self.conf.substitutions, dnf.conf.substitutions.Substitutions)
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
def test_tempfiles(self):
|
|
Packit Service |
21c75c |
# Conf.tempfiles
|
|
Packit Service |
21c75c |
self.assertHasAttr(self.conf, "tempfiles")
|
|
Packit Service |
21c75c |
self.assertHasType(self.conf.tempfiles, list)
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
def test_exclude_pkgs(self):
|
|
Packit Service |
21c75c |
# Conf.exclude_pkgs
|
|
Packit Service |
21c75c |
self.assertHasAttr(self.conf, "exclude_pkgs")
|
|
Packit Service |
21c75c |
self.conf.exclude_pkgs(pkgs=["package_a", "package_b"])
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
def test_prepend_installroot(self):
|
|
Packit Service |
21c75c |
# Conf.prepend_installroot
|
|
Packit Service |
21c75c |
self.assertHasAttr(self.conf, "prepend_installroot")
|
|
Packit Service |
21c75c |
self.conf.prepend_installroot(optname="logdir")
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
def test_read(self):
|
|
Packit Service |
21c75c |
# Conf.read
|
|
Packit Service |
21c75c |
self.assertHasAttr(self.conf, "read")
|
|
Packit Service |
21c75c |
self.conf.read(filename=None, priority=dnf.conf.config.PRIO_DEFAULT)
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
def test_dump(self):
|
|
Packit Service |
21c75c |
# Conf.dump
|
|
Packit Service |
21c75c |
self.assertHasAttr(self.conf, "dump")
|
|
Packit Service |
21c75c |
self.assertHasType(self.conf.dump(), str)
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
def test_releasever(self):
|
|
Packit Service |
21c75c |
# Conf.releasever
|
|
Packit Service |
21c75c |
self.assertHasAttr(self.conf, "releasever")
|
|
Packit Service |
21c75c |
self.conf.releasever = "test setter"
|
|
Packit Service |
21c75c |
self.assertHasType(self.conf.releasever, str)
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
def test_arch(self):
|
|
Packit Service |
21c75c |
# Conf.arch
|
|
Packit Service |
21c75c |
self.assertHasAttr(self.conf, "arch")
|
|
Packit Service |
21c75c |
self.conf.arch = "aarch64"
|
|
Packit Service |
21c75c |
self.assertHasType(self.conf.arch, str)
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
def test_basearch(self):
|
|
Packit Service |
21c75c |
# Conf.basearch
|
|
Packit Service |
21c75c |
self.assertHasAttr(self.conf, "basearch")
|
|
Packit Service |
21c75c |
self.conf.basearch = "aarch64"
|
|
Packit Service |
21c75c |
self.assertHasType(self.conf.basearch, str)
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
def test_write_raw_configfile(self):
|
|
Packit Service |
21c75c |
# Conf.write_raw_configfile
|
|
Packit Service |
21c75c |
self.assertHasAttr(self.conf, "write_raw_configfile")
|
|
Packit Service |
21c75c |
s = dnf.conf.substitutions.Substitutions()
|
|
Packit Service |
21c75c |
self.conf.write_raw_configfile(filename="file.conf", section_id='main', substitutions=s, modify={})
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
class DnfSubstitutionsTest(TestCase):
|
|
Packit Service |
21c75c |
def test_update_from_etc(self):
|
|
Packit Service |
21c75c |
# Substitutions.update_from_etc
|
|
Packit Service |
21c75c |
substitutions = dnf.conf.substitutions.Substitutions()
|
|
Packit Service |
21c75c |
self.assertHasAttr(substitutions, "update_from_etc")
|
|
Packit Service |
21c75c |
substitutions.update_from_etc(installroot="path", varsdir=("/etc/path/", "/etc/path2"))
|