def test_fpm_string_creation(self):
     package = packman.get_package_config(
         'mock_package', packages_file=TEST_PACKAGES_FILE)
     fpm_params = {
         'version': package.get(defs.PARAM_VERSION, False),
         'force': package.get(defs.PARAM_OVERWRITE_OUTPUT, True),
         'depends': package.get(defs.PARAM_DEPENDS, False),
         'after_install':
         package.get(defs.PARAM_BOOTSTRAP_SCRIPT_PATH, False),
         # need to add these to the test
         'chdir': False,
         'before_install': None
     }
     packager = fpm.Handler(
         package['name'], package['source_package_type'],
         package['destination_package_types'][0],
         package['sources_path'])
     fpm_command_string = packager._build_cmd_string(**fpm_params)
     self.assertIn('-s {0}'.format(package['source_package_type']), str(fpm_command_string))  # NOQA
     self.assertIn('-t {0}'.format(package['destination_package_types'][0][0:-3]), str(fpm_command_string))  # NOQA
     self.assertIn('-n {0}'.format(package['name']), str(fpm_command_string))  # NOQA
     self.assertIn('-v {0}'.format(package['version']), str(fpm_command_string))  # NOQA
     self.assertIn('--after-install {0}'.format(os.path.join(os.getcwd(), package['bootstrap_script'])), str(fpm_command_string))  # NOQA
     self.assertIn('-d {0}'.format(package['depends'][0]), str(fpm_command_string))  # NOQA
     self.assertIn('-d {0}'.format(package['depends'][1]), str(fpm_command_string))  # NOQA
     self.assertIn('-f', str(fpm_command_string))
     self.assertIn(package['sources_path'], str(fpm_command_string))
Example #2
0
 def test_fpm_string_creation(self):
     package = packman.get_package_config('mock_package',
                                          packages_file=TEST_PACKAGES_FILE)
     fpm_params = {
         'version': package.get(defs.PARAM_VERSION, False),
         'force': package.get(defs.PARAM_OVERWRITE_OUTPUT, True),
         'depends': package.get(defs.PARAM_DEPENDS, False),
         'after_install': package.get(defs.PARAM_BOOTSTRAP_SCRIPT_PATH,
                                      False),
         # need to add these to the test
         'chdir': False,
         'before_install': None
     }
     packager = fpm.Handler(package['name'], package['source_package_type'],
                            package['destination_package_types'][0],
                            package['sources_path'])
     fpm_command_string = packager._build_cmd_string(**fpm_params)
     self.assertIn('-s {0}'.format(package['source_package_type']),
                   str(fpm_command_string))  # NOQA
     self.assertIn('-t {0}'.format(
         package['destination_package_types'][0][0:-3]),
                   str(fpm_command_string))  # NOQA
     self.assertIn('-n {0}'.format(package['name']),
                   str(fpm_command_string))  # NOQA
     self.assertIn('-v {0}'.format(package['version']),
                   str(fpm_command_string))  # NOQA
     self.assertIn('--after-install {0}'.format(
         os.path.join(os.getcwd(), package['bootstrap_script'])),
                   str(fpm_command_string))  # NOQA
     self.assertIn('-d {0}'.format(package['depends'][0]),
                   str(fpm_command_string))  # NOQA
     self.assertIn('-d {0}'.format(package['depends'][1]),
                   str(fpm_command_string))  # NOQA
     self.assertIn('-f', str(fpm_command_string))
     self.assertIn(package['sources_path'], str(fpm_command_string))
 def test_config_generation_from_template_dir(self):
     package = packman.get_package_config(
         'mock_package', packages_file=TEST_PACKAGES_FILE)
     del package['config_templates']['template_file']
     del package['config_templates']['config_dir']
     self.generate_configs(package)
     with open(os.path.join(package['sources_path'],
               package['config_templates']['template_dir']['config_dir'],  # NOQA
               TEST_TEMPLATE_FILE.split('.')[0:-1][0]), 'r') as f:
         self.assertIn(package['test_template_parameter'], f.read())
     shutil.rmtree(package['sources_path'])
Example #4
0
 def test_config_generation_from_config_dir(self):
     package = packman.get_package_config('mock_package',
                                          packages_file=TEST_PACKAGES_FILE)
     del package['config_templates']['template_dir']
     del package['config_templates']['template_file']
     self.generate_configs(package)
     with open(
             os.path.join(
                 package['sources_path'],
                 package['config_templates']['config_dir']['config_dir'],
                 TEST_TEMPLATE_FILE), 'r') as f:
         self.assertTrue('test_template_parameter' in f.read())
     shutil.rmtree(package['sources_path'])
Example #5
0
 def test_config_generation_from_template_file_no_perm(self):
     package = packman.get_package_config('mock_package',
                                          packages_file=TEST_PACKAGES_FILE)
     del package['config_templates']['template_dir']
     del package['config_templates']['config_dir']
     self.generate_configs(package)
     with open(
             os.path.join(
                 package['sources_path'],
                 package['config_templates']['template_file']
                 ['config_dir'],  # NOQA
                 package['config_templates']['template_file']
                 ['output_file']),
             'r') as f:
         self.assertIn(package['test_template_parameter'], f.read())
     shutil.rmtree(package['sources_path'])
Example #6
0
 def test_get_package_config_file(self):
     c = packman.get_package_config('mock_package',
                                    packages_file=TEST_PACKAGES_FILE)
     self.assertEqual(c['name'], 'test_package')
Example #7
0
 def test_get_package_config_dict(self):
     c = packman.get_package_config('test_component', MOCK_PACKAGES_DICT)
     self.assertEqual(c, 'x')
 def test_get_package_config_file(self):
     c = packman.get_package_config(
         'mock_package', packages_file=TEST_PACKAGES_FILE)
     self.assertEqual(c['name'], 'test_package')
 def test_get_package_config_dict(self):
     c = packman.get_package_config('test_component', MOCK_PACKAGES_DICT)
     self.assertEqual(c, 'x')