def setUpClass(self): self.tmp_dir = tempfile.mkdtemp(prefix="lorax.test.dnfbase.") # will read the above configuration config = configure(root_dir=self.tmp_dir) lifted.config.configure(config) make_dnf_dirs(config, os.getuid(), os.getgid()) # will read composer config and store a dnf config file self.dbo = get_base_object(config) # will read the stored dnf config file self.dnfconf = configparser.ConfigParser() self.dnfconf.read([config.get("composer", "dnf_conf")])
def test_lifted_libdir_config(self): """Test lifted config setup with custom lib_dir""" config = pylorax.api.config.configure(test_config=True) config.set("composer", "lib_dir", "/custom/lib/path") lifted.config.configure(config) self.assertEqual(config.get("composer", "lib_dir"), "/custom/lib/path") self.assertTrue( config.get("upload", "providers_dir").startswith( config.get("composer", "share_dir"))) self.assertTrue( config.get("upload", "queue_dir").startswith( config.get("composer", "lib_dir"))) self.assertTrue( config.get("upload", "settings_dir").startswith( config.get("composer", "lib_dir")))
def test_lifted_config(self): """Test lifted config setup""" config = pylorax.api.config.configure(test_config=True) lifted.config.configure(config) self.assertTrue( config.get("upload", "providers_dir").startswith( config.get("composer", "share_dir"))) self.assertTrue( config.get("upload", "queue_dir").startswith( config.get("composer", "lib_dir"))) self.assertTrue( config.get("upload", "settings_dir").startswith( config.get("composer", "lib_dir")))
def setUpClass(self): self.tmp_dir = tempfile.mkdtemp(prefix="lorax.test.dnfbase.") conf_file = os.path.join(self.tmp_dir, 'test.conf') open(conf_file, 'w').write("""[composer] # releasever different from the current default releasever = 6 [dnf] proxy = https://proxy.example.com sslverify = False [repos] use_system_repos = False """) # will read the above configuration config = configure(conf_file=conf_file, root_dir=self.tmp_dir) lifted.config.configure(config) make_dnf_dirs(config, os.getuid(), os.getgid()) # will read composer config and store a dnf config file self.dbo = get_base_object(config) # will read the stored dnf config file self.dnfconf = configparser.ConfigParser() self.dnfconf.read([config.get("composer", "dnf_conf")])
def test_configure_reads_non_existing_file(self): config = configure(conf_file=self.conf_file + '.non-existing') lifted.config.configure(config) self.assertEqual(config.get('composer', 'cache_dir'), '/var/tmp/composer/cache')
def test_configure_reads_existing_file(self): config = configure(conf_file=self.conf_file) lifted.config.configure(config) self.assertEqual(config.get('composer', 'cache_dir'), '/tmp/cache-test')