Some tests for the implementation of the method for join value of the append parameter was written.

packages
Иванов Денис 4 years ago
parent d655b746c7
commit f64fd98e38

@ -122,10 +122,8 @@
"tests/templates/format/test_xml_gconf.py::TestParsingMethods::test_joining_documents_1": true,
"tests/templates/format/test_xml_xfce.py::TestParsingMethods::test_if_input_document_contains_just_few_parameter_lines__the_initialised_object_contains_correct_dictionary": true,
"tests/templates/format/test_xml_xfce.py::TestParsingMethods::test_joining_documents_1": true,
"tests/templates/test_directory_processor.py": true,
"tests/templates/test_directory_processor.py::TestDirectoryProcessor::test_just_for_debug_with_package_value": true,
"tests/templates/test_directory_processor.py::TestDirectoryProcessor::test_just_for_debug_without_package_value": true,
"tests/templates/test_parameters_processor.py": true,
"tests/templates/test_parameters_processor.py::TestTemplateParameters::test_if_TemplateParameters_bla_bla": true,
"tests/templates/test_parameters_processor.py::TestTemplateParameters::test_if_TemplateParameters_object_is_initialized_accoding_to_dictionary_of_correct_template_parameters__the_TemplateParameters_object_contains_processed_parameters_as_its_attributes_including_default_values": true,
"tests/templates/test_parameters_processor.py::TestTemplateParameters::test_if_TemplateParameters_object_is_initialized_using_": true,
@ -146,7 +144,6 @@
"tests/templates/test_parameters_processor.py::TestTemplateParameters::test_if_TemplateParameters_object_is_intialized_using_source_parameter_with_unexisting_file_path__the_initialization_of_the_object_will_be_failed": true,
"tests/templates/test_template_action.py": true,
"tests/templates/test_template_action.py::TestTemplateAction::test_create_directory": true,
"tests/templates/test_template_engine.py": true,
"tests/templates/test_template_engine.py::TestTemplateEngine::test_if_an_input_template_binded_with_datavars_module__variables_available_in_a_template": true,
"tests/templates/test_template_engine.py::TestTemplateEngine::test_if_an_input_template_calculate_tag_contains_pkg_function_with_an_existing_package_in_its_argument__the_pkg_function_returns_version_value_of_the_package_from_package_parameter_without_any_exceptions": true,
"tests/templates/test_template_engine.py::TestTemplateEngine::test_if_an_input_template_contains_calculate_tag_with_some_parameters__the_template_engine_object_will_collect_its_parameters": true,
@ -160,17 +157,18 @@
"tests/templates/test_template_engine.py::TestTemplateEngine::test_if_an_input_template_contains_several_conditions_and_it_is_False__the_template_engine_raises_ConditionFailed_exception": true,
"tests/templates/test_template_engine.py::TestTemplateEngine::test_if_an_input_template_contains_variables_in_its_text__the_rendered_text_will_contain_values_of_this_variables": true,
"tests/templates/test_template_engine.py::TestTemplateEngine::test_if_value_of_variable_is_set_using_save_tag__the_new_value_of_variable_can_be_used_in_template": true,
"tests/templates/test_template_executor.py": true,
"tests/templates/test_template_executor.py::TestTemplateAction": true,
"tests/templates/test_template_executor.py::TestTemplateAction::test_if_chown_value_is_not_correct__a_TemplateExecutor_object_throws_TemplateExecutorError_exception": true,
"tests/templates/test_template_executor.py::TestTemplateExecutor::test_for_the_testfiles_backup": true,
"tests/templates/test_template_executor.py::TestTemplateExecutor::test_if_append_clear_directory_method_s_input_is_a_template_with_a_target_path_to_an_unexisting_directory_that_does_not_belong_to_the_template_package__the_method_just_removes_the_directory_and_all_its_files_from_a_package_CONTENTS_file": true,
"tests/templates/test_template_executor.py::TestTemplateExecutor::test_if_append_join_directory_method_s_input_is_a_template_with_a_target_path_to_an_existing_directory_belongs_to_the_template_package__the_method_throws_TemplateCollisionError_error": true,
"tests/templates/test_template_executor.py::TestTemplateExecutor::test_if_append_replace_directory_method_s_input_is_a_template_with_a_target_path_to_an_unexisting_directory_and_the_chown_and_the_chmod_parameters_are_set__the_method_creates_new_directory_and_add_it_to_a_package_CONTENTS_file": true,
"tests/templates/test_template_executor.py::TestTemplateExecutor::test_if_the_link_directory_method_s_input_is_a_path_to_an_existing_source_file_and_a_target_path__the_method_creates_a_link_to_a_source_file": true,
"tests/templates/test_template_executor.py::TestTemplateExecutor::test_if_the_link_directory_method_s_input_is_a_path_to_an_unexisting_source_directory_and_a_target_path__the_method_does_nothing": true,
"tests/templates/test_template_executor.py::TestTemplateExecutor::test_if_the_link_directory_method_s_input_is_a_path_to_an_unexisting_source_directory_and_a_target_path__the_method_raises_the_TemplateExecutorError_exception": true,
"tests/templates/test_template_executor.py::TestTemplateExecutor::test_if_the_remove_file_method_s_input_is_a_path_to_an_existing_file__the_method_raises_TemplateExecutorError_exception": true,
"tests/templates/test_template_executor.py::TestTemplateExecutor::test_if_the_remove_file_method_s_input_is_a_path_to_an_existing_link_to_an_existing_file__the_method_raises_TemplateExecutorError_exception": true,
"tests/templates/test_template_executor.py::TestTemplateExecutor::test_to_add_link": true,
"tests/templates/test_template_wrapper.py": true,
"tests/templates/test_template_wrapper.py::TestTemplateWrapper::test_if_TemplateWrapper_object_contains_package_value__the_wrapper_can_use_Package_object_for_changing_CONTENTS_file_of_the_package": true,
"tests/templates/test_template_wrapper.py::TestTemplateWrapper::test_if_a_TemplateWrapper_object_successfully_initialized__the_object_can_be_used_for_a_removing_current_file_from_its_package": true,
"tests/templates/test_template_wrapper.py::TestTemplateWrapper::test_if_a_TemplateWrapper_object_successfully_initialized__the_object_can_be_used_for_an_adding_any_files_to_its_package_and_hash_will_be_calculated_automatically": true,

