Пример #1
0
 def test_configure_local_environment(self):
     config = ConfigureLocalCommand(self.app, Namespace())
     config.__dict__.update({i.dest: i.default \
       for i in config.get_parser(None)._option_string_actions.values()})
     config.slapos_configuration_directory = self.temp_dir
     config.slapos_buildout_directory = self.temp_dir
     config.slapos_instance_root = self.instance_root
     config.slapos_software_root = self.software_root
     slapos.cli.configure_local.do_configure(
         config, config.fetch_config, self.app.log)
     log_folder = os.path.join(config.slapos_buildout_directory, 'log')
     self.assertTrue(os.path.exists(log_folder), "%s not exists" % log_folder)
     self.assertTrue(
         os.path.exists("%s/.slapos/slapos-client.cfg" % self.temp_dir))
     with open(self.temp_dir + '/slapos-proxy.cfg') as fout:
         proxy_config = ConfigParser()
         proxy_config.readfp(fout)
         self.assertEquals(proxy_config.get('slapos', 'instance_root'),
             self.instance_root)
         self.assertEquals(proxy_config.get('slapos', 'software_root'),
             self.software_root)
     with open(self.temp_dir + '/slapos.cfg') as fout:
         proxy_config = ConfigParser()
         proxy_config.readfp(fout)
         self.assertEquals(proxy_config.get('slapos', 'instance_root'),
             self.instance_root)
         self.assertEquals(proxy_config.get('slapos', 'software_root'),
             self.software_root)
         log_file = proxy_config.get('slapformat', 'log_file')
         self.assertTrue(log_file.startswith(log_folder),
             "%s don't starts with %s" % (log_file, log_folder))
Пример #2
0
 def test_configure_local_environment_with_default_value(self):
     config = ConfigureLocalCommand(self.app, Namespace())
     config.__dict__.update({i.dest: i.default \
       for i in config.get_parser(None)._option_string_actions.values()})
     config.slapos_configuration_directory = self.temp_dir
     config.slapos_buildout_directory = self.temp_dir
     config.slapos_instance_root = self.instance_root
     slapos.cli.configure_local.do_configure(
         config, config.fetch_config, self.app.log)
     expected_software_root = "/opt/slapgrid"
     self.assertTrue(
         os.path.exists("%s/.slapos/slapos-client.cfg" % self.temp_dir))
     with open(self.temp_dir + '/slapos-proxy.cfg') as fout:
         proxy_config = ConfigParser()
         proxy_config.readfp(fout)
         self.assertEquals(proxy_config.get('slapos', 'instance_root'),
             self.instance_root)
         self.assertEquals(proxy_config.get('slapos', 'software_root'),
             expected_software_root)
     with open(self.temp_dir + '/slapos.cfg') as fout:
         proxy_config = ConfigParser()
         proxy_config.readfp(fout)
         self.assertEquals(proxy_config.get('slapos', 'instance_root'),
             self.instance_root)
         self.assertEquals(proxy_config.get('slapos', 'software_root'),
             expected_software_root)