@ -62,13 +62,12 @@
"tests/templates/test_template_executor.py::TestTemplateExecutor::test_if_the_get_file_mode_method_is_called_with_a_path_to_a_file_that_exists__the_method_returns_its_mode_value",
"tests/templates/test_template_executor.py::TestTemplateExecutor::test_if_the_get_file_mode_method_is_called_with_a_path_to_a_file_that_does_not_exists__the_method_throws_TemplateExecutorError_exception",
"tests/templates/test_template_executor.py::TestTemplateExecutor::test_if_the_create_directory_method_input_is_a_template_with_a_target_path_to_an_existing_directory_and_chown_and_chmod_parameters_is_not_set__the_method_does_nothing",
"tests/templates/test_template_executor.py::TestTemplateExecutor::test_if_the_create_directory_method_input_is_a_template_with_a_target_path_to_an_existing_directory_and_chown_and_chmod_parameters_is_set__the_method_does_nothing",
"tests/templates/test_template_executor.py::TestTemplateExecutor::test_if_the_create_directory_method_input_is_a_template_with_a_target_path_to_an_existing_directory_and_chown_and_chmod_parameters_is_set__the_method_chmod_and_chown_target_file",
"tests/templates/test_template_executor.py::TestTemplateExecutor::test_if_the_create_directory_method_input_is_a_template_with_a_target_path_to_an_unexisting_directory_from_an_existing_directory_and_chown_and_chmod_parameters_is_not_set__the_method_creates_one_new_directory_with_a_mode_and_an_owner_of_its_parent_directory",
"tests/templates/test_template_executor.py::TestTemplateExecutor::test_if_the_create_directory_method_input_is_a_template_with_a_target_path_to_an_unexisting_directory_from_an_existing_directory_and_chown_and_chmod_parameters_is_set__the_method_one_new_directory_with_a_mode_and_an_owner_from_the_parameters",
"tests/templates/test_template_executor.py::TestTemplateExecutor::test_if_the_create_directory_method_input_is_a_template_with_a_target_path_to_an_unexisting_directory_from_an_unexisting_directory_and_chown_and_chmod_parameters_is_not_set__the_method_creates_new_directory_and_all_its_parents_with_a_mode_and_an_owner_of_its_existing_parent",
"tests/templates/test_template_executor.py::TestTemplateExecutor::test_if_the_create_directory_method_s_input_is_a_template_with_a_target_path_to_an_unexisting_directory_from_an_unexisting_directory_and_chown_and_chmod_parameters_is_set__the_method_creates_new_directory_and_all_its_parents_with_a_mode_and_an_owner_from_the_parameters",
"tests/templates/test_template_executor.py::TestTemplateExecutor::test_if_the_link_directory_method_s_input_is_a_path_to_an_existing_source_directory_and_a_target_path__the_method_creates_a_link_to_a_source_file",
"tests/templates/test_template_executor.py::TestTemplateExecutor::test_if_the_link_directory_method_s_input_is_a_path_to_an_existing_source_file_and_a_target_path__the_method_creates_a_link_to_a_source_file",
"tests/templates/test_template_executor.py::TestTemplateExecutor::test_if_the_link_directory_method_s_input_is_a_path_to_an_existing_source_directory_and_a_target_path_to_an_existing_link__the_method_raises_the_TemplateExecutorError_exception",
"tests/templates/test_template_executor.py::TestTemplateExecutor::test_if_the_remove_directory_method_s_input_is_a_path_to_an_existing_empty_directory__the_method_will_remove_the_directory",
"tests/templates/test_template_executor.py::TestTemplateExecutor::test_if_the_remove_directory_method_s_input_is_a_path_to_an_existing_directory_that_contains_a_some_files__the_method_will_remove_the_directory",
@ -83,9 +82,9 @@
"tests/templates/test_template_executor.py::TestTemplateExecutor::test_if_the_clear_directory_method_s_input_is_a_path_to_an_unexisting_directory__the_method_raises_TemplateExecutorError_exception",
"tests/templates/test_template_executor.py::TestTemplateExecutor::test_if_the_clear_directory_method_s_input_is_a_path_to_a_file__the_method_raises_TemplateExecutorError_exception",
"tests/templates/test_template_executor.py::TestTemplateExecutor::test_if_the_link_file_method_s_input_is_a_path_to_an_existing_source_file_and_a_target_path__the_method_creates_a_link_to_a_source_file",
"tests/templates/test_template_executor.py::TestTemplateExecutor::test_if_the_link_file_method_s_input_is_a_path_to_an_existing_source_file_and_a_target_path_to_an_existing_file__the_method_creates_a_link_to_a_source_file",
"tests/templates/test_template_executor.py::TestTemplateExecutor::test_if_the_remove_file_method_s_input_is_a_path_to_an_existing_file__the_method_raises_TemplateExecutorError_exception",
"tests/templates/test_template_executor.py::TestTemplateExecutor::test_if_the_remove_file_method_s_input_is_a_path_to_an_existing_link_to_an_existing_file__the_method_raises_TemplateExecutorError_exception",
"tests/templates/test_template_executor.py::TestTemplateExecutor::test_if_the_link_file_method_s_input_is_a_path_to_an_existing_source_file_and_a_target_path_to_an_existing_file__the_method_throws_TemplateExecutorError_exception",
"tests/templates/test_template_executor.py::TestTemplateExecutor::test_if_the_remove_file_method_s_input_is_a_path_to_an_existing_file__the_method_removes_a_file",
"tests/templates/test_template_executor.py::TestTemplateExecutor::test_if_the_remove_file_method_s_input_is_a_path_to_an_existing_link_to_an_existing_file__the_method_removes_a_file",
"tests/templates/test_template_executor.py::TestTemplateExecutor::test_if_the_remove_file_method_s_input_is_a_path_to_an_unexisting_file__the_method_raises_TemplateExecutorError_exception",
"tests/templates/test_template_executor.py::TestTemplateExecutor::test_if_the_remove_file_method_s_input_is_a_path_to_an_existing_directory__the_method_raises_TemplateExecutorError_exception",
"tests/templates/test_template_executor.py::TestTemplateExecutor::test_if_clear_file_method_s_input_is_a_path_to_an_existing_empty_file__the_method_does_nothing",
@ -106,13 +105,21 @@
"tests/templates/test_template_executor.py::TestTemplateExecutor::test_if_append_clear_directory_method_s_input_is_a_template_with_a_target_path_to_an_existing_directory_that_belongs_to_the_template_package_and_chmod_and_chown_parameters_are_set__the_method_clears_directory_removes_all_its_files_from_a_package_CONTENTS_file_and_chmod_and_chown_one",
"tests/templates/test_template_executor.py::TestTemplateExecutor::test_if_append_replace_directory_method_s_input_is_a_template_with_a_target_path_to_an_unexisting_directory__the_method_creates_new_directory_and_add_it_to_a_package_CONTENTS_file",
"tests/templates/test_template_executor.py::TestTemplateExecutor::test_if_append_replace_directory_method_s_input_is_a_template_with_a_target_path_to_an_unexisting_directory_and_the_chown_and_the_chmod_parameters_are_set__the_method_creates_new_directory_adds_it_to_a_package_CONTENTS_file_and_chown_and_chmod_directory",
"tests/templates/test_template_executor.py::TestTemplateExecutor::test_add_to_contents",
"tests/templates/test_template_executor.py::TestTemplateExecutor::test_if_append_replace_directory_method_s_input_is_a_template_with_a_target_path_to_an_existing_empty_directory_that_belongs_to_the_template_package__the_method_does_nothing",
"tests/templates/test_template_executor.py::TestTemplateExecutor::test_if_append_replace_directory_method_s_input_is_a_template_with_a_target_path_to_an_existing_empty_directory_that_belongs_to_the_template_package_and_the_chown_and_chmod_parameters_are_set__the_method_just_chown_and_chmod_a_target_directory",
"tests/templates/test_template_executor.py::TestTemplateExecutor::test_if_append_replace_directory_method_s_input_is_a_template_with_a_target_path_to_an_existing_directory_with_some_files_that_belongs_to_the_template_package__the_method_clears_directory_and_removes_all_its_files_from_a_package_CONTENTS_file",
"tests/templates/test_template_executor.py::TestTemplateExecutor::test_if_append_replace_directory_method_s_input_is_a_template_with_a_target_path_to_an_existing_directory_with_some_directories_with_files_that_belongs_to_the_template_package__the_method_clears_directory_and_removes_all_its_files_from_a_package_CONTENTS_file",
"tests/templates/test_template_executor.py::TestTemplateExecutor::test_append_link_directory_method_s_input_is_a_template_with_a_target_path_and_a_source_path_to_the_existing_directory__the_method_creates_a_link_to_the_source_directory",
"tests/templates/test_template_executor.py::TestTemplateExecutor::test_append_link_directory_method_s_input_is_a_template_with_a_target_path_and_a_source_path_to_the_existing_directory_and_the_chown_and_chmod_parameters_are_set__the_method_creates_a_link_to_the_source_directory",
"tests/templates/test_template_executor.py::TestTemplateExecutor::test_if_append_link_directory_method_s_input_is_a_template_with_a_target_path_and_a_source_path_to_the_existing_directory__the_method_creates_a_link_to_the_source_directory_and_adds_this_link_to_the_package_CONTENTS_file",
"tests/templates/test_template_executor.py::TestTemplateExecutor::test_if_append_link_directory_method_s_input_is_a_template_with_a_target_path_and_a_source_path_to_the_existing_directory_and_the_chown_and_chmod_parameters_are_set__the_method_creates_a_link_to_the_source_directory_and_adds_this_link_to_the_package_CONTENTS_file",
"tests/templates/test_template_executor.py::TestTemplateExecutor::test_if_append_join_file_method_s_input_is_a_template_with_protected_target_path_to_an_unexisting_file_that_should_not_exist__the_method_creates_new_empty_file_joins_a_template_with_them_adds_file_to_the_package_CONTENTS_file_and_create_an_archive_version_of_a_file",
"tests/templates/test_template_executor.py::TestTemplateExecutor::test_if_append_join_file_method_s_input_is_a_template_with_protected_target_path_to_an_unexisting_file_that_should_exist__the_method_creates_new_empty_cfg_file_joins_a_template_with_them_and_adds_it_to_config_file",
"tests/templates/test_template_executor.py::TestTemplateExecutor::test_if_append_join_file_method_s_input_is_a_template_with_protected_target_path_to_an_unexisting_file_that_should_exist_and_autoupdate_parameters_is_set__the_method_creates_new_empty_file_joins_a_template_with_them_and_adds_it_to_config_file",
"tests/templates/test_template_executor.py::TestTemplateExecutor::test_if_append_join_file_method_s_input_is_a_template_with_protected_target_path_to_an_unexisting_file_that_should_not_exist_and_chown_and_chmod_parameters_are_set__the_method_creates_new_empty_file__joins_a_template_with_them__adds_file_to_the_package_CONTENTS_file__create_an_archive_version_of_a_file_and_chown_and_chmod_it",
"tests/templates/test_template_executor.py::TestTemplateExecutor::test_if_append_join_file_method_s_input_is_a_template_with_protected_target_path_to_an_unexisting_file_that_should_exist_and_chown_and_chmod_parameters_are_set__the_method_creates_new_empty_cfg_file__joins_a_template_with_them__adds_it_to_config_file_and_chown_and_chmod_it",
"tests/templates/test_template_executor.py::TestTemplateExecutor::test_add_to_contents",
"tests/templates/test_template_executor.py::TestTemplateExecutor::test_if_append_join_file_method_s_input_is_a_template_with_protected_target_path_to_an_existing_file_that_belongs_to_the_template_package_and_its_hash_sum_matches_the_hash_from_a_CONTENTS_file__the_method_joins_an_input_file_with_a_template__changes_its_hash_in_the_CONTENTS__updates_config_archive",
"tests/templates/test_template_executor.py::TestTemplateExecutor::test_if_append_join_file_method_s_input_is_a_template_with_protected_target_path_to_an_existing_file_that_belongs_to_the_template_package_its_hash_sum_matches_the_hash_from_a_CONTENTS_file_and_a_chown_and_chmod_parameters_are_set__the_method_joins_an_input_file_with_a_template__changes_its_hash_in_the_CONTENTS__updates_config_archive_and_chown_and_chmod_it",
"tests/templates/test_template_executor.py::TestTemplateExecutor::test_if_append_join_file_method_s_input_is_a_template_with_protected_target_path_to_an_existing_file_that_belongs_to_the_template_package_but_its_hash_sum_does_not_match_the_hash_from_a_CONTENTS_file__the_method_creates_a_cfg_file_and_adds_a_target_file_s_path_to_the_config_file",
"tests/templates/test_template_executor.py::TestTemplateExecutor::test_to_remove_changed_testfiles",
"tests/templates/test_template_wrapper.py::TestTemplateWrapper::test_if_the_TemplateWrapper_object_has_already_been_created__it_contains_the_correct_list_of_protected_and_unprotected_paths",
"tests/templates/test_template_wrapper.py::TestTemplateWrapper::test_if_template_type_is_FILE_and_target_file_does_not_exist__the_TemplateWrapper_target_type_is_None",

@ -60,6 +60,7 @@ class CalculateConfigFile:
"directory instead calculate config file in: {}".
format(self.cl_config_path))
else:
print('creation of the config file')
write_file(self.cl_config_path).close()
return config_dictionary
@ -832,8 +833,7 @@ class TemplateExecutor:
self._chown_file(save_path, chown)
if chmod:
self._chmod_file(save_path, chmod,
check_existation=False)
self._chmod_file(save_path, chmod)
# Убираем все ._cfg файлы.
if template_object.cfg_list:
@ -896,8 +896,7 @@ class TemplateExecutor:
if chown:
self._chown_file(output_path, chown)
if chmod:
self._chmod_file(output_file, chmod,
check_existation=False)
self._chmod_file(output_path, chmod)
# Обновляем CL.
self.calculate_config_file.set_files_md5(
@ -908,7 +907,7 @@ class TemplateExecutor:
pass
# Обновляем CONTENTS.
template_object.add_to_contents(file_md5=output_text_md5)
# template_object.add_to_contents(file_md5=output_text_md5)
def _append_after_file(self, template_object: TemplateWrapper):
'''Метод описывающий действия при append = "after", если шаблон --
@ -953,8 +952,7 @@ class TemplateExecutor:
if template_object.chmod:
self._chmod_file(template_object.target_path,
template_object.parameters.chmod,
check_existation=False)
template_object.parameters.chmod)
template_object.add_to_contents()
@ -967,8 +965,7 @@ class TemplateExecutor:
# Меняем права и владельца файла, на который указывает ссылка.
if template_object.parameters.chmod:
self._chmod_file(template_object.parameters.source,
template_object.parameters.chmod,
check_existation=False)
template_object.parameters.chmod)
if template_object.parameters.chown:
self._chown_file(template_object.parameters.source,

@ -49,6 +49,12 @@ class TestTemplateExecutor:
shutil.copytree(os.path.join(CHROOT_PATH, 'etc.backup'),
os.path.join(CHROOT_PATH, 'etc'),
symlinks=True)
shutil.copytree(os.path.join(
CHROOT_PATH,
'var/lib/calculate/config-archive.backup'),
os.path.join(CHROOT_PATH,
'var/lib/calculate/config-archive'),
symlinks=True)
# Сначала протестируем класс для работы с /var/lib/calculate/config файлом.
def test_if_config_file_does_not_exist__a_CalculateConfigFile_object_will_create_one_while_its_initialization(self):
@ -81,67 +87,79 @@ class TestTemplateExecutor:
calculate_config_file = CalculateConfigFile(
cl_config_path=CONFIG_PATH,
cl_chroot_path=CHROOT_PATH)
md5_value = hashlib.md5(open(join_paths(CHROOT_PATH,
'/etc/file'),
md5_value = hashlib.md5(open(join_paths(
CHROOT_PATH,
'/etc/config_testfiles/file_0'),
'r').read().encode()).hexdigest()
calculate_config_file.set_files_md5('/etc/file', md5_value)
assert '/etc/file' in calculate_config_file
assert calculate_config_file._config_dictionary['/etc/file'] ==\
md5_value
calculate_config_file.set_files_md5('/etc/config_testfiles/file_0',
md5_value)
assert '/etc/config_testfiles/file_0' in calculate_config_file
assert calculate_config_file._config_dictionary[
'/etc/config_testfiles/file_0'] == md5_value
def test_if_a_CalculateConfigFile_object_is_initialized__the_object_can_be_used_for_removing_any_file_from_config_file(self):
calculate_config_file = CalculateConfigFile(
cl_config_path=CONFIG_PATH,
cl_chroot_path=CHROOT_PATH)
md5_value = hashlib.md5(open(join_paths(CHROOT_PATH,
'/etc/file'),
md5_value = hashlib.md5(open(join_paths(
CHROOT_PATH,
'/etc/config_testfiles/file_1'),
'r').read().encode()).hexdigest()
calculate_config_file.set_files_md5('/etc/file', md5_value)
assert '/etc/file' in calculate_config_file
calculate_config_file.set_files_md5('/etc/config_testfiles/file_1',
md5_value)
assert '/etc/config_testfiles/file_1' in calculate_config_file
calculate_config_file.remove_file('/etc/file')
assert '/etc/file' not in calculate_config_file
calculate_config_file.remove_file('/etc/config_testfiles/file_1')
assert '/etc/config_testfiles/file_1' not in calculate_config_file
def test_if_a_CalculateConfigFile_object_contains_file_with_its_hash_and_the_hash_compared_with_equal_hash__the_compare_md5_method_returns_True(self):
calculate_config_file = CalculateConfigFile(
cl_config_path=CONFIG_PATH,
cl_chroot_path=CHROOT_PATH)
md5_value = hashlib.md5(open(join_paths(CHROOT_PATH,
'/etc/file'),
md5_value = hashlib.md5(open(join_paths(
CHROOT_PATH,
'/etc/config_testfiles/file_2'),
'r').read().encode()).hexdigest()
calculate_config_file.set_files_md5('/etc/file', md5_value)
calculate_config_file.set_files_md5('/etc/config_testfiles/file_2',
md5_value)
assert calculate_config_file.compare_md5('/etc/file', md5_value)
assert calculate_config_file.compare_md5(
'/etc/config_testfiles/file_2', md5_value)
def test_if_a_CalculateConfigFile_object_contains_file_with_its_hash_and_the_hash_compared_with_not_equal_hash__the_compare_md5_method_returns_False(self):
calculate_config_file = CalculateConfigFile(
cl_config_path=CONFIG_PATH,
cl_chroot_path=CHROOT_PATH)
md5_value_1 = hashlib.md5(open(join_paths(CHROOT_PATH,
'/etc/file'),
md5_value_1 = hashlib.md5(open(join_paths(
CHROOT_PATH,
'/etc/config_testfiles/file_3'),
'r').read().encode()).hexdigest()
calculate_config_file.set_files_md5('/etc/file', md5_value_1)
calculate_config_file.set_files_md5('/etc/config_testfiles/file_3',
md5_value_1)
if os.path.exists(join_paths(CHROOT_PATH,
'/etc/config_testfiles/file.conf')):
'/etc/config_testfiles/file_4')):
print('File exists')
else:
print('File does not exist')
md5_value_2 = hashlib.md5(open(join_paths(
CHROOT_PATH,
'/etc/config_testfiles/file.conf'),
'/etc/config_testfiles/file_4'),
'r').read().encode()).hexdigest()
assert not calculate_config_file.compare_md5('/etc/file', md5_value_2)
assert not calculate_config_file.compare_md5(
'/etc/config_testfiles/file_3', md5_value_2)
def test_if_a_CalculateConfigFile_object_is_used_for_comparing_a_hash_with_a_hash_of_a_file_that_is_not_in_the_config_file__the_compare_md5_method_returns_False(self):
calculate_config_file = CalculateConfigFile(
cl_config_path=CONFIG_PATH,
cl_chroot_path=CHROOT_PATH)
md5_value = hashlib.md5(open(join_paths(CHROOT_PATH,
'/etc/file'),
md5_value = hashlib.md5(open(join_paths(
CHROOT_PATH,
'/etc/config_testfiles/file_5'),
'r').read().encode()).hexdigest()
assert not calculate_config_file.compare_md5('/etc/file', md5_value)
assert not calculate_config_file.compare_md5(
'/etc/config_testfiles/file_5', md5_value)
def test_if_a_CalculateConfigFile_object_was_used_to_make_changes_in_the_config_file__the_save_changes_method_will_save_the_changes(self):
temporary_chroot = join_paths(
@ -396,7 +414,7 @@ class TestTemplateExecutor:
assert dir_owner == template_executor._get_file_owner(target_directory)
assert dir_mode == template_executor._get_file_mode(target_directory)
def test_if_the_create_directory_method_input_is_a_template_with_a_target_path_to_an_existing_directory_and_chown_and_chmod_parameters_is_set__the_method_does_nothing(self):
def test_if_the_create_directory_method_input_is_a_template_with_a_target_path_to_an_existing_directory_and_chown_and_chmod_parameters_is_set__the_method_chmod_and_chown_target_file(self):
target_directory = join_paths(CHROOT_PATH,
'/etc/create_dir_testfiles/dir_0')
chown_value = {'uid': os.getuid(), 'gid': os.getgid()}
@ -446,7 +464,7 @@ class TestTemplateExecutor:
def test_if_the_create_directory_method_input_is_a_template_with_a_target_path_to_an_unexisting_directory_from_an_existing_directory_and_chown_and_chmod_parameters_is_set__the_method_one_new_directory_with_a_mode_and_an_owner_from_the_parameters(self):
target_directory = join_paths(CHROOT_PATH,
'/etc/create_dir_testfiles/dir_1/subdir')
'/etc/create_dir_testfiles/dir_2/subdir')
chown_value = {'uid': os.getuid(), 'gid': os.getgid()}
chmod_value = int(0o777)
parameters_object = ParametersContainer({'package': test_package_name,
@ -469,9 +487,9 @@ class TestTemplateExecutor:
def test_if_the_create_directory_method_input_is_a_template_with_a_target_path_to_an_unexisting_directory_from_an_unexisting_directory_and_chown_and_chmod_parameters_is_not_set__the_method_creates_new_directory_and_all_its_parents_with_a_mode_and_an_owner_of_its_existing_parent(self):
target_directory = join_paths(
CHROOT_PATH,
'/etc/create_dir_testfiles/dir_2/subdir/subsubdir')
'/etc/create_dir_testfiles/dir_3/subdir/subsubdir')
parent_directory = join_paths(CHROOT_PATH,
'/etc/create_dir_testfiles/dir_2')
'/etc/create_dir_testfiles/dir_3')
parameters_object = ParametersContainer({'package': test_package_name,
'append': 'join'})
chown_value = {'uid': os.getuid(), 'gid': os.getgid()}
@ -500,7 +518,7 @@ class TestTemplateExecutor:
def test_if_the_create_directory_method_s_input_is_a_template_with_a_target_path_to_an_unexisting_directory_from_an_unexisting_directory_and_chown_and_chmod_parameters_is_set__the_method_creates_new_directory_and_all_its_parents_with_a_mode_and_an_owner_from_the_parameters(self):
target_directory = join_paths(
CHROOT_PATH,
'/etc/create_dir_testfiles/dir_2/subdir/subsubdir')
'/etc/create_dir_testfiles/dir_4/subdir/subsubdir')
chown_value = {'uid': os.getuid(), 'gid': os.getgid()}
chmod_value = int(0o777)
@ -535,19 +553,10 @@ class TestTemplateExecutor:
assert os.path.exists(target_path)
assert os.path.islink(target_path)
def test_if_the_link_directory_method_s_input_is_a_path_to_an_existing_source_file_and_a_target_path__the_method_creates_a_link_to_a_source_file(self):
target_path = join_paths(CHROOT_PATH,
'/etc/link_dir_testfiles/link_dir_1')
source_path = join_paths(CHROOT_PATH, '/etc/link_dir_testfiles/file_1')
template_executor._link_directory(source_path, target_path)
assert os.path.exists(target_path)
assert os.path.islink(target_path)
def test_if_the_link_directory_method_s_input_is_a_path_to_an_existing_source_directory_and_a_target_path_to_an_existing_link__the_method_raises_the_TemplateExecutorError_exception(self):
target_path = join_paths(CHROOT_PATH,
'/etc/link_dir_testfiles/link_dir_2')
source_path = join_paths(CHROOT_PATH, '/etc/link_dir_testfiles/dir_2')
'/etc/link_dir_testfiles/link_dir_1')
source_path = join_paths(CHROOT_PATH, '/etc/link_dir_testfiles/dir_1')
with pytest.raises(TemplateExecutorError):
template_executor._link_directory(source_path, target_path)
@ -634,7 +643,7 @@ class TestTemplateExecutor:
def test_if_the_clear_directory_method_s_input_is_a_path_to_a_file__the_method_raises_TemplateExecutorError_exception(self):
target_path = join_paths(CHROOT_PATH,
'/etc/clear_dir_testfiles/file')
'/etc/clear_dir_testfiles/file_0')
with pytest.raises(TemplateExecutorError):
template_executor._clear_directory(target_path)
@ -649,7 +658,7 @@ class TestTemplateExecutor:
assert os.path.exists(target_path)
assert os.path.islink(target_path)
def test_if_the_link_file_method_s_input_is_a_path_to_an_existing_source_file_and_a_target_path_to_an_existing_file__the_method_creates_a_link_to_a_source_file(self):
def test_if_the_link_file_method_s_input_is_a_path_to_an_existing_source_file_and_a_target_path_to_an_existing_file__the_method_throws_TemplateExecutorError_exception(self):
target_path = join_paths(CHROOT_PATH,
'/etc/link_file_testfiles/link_file_1')
source_path = join_paths(CHROOT_PATH,
@ -658,14 +667,14 @@ class TestTemplateExecutor:
with pytest.raises(TemplateExecutorError):
template_executor._link_file(source_path, target_path)
def test_if_the_remove_file_method_s_input_is_a_path_to_an_existing_file__the_method_raises_TemplateExecutorError_exception(self):
def test_if_the_remove_file_method_s_input_is_a_path_to_an_existing_file__the_method_removes_a_file(self):
target_path = join_paths(CHROOT_PATH,
'/etc/remove_file_testfiles/file_0')
template_executor._remove_file(target_path)
assert not os.path.exists(target_path)
def test_if_the_remove_file_method_s_input_is_a_path_to_an_existing_link_to_an_existing_file__the_method_raises_TemplateExecutorError_exception(self):
def test_if_the_remove_file_method_s_input_is_a_path_to_an_existing_link_to_an_existing_file__the_method_removes_a_file(self):
target_path = join_paths(CHROOT_PATH,
'/etc/remove_file_testfiles/link_file_1')
source_path = join_paths(CHROOT_PATH,
@ -974,23 +983,6 @@ class TestTemplateExecutor:
assert template_executor._get_file_owner(target_path) == chown_value
assert template_executor._get_file_mode(target_path) == chmod_value
def test_add_to_contents(self):
if False:
target_path = join_paths(
CHROOT_PATH,
'/etc/append_replace_dir_testfiles/dir_5')
parameters_object = ParametersContainer(
{'package': test_package_name,
'append': 'replace'})
template_wrapper = TemplateWrapper(
target_path,
parameters_object, DIR,
chroot_path=CHROOT_PATH,
config_archive_path=CONFIG_ARCHIVE_PATH)
template_wrapper.target_package.add_sym('/etc/append_replace_dir_testfiles/dir_5/link')
template_wrapper.save_changes()
assert True
def test_if_append_replace_directory_method_s_input_is_a_template_with_a_target_path_to_an_existing_empty_directory_that_belongs_to_the_template_package__the_method_does_nothing(self):
target_path = join_paths(
CHROOT_PATH,
@ -1073,7 +1065,7 @@ class TestTemplateExecutor:
assert '/etc/append_replace_dir_testfiles/dir_5/link'\
not in template_wrapper.target_package
def test_append_link_directory_method_s_input_is_a_template_with_a_target_path_and_a_source_path_to_the_existing_directory__the_method_creates_a_link_to_the_source_directory(self):
def test_if_append_link_directory_method_s_input_is_a_template_with_a_target_path_and_a_source_path_to_the_existing_directory__the_method_creates_a_link_to_the_source_directory_and_adds_this_link_to_the_package_CONTENTS_file(self):
target_path = join_paths(
CHROOT_PATH,
'/etc/append_link_dir_testfiles/link_dir_0')
@ -1094,7 +1086,10 @@ class TestTemplateExecutor:
assert os.path.islink(target_path)
assert os.readlink(target_path) == source_path
def test_append_link_directory_method_s_input_is_a_template_with_a_target_path_and_a_source_path_to_the_existing_directory_and_the_chown_and_chmod_parameters_are_set__the_method_creates_a_link_to_the_source_directory(self):
assert '/etc/append_link_dir_testfiles/link_dir_0'\
in template_wrapper.target_package
def test_if_append_link_directory_method_s_input_is_a_template_with_a_target_path_and_a_source_path_to_the_existing_directory_and_the_chown_and_chmod_parameters_are_set__the_method_creates_a_link_to_the_source_directory_and_adds_this_link_to_the_package_CONTENTS_file(self):
target_path = join_paths(
CHROOT_PATH,
'/etc/append_link_dir_testfiles/link_dir_1')
@ -1118,9 +1113,277 @@ class TestTemplateExecutor:
template_executor._append_link_directory(template_wrapper)
assert os.path.exists(target_path)
assert os.path.islink(target_path)
assert '/etc/append_link_dir_testfiles/link_dir_1'\
in template_wrapper.target_package
assert os.readlink(target_path) == source_path
assert template_executor._get_file_owner(target_path) == chown_value
assert template_executor._get_file_mode(target_path) == chmod_value
def test_if_append_join_file_method_s_input_is_a_template_with_protected_target_path_to_an_unexisting_file_that_should_not_exist__the_method_creates_new_empty_file_joins_a_template_with_them_adds_file_to_the_package_CONTENTS_file_and_create_an_archive_version_of_a_file(self):
target_path = join_paths(
CHROOT_PATH,
'/etc/append_join_file_testfiles/file_0')
parameters_object = ParametersContainer({'package': test_package_name,
'append': 'join',
'format': 'bind'})
template_text = 'section-name { parameter-2 no; }'
output_text = 'section-name {\n parameter-2 no;\n};\n'
template_wrapper = TemplateWrapper(
target_path,
parameters_object, FILE,
template_text=template_text,
chroot_path=CHROOT_PATH,
config_archive_path=CONFIG_ARCHIVE_PATH)
template_executor._append_join_file(template_wrapper)
assert os.path.exists(target_path)
assert os.path.exists(join_paths(
CONFIG_ARCHIVE_PATH,
'/etc/append_join_file_testfiles/file_0'))
assert '/etc/append_join_file_testfiles/file_0'\
in template_wrapper.target_package
with open(template_wrapper.output_path, 'r') as output_file:
assert output_file.read() == output_text
def test_if_append_join_file_method_s_input_is_a_template_with_protected_target_path_to_an_unexisting_file_that_should_exist__the_method_creates_new_empty_cfg_file_joins_a_template_with_them_and_adds_it_to_config_file(self):
target_path = join_paths(
CHROOT_PATH,
'/etc/append_join_file_testfiles/file_1')
parameters_object = ParametersContainer({'package': test_package_name,
'append': 'join',
'format': 'bind'})
template_text = 'section-name { parameter-2 no; }'
output_text = 'section-name {\n parameter-2 no;\n};\n'
template_wrapper = TemplateWrapper(
target_path,
parameters_object, FILE,
template_text=template_text,
chroot_path=CHROOT_PATH,
config_archive_path=CONFIG_ARCHIVE_PATH)
template_executor._append_join_file(template_wrapper)
assert os.path.exists(os.path.join(os.path.dirname(target_path),
'._cfg0001_file_1'))
assert not os.path.exists(join_paths(
CONFIG_ARCHIVE_PATH,
'/etc/append_join_file_testfiles/file_1'))
assert '/etc/append_join_file_testfiles/file_1'\
in template_executor.calculate_config_file
with open(template_wrapper.output_path, 'r') as output_file:
assert output_file.read() == output_text
def test_if_append_join_file_method_s_input_is_a_template_with_protected_target_path_to_an_unexisting_file_that_should_exist_and_autoupdate_parameters_is_set__the_method_creates_new_empty_file_joins_a_template_with_them_and_adds_it_to_config_file(self):
target_path = join_paths(
CHROOT_PATH,
'/etc/append_join_file_testfiles/file_2')
parameters_object = ParametersContainer({'package': test_package_name,
'append': 'join',
'format': 'bind',
'autoupdate': True})
template_text = 'section-name { parameter-2 no; }'
output_text = 'section-name {\n parameter-2 no;\n};\n'
template_wrapper = TemplateWrapper(
target_path,
parameters_object, FILE,
template_text=template_text,
chroot_path=CHROOT_PATH,
config_archive_path=CONFIG_ARCHIVE_PATH)
template_executor._append_join_file(template_wrapper)
assert os.path.exists(target_path)
assert os.path.exists(join_paths(
CONFIG_ARCHIVE_PATH,
'/etc/append_join_file_testfiles/file_2'))
assert '/etc/append_join_file_testfiles/file_2'\
in template_wrapper.target_package
with open(template_wrapper.output_path, 'r') as output_file:
assert output_file.read() == output_text
def test_if_append_join_file_method_s_input_is_a_template_with_protected_target_path_to_an_unexisting_file_that_should_not_exist_and_chown_and_chmod_parameters_are_set__the_method_creates_new_empty_file__joins_a_template_with_them__adds_file_to_the_package_CONTENTS_file__create_an_archive_version_of_a_file_and_chown_and_chmod_it(self):
target_path = join_paths(
CHROOT_PATH,
'/etc/append_join_file_testfiles/file_3')
chown_value = {'uid': os.getuid(), 'gid': os.getgid()}
chmod_value = int(0o777)
archive_path = join_paths(CONFIG_ARCHIVE_PATH,
'/etc/append_join_file_testfiles/file_3')
parameters_object = ParametersContainer({'package': test_package_name,
'append': 'join',
'format': 'bind',
'chown': chown_value,
'chmod': chmod_value})
template_text = 'section-name { parameter-2 no; }'
output_text = 'section-name {\n parameter-2 no;\n};\n'
template_wrapper = TemplateWrapper(
target_path,
parameters_object, FILE,
template_text=template_text,
chroot_path=CHROOT_PATH,
config_archive_path=CONFIG_ARCHIVE_PATH)
template_executor._append_join_file(template_wrapper)
assert os.path.exists(target_path)
assert template_executor._get_file_owner(target_path) == chown_value
assert template_executor._get_file_mode(target_path) == chmod_value
assert os.path.exists(archive_path)
assert template_executor._get_file_owner(archive_path) == chown_value
assert template_executor._get_file_mode(archive_path) == chmod_value
assert '/etc/append_join_file_testfiles/file_3'\
in template_wrapper.target_package
with open(template_wrapper.output_path, 'r') as output_file:
assert output_file.read() == output_text
def test_if_append_join_file_method_s_input_is_a_template_with_protected_target_path_to_an_unexisting_file_that_should_exist_and_chown_and_chmod_parameters_are_set__the_method_creates_new_empty_cfg_file__joins_a_template_with_them__adds_it_to_config_file_and_chown_and_chmod_it(self):
target_path = join_paths(
CHROOT_PATH,
'/etc/append_join_file_testfiles/file_4')
chown_value = {'uid': os.getuid(), 'gid': os.getgid()}
chmod_value = int(0o777)
parameters_object = ParametersContainer({'package': test_package_name,
'append': 'join', 'format': 'bind',
'chown': chown_value,
'chmod': chmod_value})
output_path = os.path.join(os.path.dirname(target_path),
'._cfg0001_file_4')
template_text = 'section-name { parameter-2 no; }'
output_text = 'section-name {\n parameter-2 no;\n};\n'
template_wrapper = TemplateWrapper(
target_path,
parameters_object, FILE,
template_text=template_text,
chroot_path=CHROOT_PATH,
config_archive_path=CONFIG_ARCHIVE_PATH)
template_executor._append_join_file(template_wrapper)
assert os.path.exists(output_path)
assert template_executor._get_file_owner(output_path) == chown_value
assert template_executor._get_file_mode(output_path) == chmod_value
assert not os.path.exists(join_paths(
CONFIG_ARCHIVE_PATH,
'/etc/append_join_file_testfiles/file_4'))
assert '/etc/append_join_file_testfiles/file_4'\
in template_executor.calculate_config_file
with open(template_wrapper.output_path, 'r') as output_file:
assert output_file.read() == output_text
def test_add_to_contents(self):
if False:
target_path = join_paths(
CHROOT_PATH,
'/etc/append_join_file_testfiles/file_5')
parameters_object = ParametersContainer(
{'package': test_package_name,
'append': 'join'})
template_wrapper = TemplateWrapper(
target_path,
parameters_object, FILE,
chroot_path=CHROOT_PATH,
config_archive_path=CONFIG_ARCHIVE_PATH)
template_wrapper.add_to_contents()
template_wrapper.save_changes()
assert True
def test_if_append_join_file_method_s_input_is_a_template_with_protected_target_path_to_an_existing_file_that_belongs_to_the_template_package_and_its_hash_sum_matches_the_hash_from_a_CONTENTS_file__the_method_joins_an_input_file_with_a_template__changes_its_hash_in_the_CONTENTS__updates_config_archive(self):
target_path = join_paths(
CHROOT_PATH,
'/etc/append_join_file_testfiles/file_5')
parameters_object = ParametersContainer({'package': test_package_name,
'append': 'join',
'format': 'bind'})
template_text = 'section-name { parameter-2 no; }'
output_text =\
'section-name {\n parameter-1 yes;\n parameter-2 no;\n};\n'
template_wrapper = TemplateWrapper(
target_path,
parameters_object, FILE,
template_text=template_text,
chroot_path=CHROOT_PATH,
config_archive_path=CONFIG_ARCHIVE_PATH)
template_executor._append_join_file(template_wrapper)
assert os.path.exists(target_path)
assert os.path.exists(join_paths(
CONFIG_ARCHIVE_PATH,
'/etc/append_join_file_testfiles/file_5'))
assert '/etc/append_join_file_testfiles/file_5'\
in template_wrapper.target_package
with open(template_wrapper.output_path, 'r') as output_file:
assert output_file.read() == output_text
def test_if_append_join_file_method_s_input_is_a_template_with_protected_target_path_to_an_existing_file_that_belongs_to_the_template_package_its_hash_sum_matches_the_hash_from_a_CONTENTS_file_and_a_chown_and_chmod_parameters_are_set__the_method_joins_an_input_file_with_a_template__changes_its_hash_in_the_CONTENTS__updates_config_archive_and_chown_and_chmod_it(self):
target_path = join_paths(
CHROOT_PATH,
'/etc/append_join_file_testfiles/file_6')
chown_value = {'uid': os.getuid(), 'gid': os.getgid()}
chmod_value = int(0o777)
archive_path = join_paths(CONFIG_ARCHIVE_PATH,
'/etc/append_join_file_testfiles/file_6')
parameters_object = ParametersContainer({'package': test_package_name,
'append': 'join',
'format': 'bind',
'chown': chown_value,
'chmod': chmod_value})
template_text = 'section-name { parameter-2 no; }'
output_text =\
'section-name {\n parameter-1 yes;\n parameter-2 no;\n};\n'
template_wrapper = TemplateWrapper(
target_path,
parameters_object, FILE,
template_text=template_text,
chroot_path=CHROOT_PATH,
config_archive_path=CONFIG_ARCHIVE_PATH)
template_executor._append_join_file(template_wrapper)
assert os.path.exists(target_path)
assert template_executor._get_file_owner(target_path) == chown_value
assert template_executor._get_file_mode(target_path) == chmod_value
assert os.path.exists(archive_path)
assert template_executor._get_file_owner(archive_path) == chown_value
assert template_executor._get_file_mode(archive_path) == chmod_value
assert '/etc/append_join_file_testfiles/file_6'\
in template_wrapper.target_package
with open(template_wrapper.output_path, 'r') as output_file:
assert output_file.read() == output_text
def test_if_append_join_file_method_s_input_is_a_template_with_protected_target_path_to_an_existing_file_that_belongs_to_the_template_package_but_its_hash_sum_does_not_match_the_hash_from_a_CONTENTS_file__the_method_creates_a_cfg_file_and_adds_a_target_file_s_path_to_the_config_file(self):
target_path = join_paths(
CHROOT_PATH,
'/etc/append_join_file_testfiles/file_7')
output_path = os.path.join(os.path.dirname(target_path),
'._cfg0001_file_7')
parameters_object = ParametersContainer({'package': test_package_name,
'append': 'join',
'format': 'bind'})
template_text = 'section-name { parameter-2 no; }'
output_text =\
'section-name {\n parameter-1 yes;\n parameter-2 no;\n};\n'
template_wrapper = TemplateWrapper(
target_path,
parameters_object, FILE,
template_text=template_text,
chroot_path=CHROOT_PATH,
config_archive_path=CONFIG_ARCHIVE_PATH)
template_executor._append_join_file(template_wrapper)
assert os.path.exists(target_path)
assert os.path.exists(output_path)
assert os.path.exists(join_paths(
CONFIG_ARCHIVE_PATH,
'/etc/append_join_file_testfiles/file_7'))
with open(template_wrapper.output_path, 'r') as output_file:
assert output_file.read() == output_text
def test_to_remove_changed_testfiles(self):
shutil.rmtree(os.path.join(CHROOT_PATH, 'etc'))
shutil.rmtree(os.path.join(CHROOT_PATH,
'var/lib/calculate/config-archive'))

@ -0,0 +1,3 @@
# Source file
[section_name]
rare_parameter = eternal_value

@ -38,5 +38,5 @@ games:x:36:35:added by portage for games-envd:/usr/games:/bin/bash
deluge:x:116:987:added by portage for deluge:/var/lib/deluge:/sbin/nologin
postgres:x:70:70:added by portage for postgresql:/var/lib/postgresql:/bin/sh
nullmail:x:88:88:added by portage for nullmailer:/var/nullmailer:/sbin/nologin
divanov:x:1427:1000::/home/divanov:/bin/bash
divanov:x:1427:1000::/home/denis:/bin/bash
guest:x:1000:1000::/home/guest:/bin/bash

@ -1 +1 @@
/home/divanov/Home/development/calculate-lib/tests/templates/testfiles/test_executor_root/etc/remove_file_testfiles/file_1
file_1

@ -1,7 +0,0 @@
{
"Band": "Summoning",
"Song": "Flight of the Nazgul",
"Genre": "Black metal",
"Status": "Damn good song",
"isRecommended": true
}

@ -1,66 +0,0 @@
root::0:root
bin::1:root,bin,daemon
daemon::2:root,bin,daemon
sys::3:root,bin,adm
adm::4:root,adm,daemon
tty::5:
disk::6:root,adm,haldaemon
lp::7:lp,guest
mem::8:
kmem::9:
wheel::10:root,guest
floppy::11:root,haldaemon
mail::12:mail
news::13:news
uucp::14:uucp,guest
man::15:man
console::17:
audio::18:guest
cdrom::19:haldaemon,guest
dialout::20:root
tape::26:root
video::27:root,guest
cdrw::80:haldaemon,guest
usb::85:haldaemon,guest
users::100:games,guest
nofiles:x:200:
smmsp:x:209:smmsp
portage::250:portage
utmp:x:406:
nogroup::65533:
nobody::65534:
sshd:x:22:
games:x:35:guest
plugdev:x:440:haldaemon,usbmux,guest
scanner:x:441:guest
ldap:x:439:
messagebus:x:199:
lpadmin:x:106:
polkituser:x:105:
cron:x:16:
ntp:x:123:
rpc:x:111:
fingerprint:x:104:
ssmtp:x:103:
crontab:x:102:
gdm:x:101:
haldaemon:x:999:haldaemon
openvpn:x:998:
vnstat:x:997:
dnsmasq:x:996:
polkitd:x:995:
locate:x:994:
input:x:993:
dhcp:x:992:
mysql:x:60:
netdev:x:991:
avahi:x:990:
avahi-autoipd:x:989:
nm-openvpn:x:988:
deluge:x:987:
postgres:x:70:
nullmail:x:88:
sudo:x:443:
kvm:x:78:
render:x:28:
guest:!:1000:

@ -1,42 +0,0 @@
root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/bin:/bin/false
daemon:x:2:2:daemon:/sbin:/bin/false
adm:x:3:4:adm:/var/adm:/bin/false
lp:x:4:7:lp:/var/spool/lpd:/bin/false
sync:x:5:0:sync:/sbin:/bin/sync
shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
halt:x:7:0:halt:/sbin:/sbin/halt
mail:x:8:12:Mail program user:/var/spool/mail:/sbin/nologin
news:x:9:13:news:/usr/lib/news:/bin/false
uucp:x:10:14:uucp:/var/spool/uucppublic:/bin/false
operator:x:11:0:operator:/root:/bin/bash
man:x:13:15:man:/usr/share/man:/bin/false
postmaster:x:14:12:Postmaster user:/var/spool/mail:/sbin/nologin
portage:x:250:250:portage:/var/tmp/portage:/bin/false
nobody:x:65534:65534:nobody:/:/bin/false
sshd:x:22:22:added by portage for openssh:/var/empty:/sbin/nologin
ldap:x:439:439:added by portage for openldap:/usr/lib64/openldap:/sbin/nologin
messagebus:x:101:199:System user; messagebus:/dev/null:/sbin/nologin
polkituser:x:102:105:added by portage for polkit:/dev/null:/sbin/nologin
cron:x:16:16:added by portage for cronbase:/var/spool/cron:/sbin/nologin
ntp:x:123:123:added by portage for ntp:/dev/null:/sbin/nologin
rpc:x:111:111:added by portage for portmap:/dev/null:/sbin/nologin
gdm:x:103:101:added by portage for gdm:/var/lib/gdm:/sbin/nologin
haldaemon:x:104:999:added by portage for hal:/dev/null:/sbin/nologin
openvpn:x:105:998:added by portage for openvpn:/dev/null:/sbin/nologin
usbmux:x:106:85:added by portage for usbmuxd:/dev/null:/sbin/nologin
vnstat:x:107:997:added by portage for vnstat:/dev/null:/sbin/nologin
dnsmasq:x:108:996:added by portage for dnsmasq:/dev/null:/sbin/nologin
polkitd:x:109:995:added by portage for polkit:/var/lib/polkit-1:/sbin/nologin
saned:x:110:441:added by portage for sane-backends:/dev/null:/sbin/nologin
dhcp:x:112:992:added by portage for dhcp:/var/lib/dhcp:/sbin/nologin
mysql:x:60:60:added by portage for mysql:/dev/null:/sbin/nologin
avahi:x:113:990:added by portage for avahi:/dev/null:/sbin/nologin
avahi-autoipd:x:114:989:added by portage for avahi:/dev/null:/sbin/nologin
nm-openvpn:x:115:988:added by portage for networkmanager-openvpn:/dev/null:/sbin/nologin
games:x:36:35:added by portage for games-envd:/usr/games:/bin/bash
deluge:x:116:987:added by portage for deluge:/var/lib/deluge:/sbin/nologin
postgres:x:70:70:added by portage for postgresql:/var/lib/postgresql:/bin/sh
nullmail:x:88:88:added by portage for nullmailer:/var/nullmailer:/sbin/nologin
divanov:x:1427:1000::/home/divanov:/bin/bash
guest:x:1000:1000::/home/guest:/bin/bash

@ -1 +0,0 @@
/home/divanov/Home/development/calculate-lib/tests/templates/testfiles/test_executor_root/etc/remove_file_testfiles/file_1

@ -1,7 +0,0 @@
{
"Band": "Summoning",
"Song": "Flight of the Nazgul",
"Genre": "Black metal",
"Status": "Damn good song",
"isRecommended": true
}

@ -1,7 +1,6 @@
dir /etc
dir /etc/config_testfiles
dir /etc/config_testfiles/dir
obj /etc/config_testfiles/dir/file.conf 0b87fea7f5b65cac5012baa2bf647e72 1591196541
obj /etc/config_testfiles/file_0 0b87fea7f5b65cac5012baa2bf647e72 1591196541
dir /etc/terminfo
obj /etc/terminfo/info.json 7a374d90a202b969ee338ac4334fb14b 1591354184
dir /etc/append_join_dir_testfiles
@ -44,3 +43,9 @@ obj /etc/append_replace_dir_testfiles/dir_5/subdir_0/file d41d8cd98f00b204e98009
dir /etc/append_replace_dir_testfiles/dir_5/subdir_1
obj /etc/append_replace_dir_testfiles/dir_5/subdir_1/file d41d8cd98f00b204e9800998ecf8427e 1592490152
sym /etc/append_replace_dir_testfiles/dir_5/link -> subdir_0 1592491781
dir /etc/append_join_file_testfiles
obj /etc/append_join_file_testfiles/file_1 ee090b452dbf92d697124eb424f5de5b 1592552158
obj /etc/append_join_file_testfiles/file_4 ee090b452dbf92d697124eb424f5de5b 1592552158
obj /etc/append_join_file_testfiles/file_5 ee090b452dbf92d697124eb424f5de5b 1592574626
obj /etc/append_join_file_testfiles/file_6 ee090b452dbf92d697124eb424f5de5b 1592574626
obj /etc/append_join_file_testfiles/file_7 ee090b452dbf92d697124eb424f5de5b 1592574626

@ -1,3 +0,0 @@
/etc/dir_0/file 84bcceb2c8e6de79849ea5f3304f2411
/etc/dir_1/file 84bcceb2c8e6de79849ea5f3304f2411
/etc/dir_2/file 84bcceb2c8e6de79849ea5f3304f2411

@ -1,7 +0,0 @@
{
"Band": "Summoning",
"Song": "Rotting Horse on the Deadly Ground",
"Genre": "Black metal",
"Status": "Unspeakably good song",
"isRecommended": true
}

@ -1,5 +0,0 @@
[section one]
parameter_1 = value
parameter_2 = value_2
[section two]
other_parameter = other_value

@ -1,17 +0,0 @@
{
"languageserver": {
"clangd": {
"command": "clangd",
"rootPatterns": [
"compile_flags.txt",
"compile_commands.json"
],
"filetypes": [
"c",
"cpp",
"objc",
"objcpp"
]
}
}
}

@ -1,7 +0,0 @@
options {
parameter_1 yes;
response-policy {
mood "almost.blue";
};
};

@ -1,7 +0,0 @@
{
"Band": "Summoning",
"Song": "Flight of the Nazgul",
"Genre": "Black metal",
"Status": "Damn good song",
"isRecommended": true
}

@ -1,12 +0,0 @@
options {
parameter no;
parameter_1 yes;
};
awful_section {
parameter_2 12;
inner_section {
parameter_4 "grief";
};
};

@ -1,5 +0,0 @@
[section one]
parameter_1 = value
parameter_2 = value_2
[section two]
other_parameter = other_value

@ -1 +0,0 @@
{% calculate append = 'skip', action = 'install' %}

@ -1 +0,0 @@
{% calculate append = 'skip', path = '/', package = 'media-sound/alsa-utils' %}

@ -1,6 +0,0 @@
{% calculate name = 'important.conf', autoupdate -%}
relay_domains = {{ merge.calculate_domains }}
#Для создания базы используется postmap
transport_maps = hash:/etc/postfix/transport_maps
relay_recipient_maps = hash:/etc/postfix/valid_recipients

@ -1,5 +0,0 @@
{% calculate format = 'json', append = 'join', force -%}
{
"!parameter_1": "important_value",
"parameter_2": {{ os_disk_dev }}
}

@ -1,2 +0,0 @@
{% calculate append = 'join', autoupdate %}
{% calculate pkg() > '1.1.0' %}

@ -1,10 +0,0 @@
{% calculate format = 'kde', path = '/etc/folder/in_folder', name = 'filename.conf' -%}
# KDE or Plasma config file.
# Part from Plasma
[PlasmaViews][Panel 69][Horizontal1024]
alignment={{ install.number }}
length={{ merge.var_1 }}
maxLength={{ merge.var_1 }}
minLength={{ merge.var_1 }}
panelVisibility=1
thickness={{ merge.var_2 }}

@ -1,4 +0,0 @@
{% calculate name = 'settings.conf', mirror, format = 'postfix' -%}
special_directory = /var/any/important/path
command_directory = {{ install.path }}

@ -1 +0,0 @@
{% calculate append = 'skip', path = '/etc', package = 'media-sound/pulseaudio' %}

@ -1,14 +0,0 @@
{% calculate format = 'kde' %}
{% calculate path = file_path %}
{% calculate merge = 'media-sound/alsa-utils' %}
{% set file_path = test.test_root + '/test_root/conf_dir'%}
[section][parts][of][section name]
parameter 1 = {{ variables.variable_1 }}
parameter 2 = {{ variables.variable_2 }}
# Random comment.
parameter 3 = very important and veery interesting value
{% for num in variables.group.list -%}
statement {{ num }} = {{ num * 2 - 1 }}
{% endfor -%}

@ -1 +0,0 @@
{% calculate append = 'skip', package = 'xfce-extra/xfce4-clipman-plugin' %}

@ -1,10 +0,0 @@
{% calculate name = 'wow_file.conf', force, format = 'samba',
path = '/etc/xfce4-clipman/' -%}
[global]
server role = standalone server
hosts allow = 192.168.1. 192.168.2. 127.
log file = /var/log/samba/log.%m
workgroup = {{ variables.variable_1 }}
netbios name = {{ variables.variable_2 }}
server string = Calculate Directory Server
directory mask = 0755

@ -1,2 +0,0 @@
{% calculate append = 'skip', package = 'xfce-extra/xfce4-pulseaudio-plugin' %}
{% calculate merge = 'media-sound/pulseaudio' %}

@ -1,7 +0,0 @@
{% calculate name = 'template', format = 'bind', append = 'before' -%}
acl "trusted" {
{{ merge.ip_value }};
10.0.0.0/8;
192.168.1.0/24;
::1/128;
};

@ -1,10 +0,0 @@
{% calculate format='xml_xfce', mirror -%}
{% save custom.group.parameter = 'DoubleClickTime' -%}
<?xml version="1.0" encoding="UTF-8"?>
<channel name="xsettings" version="{{ version }}">
<property name="Net" type="empty">
<property name="ThemeName" type="string" value="Calculate"/>
<property name="IconThemeName" type="string" value="Calculate"/>
<property name="{{ custom.group.parameter }}" type="int" value="400"/>
</property>
</channel>

@ -1,10 +0,0 @@
{% calculate format='xml_xfce', force, autoupdate -%}
<?xml version="1.0" encoding="UTF-8"?>
<channel name="xsettings" version="{{ version }}">
<property name="Gtk" type="empty">
<property name="FontName" type="string" value="Droid Sans 10"/>
<property name="CursorThemeName" type="string" value="Calculate"/>
<property name="{{ custom.group.parameter }}" type="bool" value="false"/>
</property>
<property name="!Xft" type="empty"/>
</channel>

@ -1 +0,0 @@
abi_x86_64 amd64 bluetooth elibc_glibc gdbm ipv6 kernel_linux ncurses readline sqlite ssl threads userland_GNU wide-unicode xml

@ -1 +0,0 @@
abi_x86_64 amd64 bluetooth elibc_glibc gdbm ipv6 kernel_linux ncurses readline sqlite ssl threads userland_GNU xml specific_flag

@ -1,24 +0,0 @@
dir /usr
dir /usr/bin
sym /usr/bin/2to3 -> ../lib/python-exec/python-exec2 1573585288
sym /usr/bin/idle -> ../lib/python-exec/python-exec2 1573585288
sym /usr/bin/pydoc -> ../lib/python-exec/python-exec2 1573585288
sym /usr/bin/python -> python-exec2c 1573585287
sym /usr/bin/python-config -> ../lib/python-exec/python-exec2 1573585288
obj /usr/bin/python-exec2c af334205aa0e66aa1231f0dcbf5d24b1 1573585288
sym /usr/bin/python2 -> python-exec2c 1573585287
sym /usr/bin/python2-config -> ../lib/python-exec/python-exec2 1573585288
sym /usr/bin/python3 -> python-exec2c 1573585288
sym /usr/bin/python3-config -> ../lib/python-exec/python-exec2 1573585288
sym /usr/bin/pyvenv -> ../lib/python-exec/python-exec2 1573585288
dir /usr/lib
dir /usr/lib/python-exec
obj /usr/lib/python-exec/python-exec2 7157717ea4b74eedcebcf2d33869972a 1573585287
dir /usr/share
dir /usr/share/doc
dir /usr/share/doc/python-exec-2.4.6-r1
obj /usr/share/doc/python-exec-2.4.6-r1/NEWS.bz2 e590444b323cd9761311fa6a0880aa56 1573585287
obj /usr/share/doc/python-exec-2.4.6-r1/README.bz2 cb19bc40b60019563688808ce1fd21bb 1573585287
dir /etc
dir /etc/python-exec
obj /etc/python-exec/python-exec.conf 88e20913bbc1588292f71940e6ea0b47 1573596811

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save