All append methods are implemented for file templates. Added support for executable templates.

packages
Иванов Денис 4 years ago
parent 8229f8c677
commit 6ead02a510

@ -0,0 +1,185 @@
{
"tests/templates/format/test_base.py::TestJoinMethod::test_if_input_dictionaries_have_no_sections_and_have_only_parameter_lines__it_will_be_processed_correctly": true,
"tests/templates/format/test_base.py::TestJoinMethod::test_if_input_template_dictionary_has_delete_mark_for_parameter__parameter_will_be_deleted": true,
"tests/templates/format/test_base.py::TestJoinMethod::test_if_input_template_dictionary_has_delete_mark_for_section__section_will_be_deleted": true,
"tests/templates/format/test_base.py::TestJoinMethod::test_if_input_template_dictionary_has_replace_mark_for_section__section_will_be_deleted": true,
"tests/templates/format/test_base.py::TestJoinMethod::test_if_inputs_are_dictionaries_with_parameters_with_same_name_in_same_section__parameters_values_in_original_dictionary_changed_to_values_from_template": true,
"tests/templates/format/test_base.py::TestJoinMethod::test_if_inputs_are_dictionaries_with_same_sections_which_contain_different_parameters__a_section_from_the_template_added_to_the_same_section_of_original_dictionary": true,
"tests/templates/format/test_base.py::TestJoinMethod::test_if_inputs_are_dictionaries_with_string_keys_without_any_action_marks__the_dictionaties_just_merged": true,
"tests/templates/format/test_base.py::TestJoinMethod::test_if_inputs_are_dictionaries_with_tuple_keys_without_any_action_marks_as_their_keys__the_dictionaries_just_merged": true,
"tests/templates/format/test_base.py::TestLogicLinesMethod::test_if_input_is_text_document_the_method_returns_list_of_its_lines": true,
"tests/templates/format/test_base.py::TestLogicLinesMethod::test_if_lines_in_document_divided_using_backslash_as_continuation_symbol__method_returns_list_of_full_lines": true,
"tests/templates/format/test_bind.py::TestParsingMethods::test_if_comment_parameter_is_set_for_template__format_object_will_parse_comments_with_comment_symbol_from_this_parameter": true,
"tests/templates/format/test_bind.py::TestParsingMethods::test_if_input_document_contains_blocks_and_parameters_with_action_marks__the_key_tuples_of_object_s_dictionary_have_it_as_its_first_element": true,
"tests/templates/format/test_bind.py::TestParsingMethods::test_if_input_document_contains_just_few_parameter_lines__the_initialised_object_contains_correct_dictionary": true,
"tests/templates/format/test_bind.py::TestParsingMethods::test_if_input_document_contains_parameters_to_delete_without_values_or_with_empty_block__the_document_object_contains_dictionary_with_item_to_delete": true,
"tests/templates/format/test_bind.py::TestParsingMethods::test_if_input_document_contains_some_block_of_parameters__the_initialised_object_contains_correct_dictionary": true,
"tests/templates/format/test_bind.py::TestParsingMethods::test_if_input_document_contains_some_blocks_with_similar_names__the_blocks_join_recursively": true,
"tests/templates/format/test_bind.py::TestParsingMethods::test_if_parameters_and_blocks_in_input_document_has_some_comments__the_comments_will_be_collected_in_the_list_of_parameter_value_or_with_special_key_in_block_dictionary": true,
"tests/templates/format/test_bind.py::TestParsingMethods::test_if_the_IgnoreComments_flag_is_set__the_parser_ignores_all_comments": true,
"tests/templates/format/test_bind.py::TestParsingMethods::test_joining_documents_1": true,
"tests/templates/format/test_bind.py::TestParsingMethods::test_make_template": true,
"tests/templates/format/test_compiz.py::TestParsingMethods::test_if_input_document_contains_few_parameter_lines_and_some_empty_lines__the_initialized_object_contains_correct_dictionary": true,
"tests/templates/format/test_compiz.py::TestParsingMethods::test_if_input_document_contains_just_few_parameter_lines__the_initialised_object_contains_correct_dictionary": true,
"tests/templates/format/test_compiz.py::TestParsingMethods::test_if_input_document_contains_parameters_to_delete_without_assign_symbol_and_any_values_and_sections_to_delete__the_document_object_contains_dictionary_with_item_to_delete": true,
"tests/templates/format/test_compiz.py::TestParsingMethods::test_if_input_document_contains_sections_with_different_names_but_different_parameters__the_parameters_merged_in_one_section": true,
"tests/templates/format/test_compiz.py::TestParsingMethods::test_if_input_document_contains_sections_with_parameters_with_action_marks__the_key_tuples_of_object_s_dictionary_have_it_as_its_first_element": true,
"tests/templates/format/test_compiz.py::TestParsingMethods::test_if_parameter_in_input_document_has_some_comments__the_comments_will_be_collected_in_the_list_of_parameter_value": true,
"tests/templates/format/test_compiz.py::TestParsingMethods::test_if_the_ignore_comments_flag_is_set__the_parser_ignores_all_comments": true,
"tests/templates/format/test_compiz.py::TestParsingMethods::test_joining_documents_1": true,
"tests/templates/format/test_compiz.py::TestParsingMethods::test_make_template": true,
"tests/templates/format/test_contents.py::TestParsingMethods::test_if_input_document_contains_a_few_lines_with_some_action_symbols__the_initialised_object_contains_correct_dictionary": true,
"tests/templates/format/test_contents.py::TestParsingMethods::test_if_input_document_contains_a_few_lines_without_any_action_symbols__the_initialised_object_contains_correct_dictionary": true,
"tests/templates/format/test_contents.py::TestParsingMethods::test_if_template_parser_flag_is_set_False__the_initialized_object_contains_correct_dictionary_for_contents_util_module": true,
"tests/templates/format/test_contents.py::TestParsingMethods::test_joining_documents_1": true,
"tests/templates/format/test_diff.py::TestExecuteMethods::test_if_diff_patch_used_for_patching_of_directories__it_changes_files_in_directories_and_adds_ones": true,
"tests/templates/format/test_dovecot.py::TestParsingMethods::test_if_input_document_contains_blocks_and_parameters_with_action_marks__the_key_tuples_of_object_s_dictionary_have_it_as_its_first_element": true,
"tests/templates/format/test_dovecot.py::TestParsingMethods::test_if_input_document_contains_just_few_parameter_lines__the_initialised_object_contains_correct_dictionary": true,
"tests/templates/format/test_dovecot.py::TestParsingMethods::test_if_input_document_contains_parameters_to_delete_without_values_or_with_empty_block__the_document_object_contains_dictionary_with_item_to_delete": true,
"tests/templates/format/test_dovecot.py::TestParsingMethods::test_if_input_document_contains_some_block_of_parameters__the_initialised_object_contains_correct_dictionary": true,
"tests/templates/format/test_dovecot.py::TestParsingMethods::test_if_input_document_contains_some_blocks_with_similar_names__the_blocks_join_recursively": true,
"tests/templates/format/test_dovecot.py::TestParsingMethods::test_if_parameters_and_blocks_in_input_document_has_some_comments__the_comments_will_be_collected_in_the_list_of_parameter_value_or_with_special_key_in_block_dictionary": true,
"tests/templates/format/test_dovecot.py::TestParsingMethods::test_if_the_IgnoreComments_flag_is_set__the_parser_ignores_all_comments": true,
"tests/templates/format/test_dovecot.py::TestParsingMethods::test_joining_documents_1": true,
"tests/templates/format/test_dovecot.py::TestParsingMethods::test_make_template": true,
"tests/templates/format/test_json.py::TestParsingMethods::test_if_input_document_contains_just_few_parameters_and_parameter_blocks__the_initialised_object_contains_correct_dictionary": true,
"tests/templates/format/test_json.py::TestParsingMethods::test_joining_documents_1": true,
"tests/templates/format/test_json.py::TestParsingMethods::test_make_template": true,
"tests/templates/format/test_kde.py::TestParsingMethods::test_if_input_document_contains_few_parameter_lines_and_some_empty_lines__the_initialized_object_contains_correct_dictionary": true,
"tests/templates/format/test_kde.py::TestParsingMethods::test_if_input_document_contains_just_few_parameter_lines__the_initialised_object_contains_correct_dictionary": true,
"tests/templates/format/test_kde.py::TestParsingMethods::test_if_input_document_contains_parameters_to_delete_without_assign_symbol_and_any_values_and_sections_to_delete__the_document_object_contains_dictionary_with_item_to_delete": true,
"tests/templates/format/test_kde.py::TestParsingMethods::test_if_input_document_contains_parameters_with_values_with_unicode_symbols__the_initialized_object_contains_correct_dictionary": true,
"tests/templates/format/test_kde.py::TestParsingMethods::test_if_input_document_contains_sections_with_different_names_but_different_parameters__the_parameters_merged_in_one_section": true,
"tests/templates/format/test_kde.py::TestParsingMethods::test_if_input_document_contains_sections_with_parameters_with_action_marks__the_key_tuples_of_object_s_dictionary_have_it_as_its_first_element": true,
"tests/templates/format/test_kde.py::TestParsingMethods::test_if_parameter_in_input_document_has_some_comments__the_comments_will_be_collected_in_the_list_of_parameter_value": true,
"tests/templates/format/test_kde.py::TestParsingMethods::test_if_the_IgnoreComments_flag_is_set__the_parser_ignores_all_comments": true,
"tests/templates/format/test_kde.py::TestParsingMethods::test_joining_documents_1": true,
"tests/templates/format/test_kde.py::TestParsingMethods::test_make_template": true,
"tests/templates/format/test_kernel.py::TestParsingMethods::test_if_input_document_contains_few_parameter_lines_and_some_empty_lines__the_initialized_object_contains_correct_dictionary": true,
"tests/templates/format/test_kernel.py::TestParsingMethods::test_if_input_document_contains_just_few_parameter_lines__the_initialised_object_contains_correct_dictionary": true,
"tests/templates/format/test_kernel.py::TestParsingMethods::test_if_input_document_contains_parameters_to_delete_without_assign_symbol_and_any_values__the_document_object_contains_dictionary_with_item_to_delete": true,
"tests/templates/format/test_kernel.py::TestParsingMethods::test_if_input_document_contains_parameters_with_action_marks__the_key_tuples_of_object_s_dictionary_have_it_as_its_first_element": true,
"tests/templates/format/test_kernel.py::TestParsingMethods::test_if_parameter_in_input_document_has_some_comments__the_comments_will_be_collected_in_the_list_of_parameter_value": true,
"tests/templates/format/test_kernel.py::TestParsingMethods::test_joining_documents_1": true,
"tests/templates/format/test_kernel.py::TestParsingMethods::test_make_template": true,
"tests/templates/format/test_ldap.py::TestParsingMethods::test_if_input_doc_contains_some_type_sections_with_plain_directives__object_dictionary_contains_correct_dictionary_with_directives_values_and_comments": true,
"tests/templates/format/test_ldap.py::TestParsingMethods::test_if_input_doc_contains_some_type_sections_with_plain_directives_and_action_marks__object_dictionary_contains_correct_dictionary_with_directives_values_and_comments": true,
"tests/templates/format/test_ldap.py::TestParsingMethods::test_if_input_document_contains_access_to_directive__the_object_s_dictionary_contains_correct_dictionary_with_list_of_access_to_parameters_and_comments": true,
"tests/templates/format/test_ldap.py::TestParsingMethods::test_if_input_document_contains_comments_to_type_sections__the_object_s_dictionary_collect_them": true,
"tests/templates/format/test_ldap.py::TestParsingMethods::test_if_input_document_contains_index_directives__the_object_s_dictionary_contains_correct_dictionary_with_index_elements_and_comments": true,
"tests/templates/format/test_ldap.py::TestParsingMethods::test_if_input_document_contains_syncrepl_and_access_to_constructions_with_action_marks__object_dictionary_contains_correct_dictionary_with_action_marks": true,
"tests/templates/format/test_ldap.py::TestParsingMethods::test_if_input_document_contains_syncrepl_directive__the_object_s_dictionary_contains_correct_dictionary_with_list_of_syncrepl_parameters_and_comments": true,
"tests/templates/format/test_ldap.py::TestParsingMethods::test_if_logiclines_method_takes_text_with_lines_that_starts_whit_space_symbols__it_returns_joined_lines": true,
"tests/templates/format/test_ldap.py::TestParsingMethods::test_if_template_text_contains_some_access_to_constuctions_with_same_what_value_and_without_action_marks_for_whole_constructions__they_join_in_one_access_to_construction": true,
"tests/templates/format/test_ldap.py::TestParsingMethods::test_joining_documents_1": true,
"tests/templates/format/test_openrc.py::TestParsingMethods::test_if_input_document_contains_few_parameter_lines_and_some_empty_lines__the_initialized_object_contains_correct_dictionary": true,
"tests/templates/format/test_openrc.py::TestParsingMethods::test_if_input_document_contains_just_few_parameter_lines__the_initialised_object_contains_correct_dictionary": true,
"tests/templates/format/test_openrc.py::TestParsingMethods::test_if_input_document_contains_parameters_to_delete_without_assign_symbol_and_any_values__the_document_object_contains_dictionary_with_item_to_delete": true,
"tests/templates/format/test_openrc.py::TestParsingMethods::test_if_input_document_contains_parameters_with_action_marks__the_key_tuples_of_object_s_dictionary_have_it_as_its_first_element": true,
"tests/templates/format/test_openrc.py::TestParsingMethods::test_if_parameter_in_input_document_has_some_comments__the_comments_will_be_collected_in_the_list_of_parameter_value": true,
"tests/templates/format/test_openrc.py::TestParsingMethods::test_if_the_IgnoreComments_flag_is_set__the_parser_ignores_all_comments": true,
"tests/templates/format/test_openrc.py::TestParsingMethods::test_joining_documents_1": true,
"tests/templates/format/test_openrc.py::TestParsingMethods::test_make_template": true,
"tests/templates/format/test_postfix.py::TestParsingMethods::test_if_input_document_contains_few_parameter_lines_and_some_empty_lines__the_initialized_object_contains_correct_dictionary": true,
"tests/templates/format/test_postfix.py::TestParsingMethods::test_if_input_document_contains_just_few_parameter_lines__the_initialised_object_contains_correct_dictionary": true,
"tests/templates/format/test_postfix.py::TestParsingMethods::test_if_input_document_contains_parameters_to_delete_without_assign_symbol_and_any_values__the_document_object_contains_dictionary_with_item_to_delete": true,
"tests/templates/format/test_postfix.py::TestParsingMethods::test_if_input_document_contains_parameters_with_action_marks__the_key_tuples_of_object_s_dictionary_have_it_as_its_first_element": true,
"tests/templates/format/test_postfix.py::TestParsingMethods::test_if_parameter_in_input_document_has_some_comments__the_comments_will_be_collected_in_the_list_of_parameter_value": true,
"tests/templates/format/test_postfix.py::TestParsingMethods::test_if_the_IgnoreComments_flag_is_set__the_parser_ignores_all_comments": true,
"tests/templates/format/test_postfix.py::TestParsingMethods::test_joining_documents_1": true,
"tests/templates/format/test_postfix.py::TestParsingMethods::test_make_template": true,
"tests/templates/format/test_procmail.py::TestParsingMethods::test_if_input_document_contains_few_parameter_lines_and_some_empty_lines__the_initialized_object_contains_correct_dictionary": true,
"tests/templates/format/test_procmail.py::TestParsingMethods::test_if_input_document_contains_just_few_parameter_lines__the_initialised_object_contains_correct_dictionary": true,
"tests/templates/format/test_procmail.py::TestParsingMethods::test_if_input_document_contains_parameters_to_delete_without_assign_symbol_and_any_values__the_document_object_contains_dictionary_with_item_to_delete": true,
"tests/templates/format/test_procmail.py::TestParsingMethods::test_if_input_document_contains_parameters_with_action_marks__the_key_tuples_of_object_s_dictionary_have_it_as_its_first_element": true,
"tests/templates/format/test_procmail.py::TestParsingMethods::test_if_parameter_in_input_document_has_some_comments__the_comments_will_be_collected_in_the_list_of_parameter_value": true,
"tests/templates/format/test_procmail.py::TestParsingMethods::test_if_the_IgnoreComments_flag_is_set__the_parser_ignores_all_comments": true,
"tests/templates/format/test_procmail.py::TestParsingMethods::test_joining_documents_1": true,
"tests/templates/format/test_procmail.py::TestParsingMethods::test_make_template": true,
"tests/templates/format/test_proftpd.py::TestParsingMethods::test_if_input_document_contains_blocks_and_parameters_with_action_marks__the_key_tuples_of_parameters_s_have_it_as_its_first_element_inherited": true,
"tests/templates/format/test_proftpd.py::TestParsingMethods::test_if_input_document_contains_just_few_parameter_lines__the_initialised_object_contains_correct_dictionary": true,
"tests/templates/format/test_proftpd.py::TestParsingMethods::test_if_input_document_contains_parameters_to_delete_without_any_values_the_document_object_contains_dictionary_with_this_items_to_delete": true,
"tests/templates/format/test_proftpd.py::TestParsingMethods::test_if_input_document_contains_some_block_of_parameters__the_initialised_object_contains_correct_dictionary": true,
"tests/templates/format/test_proftpd.py::TestParsingMethods::test_if_parameters_and_blocks_in_input_document_has_some_comments__the_comments_will_be_collected_in_the_list_of_parameter_value_or_with_special_key_in_block_dictionary": true,
"tests/templates/format/test_proftpd.py::TestParsingMethods::test_if_the_ignoreComments_flag_is_set__the_parser_ignores_all_comments": true,
"tests/templates/format/test_proftpd.py::TestParsingMethods::test_joining_documents_1": true,
"tests/templates/format/test_samba.py::TestParsingMethods::test_if_input_document_contains_few_parameter_lines_and_some_empty_lines__the_initialized_object_contains_correct_dictionary": true,
"tests/templates/format/test_samba.py::TestParsingMethods::test_if_input_document_contains_just_few_parameter_lines__the_initialised_object_contains_correct_dictionary": true,
"tests/templates/format/test_samba.py::TestParsingMethods::test_if_input_document_contains_parameters_to_delete_without_assign_symbol_and_any_values_and_sections_to_delete__the_document_object_contains_dictionary_with_item_to_delete": true,
"tests/templates/format/test_samba.py::TestParsingMethods::test_if_input_document_contains_sections_with_parameters_with_action_marks__the_key_tuples_of_object_s_dictionary_have_it_as_its_first_element": true,
"tests/templates/format/test_samba.py::TestParsingMethods::test_if_input_document_contains_sections_with_similar_names_but_different_parameters__the_parameters_merged_in_one_section": true,
"tests/templates/format/test_samba.py::TestParsingMethods::test_if_input_document_parameters_contains_upper_case_symbols__it_becomes_lower_case": true,
"tests/templates/format/test_samba.py::TestParsingMethods::test_if_joinBefore_flag_is_set__the_document_object_contains_dictionary_with_sections_added_in_the_top_of_it": true,
"tests/templates/format/test_samba.py::TestParsingMethods::test_if_parameter_in_input_document_has_some_comments__the_comments_will_be_collected_in_the_list_of_parameter_value": true,
"tests/templates/format/test_samba.py::TestParsingMethods::test_if_the_IgnoreComments_flag_is_set__the_parser_ignores_all_comments": true,
"tests/templates/format/test_samba.py::TestParsingMethods::test_joining_documents_1": true,
"tests/templates/format/test_samba.py::TestParsingMethods::test_make_template": true,
"tests/templates/format/test_xml_gconf.py::TestParsingMethods::test_if_input_document_is_simple_gconf__the_format_object_contains_correct_dictionary": true,
"tests/templates/format/test_xml_gconf.py::TestParsingMethods::test_if_input_document_is_simple_gconf_tree__the_format_object_contains_correct_dictionary": true,
"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::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::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_intialized_as_dir_parameters_object_using_correct_source_parameter_with_append_link__the_object_will_be_initialized_successfully": true,
"tests/templates/test_parameters_processor.py::TestTemplateParameters::test_if_TemplateParameters_object_is_intialized_as_dir_parameters_object_using_source_parameter_but_without_append_link__the_initialization_of_the_object_will_be_failed": true,
"tests/templates/test_parameters_processor.py::TestTemplateParameters::test_if_TemplateParameters_object_is_intialized_using_dictionary_with_append_parameter__a_value_of_the_parameter_will_be_checked": true,
"tests/templates/test_parameters_processor.py::TestTemplateParameters::test_if_TemplateParameters_object_is_intialized_using_dictionary_with_autoupdate_parameter__a_value_of_the_parameter_will_be_checked": true,
"tests/templates/test_parameters_processor.py::TestTemplateParameters::test_if_TemplateParameters_object_is_intialized_using_dictionary_with_correct_chmod_parameter__the_object_will_be_initialized_successfully": true,
"tests/templates/test_parameters_processor.py::TestTemplateParameters::test_if_TemplateParameters_object_is_intialized_using_dictionary_with_correct_chmod_parameter_in_its_digital_form__the_object_will_be_initialized_successfully": true,
"tests/templates/test_parameters_processor.py::TestTemplateParameters::test_if_TemplateParameters_object_is_intialized_using_dictionary_with_correct_chown_parameter__the_object_will_be_initialized_successfully": true,
"tests/templates/test_parameters_processor.py::TestTemplateParameters::test_if_TemplateParameters_object_is_intialized_using_dictionary_with_correct_chown_parameter_in_its_digital_form__the_object_will_be_initialized_successfully": true,
"tests/templates/test_parameters_processor.py::TestTemplateParameters::test_if_TemplateParameters_object_is_intialized_using_dictionary_with_correct_force_parameter__the_object_will_be_initialized_successfully": true,
"tests/templates/test_parameters_processor.py::TestTemplateParameters::test_if_TemplateParameters_object_is_intialized_using_dictionary_with_correct_source_parameter__the_object_will_be_initialized_successfully": true,
"tests/templates/test_parameters_processor.py::TestTemplateParameters::test_if_TemplateParameters_object_is_intialized_using_dictionary_with_incorrect_autoupdate_parameter__the_initialization_of_the_object_will_be_failed": true,
"tests/templates/test_parameters_processor.py::TestTemplateParameters::test_if_TemplateParameters_object_is_intialized_using_dictionary_with_incorrect_chown_parameter__the_initialization_of_the_object_will_be_failed": true,
"tests/templates/test_parameters_processor.py::TestTemplateParameters::test_if_TemplateParameters_object_is_intialized_using_dictionary_with_incorrect_force_parameter__the_initialization_of_the_object_will_be_failed": true,
"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::TestTemplateAction::test_chmod_directory": true,
"tests/templates/test_template_action.py::TestTemplateAction::test_chown_directory": true,
"tests/templates/test_template_action.py::TestTemplateAction::test_create_directory": true,
"tests/templates/test_template_action.py::TestTemplateAction::test_link_directory": true,
"tests/templates/test_template_action.py::TestTemplateAction::test_remove_directory": 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,
"tests/templates/test_template_engine.py::TestTemplateEngine::test_if_an_input_template_contains_condition_and_it_is_True__the_template_engine_object_will_be_initialized_without_any_exceptions": true,
"tests/templates/test_template_engine.py::TestTemplateEngine::test_if_an_input_template_contains_env_parameter_in_which_module_name_is_assigned__the_variables_from_this_module_can_be_used_in_template_without_determining_of_their_module": true,
"tests/templates/test_template_engine.py::TestTemplateEngine::test_if_an_input_template_contains_pkg_function_with_existing_package_as_its_argument__it_works_correctly_and_pkg_function_returns_version_value": true,
"tests/templates/test_template_engine.py::TestTemplateEngine::test_if_an_input_template_contains_pkg_function_with_package_that_does_not_exist_in_its_argument__it_works_correctly_and_pkg_function_returns_empty_version_value": true,
"tests/templates/test_template_engine.py::TestTemplateEngine::test_if_an_input_template_contains_pkg_function_without_any_arguments_and_without_package_parameter_in_calculate_tag__the_pkg_function_returns_empty_version_value": true,
"tests/templates/test_template_engine.py::TestTemplateEngine::test_if_an_input_template_contains_pkg_function_without_any_arguments_but_with_package_parameter_in_calculate_tag__the_pkg_function_returns_version_value_of_the_package_from_package_parameter": true,
"tests/templates/test_template_engine.py::TestTemplateEngine::test_if_an_input_template_contains_several_calculate_tags__the_template_engine_will_parse_them_all_and_will_contain_all_parameters_and_result_of_all_conditions": true,
"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/utils/test_files.py::TestUtils::test_if_a_pipe_Process_object_uses_for_several_writes__it_successfully_executes_even_after_read": true,
"tests/utils/test_files.py::TestUtils::test_if_a_pipe_Process_object_uses_for_several_writes_without_readings__it_successfully_executes": true,
"tests/utils/test_files.py::TestUtils::test_if_pipe_is_executed_using_Process_object__it_has_successfully_executed": true,
"tests/utils/test_files.py::TestUtils::test_if_single_correct_command_executed_using_Process_object__it_successfully_executes": true,
"tests/utils/test_package.py::TestContents::test_if_PackageContents_object_contains_contents_dictionary__it_renders_CONTENTS_file_correctly": true,
"tests/utils/test_package.py::TestContents::test_if_PackageContents_object_initialized_by_existing_package__it_contains_dictionary_of_items_from_contents_file": true,
"tests/utils/test_package.py::TestContents::test_if_new_directory_is_added_in_contents_file_using_add_dir_method__the_PackageContents_object_renders_the_contents_file_with_new_dir": true,
"tests/utils/test_package.py::TestContents::test_if_new_link_is_added_in_contents_file_using_add_sym_method__the_PackageContents_object_renders_the_contents_file_with_new_sym": true,
"tests/utils/test_package.py::TestContents::test_if_new_object_is_added_in_contents_file_using_add_obj_method__the_PackageContents_object_renders_the_contents_file_with_new_obj": true,
"tests/utils/test_package.py::TestContents::test_if_the_PackageAtom_object_parsed_a_correct_package_atom_name_but_without_a_slot_and_use_flags__the_PackageAtom_object_returns_atom_name_of_package": true,
"tests/utils/test_package.py::TestContents::test_if_the_PackageAtom_object_parsed_a_correct_package_atom_name_with_a_slot_value__the_PackageAtom_returns_atom_name_of_package_with_this_slot": true,
"tests/utils/test_package.py::TestContents::test_if_the_PackageAtom_object_parsed_a_correct_package_atom_name_with_a_uses_value__the_PackageAtom_object_returns_atom_name_of_package_with_this_use_flags": true,
"tests/utils/test_package.py::TestContents::test_if_the_PackageAtom_object_parsed_a_correct_package_atom_name_with_an_empty_slot_value__the_PackageAtom_object_returns_atom_name_of_package": true,
"tests/utils/test_package.py::TestContents::test_if_the_PackageAtom_object_parses_a_correct_package_atom_name_without_version_value_but_with_slot_value__the_PackageAtom_object_looks_for_package_with_assigned_slot_value": true,
"tests/utils/test_package.py::TestContents::test_if_the_PackageAtom_object_parses_a_correct_package_atom_name_without_version_value_but_with_use_flags_value__the_PackageAtom_object_looks_for_package_with_assigned_use_flags": true,
"tests/utils/test_package.py::TestContents::test_if_the_PackageAtom_object_tried_to_parse_an_correct_package_atom_name_that_matches_multiple_packages__the_PackageAtom_object_gets_info_for_package_with_older_version": true,
"tests/utils/test_package.py::TestContents::test_if_the_PackageAtom_object_tried_to_parse_an_incorrect_package_atom_name__the_PackageAtom_object_throws_the_PackageAtomError_exception": true,
"tests/utils/test_package.py::TestContents::test_if_the_PackageAtom_object_tried_to_parse_an_package_atom_name_with_incorrect_use_flags__the_PackageAtom_object_throws_the_PackageAtomError_exception": true,
"tests/utils/test_package.py::TestContents::test_if_the_get_file_package_method_of_the_PackageAtom_object_is_called_with_a_name_of_a_file_that_belongs_to_any_package__the_PackageAtom_object_contains_dictionary_with_an_owner_package": true,
"tests/utils/test_package.py::TestContents::test_if_the_get_file_package_method_of_the_PackageAtom_object_is_called_with_a_name_of_a_file_that_does_not_belong_to_any_package__the_PackageAtom_object_throws_the_PackageAtomError_exception": true,
"tests/utils/test_package.py::TestContents::test_if_two_Version_objects_compared_using_eq_operation_and_the_left_version_value_is_less_than_or_equal_to_the_right_version__the_result_of_the_comparing_would_be_True": true,
"tests/utils/test_package.py::TestContents::test_if_two_Version_objects_compared_using_ge_operation_and_the_left_version_value_is_less_than_or_equal_to_the_right_version__the_result_of_the_comparing_would_be_True": true,
"tests/utils/test_package.py::TestContents::test_if_two_Version_objects_compared_using_gt_operation_and_the_left_version_value_is_less_than_the_right_version__the_result_of_the_comparing_would_be_True": true,
"tests/utils/test_package.py::TestContents::test_if_two_Version_objects_compared_using_le_operation_and_the_left_version_value_is_less_than_or_equal_to_the_right_version__the_result_of_the_comparing_would_be_True": true,
"tests/utils/test_package.py::TestContents::test_if_two_Version_objects_compared_using_lt_operation_and_the_left_version_value_is_less_than_the_right_version__the_result_of_the_comparing_would_be_True": true,
"tests/utils/test_package.py::TestContents::test_if_two_Version_objects_compared_using_ne_operation_and_the_left_version_value_is_less_than_or_equal_to_the_right_version__the_result_of_the_comparing_would_be_True": true,
"tests/vars/test_namespace.py::TestNamespace::test_init_default_path": true,
"tests/vars/test_namespace.py::TestNamespace::test_init_empty_namespace": true
}

@ -0,0 +1,187 @@
[
"tests/templates/test_directory_processor.py::TestDirectoryProcessor::test_just_for_debug_without_package_value",
"tests/templates/test_directory_processor.py::TestDirectoryProcessor::test_just_for_debug_with_package_value",
"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",
"tests/templates/test_parameters_processor.py::TestTemplateParameters::test_if_TemplateParameters_object_is_intialized_using_dictionary_with_append_parameter__a_value_of_the_parameter_will_be_checked",
"tests/templates/test_parameters_processor.py::TestTemplateParameters::test_if_TemplateParameters_object_is_intialized_using_dictionary_with_correct_source_parameter__the_object_will_be_initialized_successfully",
"tests/templates/test_parameters_processor.py::TestTemplateParameters::test_if_TemplateParameters_object_is_intialized_as_dir_parameters_object_using_correct_source_parameter_with_append_link__the_object_will_be_initialized_successfully",
"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",
"tests/templates/test_parameters_processor.py::TestTemplateParameters::test_if_TemplateParameters_object_is_intialized_as_dir_parameters_object_using_source_parameter_but_without_append_link__the_initialization_of_the_object_will_be_failed",
"tests/templates/test_parameters_processor.py::TestTemplateParameters::test_if_TemplateParameters_object_is_intialized_using_dictionary_with_correct_force_parameter__the_object_will_be_initialized_successfully",
"tests/templates/test_parameters_processor.py::TestTemplateParameters::test_if_TemplateParameters_object_is_intialized_using_dictionary_with_incorrect_force_parameter__the_initialization_of_the_object_will_be_failed",
"tests/templates/test_parameters_processor.py::TestTemplateParameters::test_if_TemplateParameters_object_is_intialized_using_dictionary_with_autoupdate_parameter__a_value_of_the_parameter_will_be_checked",
"tests/templates/test_parameters_processor.py::TestTemplateParameters::test_if_TemplateParameters_object_is_intialized_using_dictionary_with_incorrect_autoupdate_parameter__the_initialization_of_the_object_will_be_failed",
"tests/templates/test_parameters_processor.py::TestTemplateParameters::test_if_TemplateParameters_object_is_intialized_using_dictionary_with_correct_chown_parameter__the_object_will_be_initialized_successfully",
"tests/templates/test_parameters_processor.py::TestTemplateParameters::test_if_TemplateParameters_object_is_intialized_using_dictionary_with_correct_chown_parameter_in_its_digital_form__the_object_will_be_initialized_successfully",
"tests/templates/test_parameters_processor.py::TestTemplateParameters::test_if_TemplateParameters_object_is_intialized_using_dictionary_with_incorrect_chown_parameter__the_initialization_of_the_object_will_be_failed",
"tests/templates/test_parameters_processor.py::TestTemplateParameters::test_if_TemplateParameters_object_is_intialized_using_dictionary_with_correct_chmod_parameter__the_object_will_be_initialized_successfully",
"tests/templates/test_parameters_processor.py::TestTemplateParameters::test_if_TemplateParameters_object_is_intialized_using_dictionary_with_correct_chmod_parameter_in_its_digital_form__the_object_will_be_initialized_successfully",
"tests/templates/test_template_action.py::TestTemplateAction::test_chown_directory",
"tests/templates/test_template_action.py::TestTemplateAction::test_chmod_directory",
"tests/templates/test_template_action.py::TestTemplateAction::test_create_directory",
"tests/templates/test_template_action.py::TestTemplateAction::test_link_directory",
"tests/templates/test_template_action.py::TestTemplateAction::test_remove_directory",
"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",
"tests/templates/test_template_engine.py::TestTemplateEngine::test_if_an_input_template_binded_with_datavars_module__variables_available_in_a_template",
"tests/templates/test_template_engine.py::TestTemplateEngine::test_if_an_input_template_contains_env_parameter_in_which_module_name_is_assigned__the_variables_from_this_module_can_be_used_in_template_without_determining_of_their_module",
"tests/templates/test_template_engine.py::TestTemplateEngine::test_if_an_input_template_contains_condition_and_it_is_True__the_template_engine_object_will_be_initialized_without_any_exceptions",
"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",
"tests/templates/test_template_engine.py::TestTemplateEngine::test_if_an_input_template_contains_several_calculate_tags__the_template_engine_will_parse_them_all_and_will_contain_all_parameters_and_result_of_all_conditions",
"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",
"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",
"tests/templates/test_template_engine.py::TestTemplateEngine::test_if_an_input_template_contains_pkg_function_with_existing_package_as_its_argument__it_works_correctly_and_pkg_function_returns_version_value",
"tests/templates/test_template_engine.py::TestTemplateEngine::test_if_an_input_template_contains_pkg_function_with_package_that_does_not_exist_in_its_argument__it_works_correctly_and_pkg_function_returns_empty_version_value",
"tests/templates/test_template_engine.py::TestTemplateEngine::test_if_an_input_template_contains_pkg_function_without_any_arguments_but_with_package_parameter_in_calculate_tag__the_pkg_function_returns_version_value_of_the_package_from_package_parameter",
"tests/templates/test_template_engine.py::TestTemplateEngine::test_if_an_input_template_contains_pkg_function_without_any_arguments_and_without_package_parameter_in_calculate_tag__the_pkg_function_returns_empty_version_value",
"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",
"tests/templates/format/test_base.py::TestJoinMethod::test_if_inputs_are_dictionaries_with_string_keys_without_any_action_marks__the_dictionaties_just_merged",
"tests/templates/format/test_base.py::TestJoinMethod::test_if_inputs_are_dictionaries_with_tuple_keys_without_any_action_marks_as_their_keys__the_dictionaries_just_merged",
"tests/templates/format/test_base.py::TestJoinMethod::test_if_inputs_are_dictionaries_with_same_sections_which_contain_different_parameters__a_section_from_the_template_added_to_the_same_section_of_original_dictionary",
"tests/templates/format/test_base.py::TestJoinMethod::test_if_inputs_are_dictionaries_with_parameters_with_same_name_in_same_section__parameters_values_in_original_dictionary_changed_to_values_from_template",
"tests/templates/format/test_base.py::TestJoinMethod::test_if_input_template_dictionary_has_delete_mark_for_section__section_will_be_deleted",
"tests/templates/format/test_base.py::TestJoinMethod::test_if_input_template_dictionary_has_replace_mark_for_section__section_will_be_deleted",
"tests/templates/format/test_base.py::TestJoinMethod::test_if_input_template_dictionary_has_delete_mark_for_parameter__parameter_will_be_deleted",
"tests/templates/format/test_base.py::TestJoinMethod::test_if_input_dictionaries_have_no_sections_and_have_only_parameter_lines__it_will_be_processed_correctly",
"tests/templates/format/test_base.py::TestLogicLinesMethod::test_if_input_is_text_document_the_method_returns_list_of_its_lines",
"tests/templates/format/test_base.py::TestLogicLinesMethod::test_if_lines_in_document_divided_using_backslash_as_continuation_symbol__method_returns_list_of_full_lines",
"tests/templates/format/test_bind.py::TestParsingMethods::test_if_input_document_contains_just_few_parameter_lines__the_initialised_object_contains_correct_dictionary",
"tests/templates/format/test_bind.py::TestParsingMethods::test_if_input_document_contains_some_block_of_parameters__the_initialised_object_contains_correct_dictionary",
"tests/templates/format/test_bind.py::TestParsingMethods::test_if_input_document_contains_some_blocks_with_similar_names__the_blocks_join_recursively",
"tests/templates/format/test_bind.py::TestParsingMethods::test_if_input_document_contains_blocks_and_parameters_with_action_marks__the_key_tuples_of_object_s_dictionary_have_it_as_its_first_element",
"tests/templates/format/test_bind.py::TestParsingMethods::test_if_parameters_and_blocks_in_input_document_has_some_comments__the_comments_will_be_collected_in_the_list_of_parameter_value_or_with_special_key_in_block_dictionary",
"tests/templates/format/test_bind.py::TestParsingMethods::test_if_the_IgnoreComments_flag_is_set__the_parser_ignores_all_comments",
"tests/templates/format/test_bind.py::TestParsingMethods::test_if_input_document_contains_parameters_to_delete_without_values_or_with_empty_block__the_document_object_contains_dictionary_with_item_to_delete",
"tests/templates/format/test_bind.py::TestParsingMethods::test_joining_documents_1",
"tests/templates/format/test_bind.py::TestParsingMethods::test_make_template",
"tests/templates/format/test_compiz.py::TestParsingMethods::test_if_input_document_contains_just_few_parameter_lines__the_initialised_object_contains_correct_dictionary",
"tests/templates/format/test_compiz.py::TestParsingMethods::test_if_input_document_contains_few_parameter_lines_and_some_empty_lines__the_initialized_object_contains_correct_dictionary",
"tests/templates/format/test_compiz.py::TestParsingMethods::test_if_input_document_contains_sections_with_different_names_but_different_parameters__the_parameters_merged_in_one_section",
"tests/templates/format/test_compiz.py::TestParsingMethods::test_if_input_document_contains_sections_with_parameters_with_action_marks__the_key_tuples_of_object_s_dictionary_have_it_as_its_first_element",
"tests/templates/format/test_compiz.py::TestParsingMethods::test_if_parameter_in_input_document_has_some_comments__the_comments_will_be_collected_in_the_list_of_parameter_value",
"tests/templates/format/test_compiz.py::TestParsingMethods::test_if_the_ignore_comments_flag_is_set__the_parser_ignores_all_comments",
"tests/templates/format/test_compiz.py::TestParsingMethods::test_if_input_document_contains_parameters_to_delete_without_assign_symbol_and_any_values_and_sections_to_delete__the_document_object_contains_dictionary_with_item_to_delete",
"tests/templates/format/test_compiz.py::TestParsingMethods::test_joining_documents_1",
"tests/templates/format/test_compiz.py::TestParsingMethods::test_make_template",
"tests/templates/format/test_contents.py::TestParsingMethods::test_if_input_document_contains_a_few_lines_without_any_action_symbols__the_initialised_object_contains_correct_dictionary",
"tests/templates/format/test_contents.py::TestParsingMethods::test_if_input_document_contains_a_few_lines_with_some_action_symbols__the_initialised_object_contains_correct_dictionary",
"tests/templates/format/test_contents.py::TestParsingMethods::test_if_template_parser_flag_is_set_False__the_initialized_object_contains_correct_dictionary_for_contents_util_module",
"tests/templates/format/test_contents.py::TestParsingMethods::test_joining_documents_1",
"tests/templates/format/test_diff.py::TestExecuteMethods::test_if_diff_patch_used_for_patching_of_several_files__it_changes_patched_file_correctly",
"tests/templates/format/test_diff.py::TestExecuteMethods::test_if_diff_patch_used_for_patching_of_directories__it_changes_files_in_directories_and_adds_ones",
"tests/templates/format/test_dovecot.py::TestParsingMethods::test_if_input_document_contains_just_few_parameter_lines__the_initialised_object_contains_correct_dictionary",
"tests/templates/format/test_dovecot.py::TestParsingMethods::test_if_input_document_contains_some_block_of_parameters__the_initialised_object_contains_correct_dictionary",
"tests/templates/format/test_dovecot.py::TestParsingMethods::test_if_input_document_contains_some_blocks_with_similar_names__the_blocks_join_recursively",
"tests/templates/format/test_dovecot.py::TestParsingMethods::test_if_input_document_contains_blocks_and_parameters_with_action_marks__the_key_tuples_of_object_s_dictionary_have_it_as_its_first_element",
"tests/templates/format/test_dovecot.py::TestParsingMethods::test_if_parameters_and_blocks_in_input_document_has_some_comments__the_comments_will_be_collected_in_the_list_of_parameter_value_or_with_special_key_in_block_dictionary",
"tests/templates/format/test_dovecot.py::TestParsingMethods::test_if_the_IgnoreComments_flag_is_set__the_parser_ignores_all_comments",
"tests/templates/format/test_dovecot.py::TestParsingMethods::test_if_input_document_contains_parameters_to_delete_without_values_or_with_empty_block__the_document_object_contains_dictionary_with_item_to_delete",
"tests/templates/format/test_dovecot.py::TestParsingMethods::test_joining_documents_1",
"tests/templates/format/test_dovecot.py::TestParsingMethods::test_make_template",
"tests/templates/format/test_json.py::TestParsingMethods::test_if_input_document_contains_just_few_parameters_and_parameter_blocks__the_initialised_object_contains_correct_dictionary",
"tests/templates/format/test_json.py::TestParsingMethods::test_joining_documents_1",
"tests/templates/format/test_json.py::TestParsingMethods::test_make_template",
"tests/templates/format/test_kde.py::TestParsingMethods::test_if_input_document_contains_just_few_parameter_lines__the_initialised_object_contains_correct_dictionary",
"tests/templates/format/test_kde.py::TestParsingMethods::test_if_input_document_contains_parameters_with_values_with_unicode_symbols__the_initialized_object_contains_correct_dictionary",
"tests/templates/format/test_kde.py::TestParsingMethods::test_if_input_document_contains_few_parameter_lines_and_some_empty_lines__the_initialized_object_contains_correct_dictionary",
"tests/templates/format/test_kde.py::TestParsingMethods::test_if_input_document_contains_sections_with_different_names_but_different_parameters__the_parameters_merged_in_one_section",
"tests/templates/format/test_kde.py::TestParsingMethods::test_if_input_document_contains_sections_with_parameters_with_action_marks__the_key_tuples_of_object_s_dictionary_have_it_as_its_first_element",
"tests/templates/format/test_kde.py::TestParsingMethods::test_if_parameter_in_input_document_has_some_comments__the_comments_will_be_collected_in_the_list_of_parameter_value",
"tests/templates/format/test_kde.py::TestParsingMethods::test_if_the_IgnoreComments_flag_is_set__the_parser_ignores_all_comments",
"tests/templates/format/test_kde.py::TestParsingMethods::test_if_input_document_contains_parameters_to_delete_without_assign_symbol_and_any_values_and_sections_to_delete__the_document_object_contains_dictionary_with_item_to_delete",
"tests/templates/format/test_kde.py::TestParsingMethods::test_joining_documents_1",
"tests/templates/format/test_kde.py::TestParsingMethods::test_make_template",
"tests/templates/format/test_kernel.py::TestParsingMethods::test_if_input_document_contains_just_few_parameter_lines__the_initialised_object_contains_correct_dictionary",
"tests/templates/format/test_kernel.py::TestParsingMethods::test_if_input_document_contains_few_parameter_lines_and_some_empty_lines__the_initialized_object_contains_correct_dictionary",
"tests/templates/format/test_kernel.py::TestParsingMethods::test_if_input_document_contains_parameters_with_action_marks__the_key_tuples_of_object_s_dictionary_have_it_as_its_first_element",
"tests/templates/format/test_kernel.py::TestParsingMethods::test_if_parameter_in_input_document_has_some_comments__the_comments_will_be_collected_in_the_list_of_parameter_value",
"tests/templates/format/test_kernel.py::TestParsingMethods::test_if_input_document_contains_parameters_to_delete_without_assign_symbol_and_any_values__the_document_object_contains_dictionary_with_item_to_delete",
"tests/templates/format/test_kernel.py::TestParsingMethods::test_joining_documents_1",
"tests/templates/format/test_kernel.py::TestParsingMethods::test_make_template",
"tests/templates/format/test_ldap.py::TestParsingMethods::test_if_logiclines_method_takes_text_with_lines_that_starts_whit_space_symbols__it_returns_joined_lines",
"tests/templates/format/test_ldap.py::TestParsingMethods::test_if_input_doc_contains_some_type_sections_with_plain_directives__object_dictionary_contains_correct_dictionary_with_directives_values_and_comments",
"tests/templates/format/test_ldap.py::TestParsingMethods::test_if_input_document_contains_access_to_directive__the_object_s_dictionary_contains_correct_dictionary_with_list_of_access_to_parameters_and_comments",
"tests/templates/format/test_ldap.py::TestParsingMethods::test_if_input_document_contains_syncrepl_directive__the_object_s_dictionary_contains_correct_dictionary_with_list_of_syncrepl_parameters_and_comments",
"tests/templates/format/test_ldap.py::TestParsingMethods::test_if_input_document_contains_index_directives__the_object_s_dictionary_contains_correct_dictionary_with_index_elements_and_comments",
"tests/templates/format/test_ldap.py::TestParsingMethods::test_if_input_document_contains_comments_to_type_sections__the_object_s_dictionary_collect_them",
"tests/templates/format/test_ldap.py::TestParsingMethods::test_if_input_doc_contains_some_type_sections_with_plain_directives_and_action_marks__object_dictionary_contains_correct_dictionary_with_directives_values_and_comments",
"tests/templates/format/test_ldap.py::TestParsingMethods::test_if_template_text_contains_some_access_to_constuctions_with_same_what_value_and_without_action_marks_for_whole_constructions__they_join_in_one_access_to_construction",
"tests/templates/format/test_ldap.py::TestParsingMethods::test_if_input_document_contains_syncrepl_and_access_to_constructions_with_action_marks__object_dictionary_contains_correct_dictionary_with_action_marks",
"tests/templates/format/test_ldap.py::TestParsingMethods::test_joining_documents_1",
"tests/templates/format/test_openrc.py::TestParsingMethods::test_if_input_document_contains_just_few_parameter_lines__the_initialised_object_contains_correct_dictionary",
"tests/templates/format/test_openrc.py::TestParsingMethods::test_if_input_document_contains_few_parameter_lines_and_some_empty_lines__the_initialized_object_contains_correct_dictionary",
"tests/templates/format/test_openrc.py::TestParsingMethods::test_if_input_document_contains_parameters_with_action_marks__the_key_tuples_of_object_s_dictionary_have_it_as_its_first_element",
"tests/templates/format/test_openrc.py::TestParsingMethods::test_if_parameter_in_input_document_has_some_comments__the_comments_will_be_collected_in_the_list_of_parameter_value",
"tests/templates/format/test_openrc.py::TestParsingMethods::test_if_the_IgnoreComments_flag_is_set__the_parser_ignores_all_comments",
"tests/templates/format/test_openrc.py::TestParsingMethods::test_if_input_document_contains_parameters_to_delete_without_assign_symbol_and_any_values__the_document_object_contains_dictionary_with_item_to_delete",
"tests/templates/format/test_openrc.py::TestParsingMethods::test_joining_documents_1",
"tests/templates/format/test_openrc.py::TestParsingMethods::test_make_template",
"tests/templates/format/test_patch.py::TestParsingMethods::test_if_input_patch_document_contains_only_regular_expressions_without_any_regex_flags__it_correctly_patches_input_document",
"tests/templates/format/test_patch.py::TestParsingMethods::test_if_input_patch_document_contains_regular_expressions_with_global_regex_flags_and_flags_as_attributes__it_correctly_patches_input_document_using_regex_flags",
"tests/templates/format/test_postfix.py::TestParsingMethods::test_if_input_document_contains_just_few_parameter_lines__the_initialised_object_contains_correct_dictionary",
"tests/templates/format/test_postfix.py::TestParsingMethods::test_if_input_document_contains_few_parameter_lines_and_some_empty_lines__the_initialized_object_contains_correct_dictionary",
"tests/templates/format/test_postfix.py::TestParsingMethods::test_if_input_document_contains_parameters_with_action_marks__the_key_tuples_of_object_s_dictionary_have_it_as_its_first_element",
"tests/templates/format/test_postfix.py::TestParsingMethods::test_if_parameter_in_input_document_has_some_comments__the_comments_will_be_collected_in_the_list_of_parameter_value",
"tests/templates/format/test_postfix.py::TestParsingMethods::test_if_the_IgnoreComments_flag_is_set__the_parser_ignores_all_comments",
"tests/templates/format/test_postfix.py::TestParsingMethods::test_if_input_document_contains_parameters_to_delete_without_assign_symbol_and_any_values__the_document_object_contains_dictionary_with_item_to_delete",
"tests/templates/format/test_postfix.py::TestParsingMethods::test_joining_documents_1",
"tests/templates/format/test_postfix.py::TestParsingMethods::test_make_template",
"tests/templates/format/test_procmail.py::TestParsingMethods::test_if_input_document_contains_just_few_parameter_lines__the_initialised_object_contains_correct_dictionary",
"tests/templates/format/test_procmail.py::TestParsingMethods::test_if_input_document_contains_few_parameter_lines_and_some_empty_lines__the_initialized_object_contains_correct_dictionary",
"tests/templates/format/test_procmail.py::TestParsingMethods::test_if_input_document_contains_parameters_with_action_marks__the_key_tuples_of_object_s_dictionary_have_it_as_its_first_element",
"tests/templates/format/test_procmail.py::TestParsingMethods::test_if_parameter_in_input_document_has_some_comments__the_comments_will_be_collected_in_the_list_of_parameter_value",
"tests/templates/format/test_procmail.py::TestParsingMethods::test_if_the_IgnoreComments_flag_is_set__the_parser_ignores_all_comments",
"tests/templates/format/test_procmail.py::TestParsingMethods::test_if_input_document_contains_parameters_to_delete_without_assign_symbol_and_any_values__the_document_object_contains_dictionary_with_item_to_delete",
"tests/templates/format/test_procmail.py::TestParsingMethods::test_joining_documents_1",
"tests/templates/format/test_procmail.py::TestParsingMethods::test_make_template",
"tests/templates/format/test_proftpd.py::TestParsingMethods::test_if_input_document_contains_just_few_parameter_lines__the_initialised_object_contains_correct_dictionary",
"tests/templates/format/test_proftpd.py::TestParsingMethods::test_if_input_document_contains_some_block_of_parameters__the_initialised_object_contains_correct_dictionary",
"tests/templates/format/test_proftpd.py::TestParsingMethods::test_if_input_document_contains_blocks_and_parameters_with_action_marks__the_key_tuples_of_parameters_s_have_it_as_its_first_element_inherited",
"tests/templates/format/test_proftpd.py::TestParsingMethods::test_if_parameters_and_blocks_in_input_document_has_some_comments__the_comments_will_be_collected_in_the_list_of_parameter_value_or_with_special_key_in_block_dictionary",
"tests/templates/format/test_proftpd.py::TestParsingMethods::test_if_the_ignoreComments_flag_is_set__the_parser_ignores_all_comments",
"tests/templates/format/test_proftpd.py::TestParsingMethods::test_if_input_document_contains_parameters_to_delete_without_any_values_the_document_object_contains_dictionary_with_this_items_to_delete",
"tests/templates/format/test_proftpd.py::TestParsingMethods::test_joining_documents_1",
"tests/templates/format/test_samba.py::TestParsingMethods::test_if_input_document_contains_just_few_parameter_lines__the_initialised_object_contains_correct_dictionary",
"tests/templates/format/test_samba.py::TestParsingMethods::test_if_input_document_contains_few_parameter_lines_and_some_empty_lines__the_initialized_object_contains_correct_dictionary",
"tests/templates/format/test_samba.py::TestParsingMethods::test_if_input_document_contains_sections_with_similar_names_but_different_parameters__the_parameters_merged_in_one_section",
"tests/templates/format/test_samba.py::TestParsingMethods::test_if_input_document_contains_sections_with_parameters_with_action_marks__the_key_tuples_of_object_s_dictionary_have_it_as_its_first_element",
"tests/templates/format/test_samba.py::TestParsingMethods::test_if_parameter_in_input_document_has_some_comments__the_comments_will_be_collected_in_the_list_of_parameter_value",
"tests/templates/format/test_samba.py::TestParsingMethods::test_if_the_IgnoreComments_flag_is_set__the_parser_ignores_all_comments",
"tests/templates/format/test_samba.py::TestParsingMethods::test_if_input_document_contains_parameters_to_delete_without_assign_symbol_and_any_values_and_sections_to_delete__the_document_object_contains_dictionary_with_item_to_delete",
"tests/templates/format/test_samba.py::TestParsingMethods::test_if_joinBefore_flag_is_set__the_document_object_contains_dictionary_with_sections_added_in_the_top_of_it",
"tests/templates/format/test_samba.py::TestParsingMethods::test_if_input_document_parameters_contains_upper_case_symbols__it_becomes_lower_case",
"tests/templates/format/test_samba.py::TestParsingMethods::test_joining_documents_1",
"tests/templates/format/test_samba.py::TestParsingMethods::test_make_template",
"tests/templates/format/test_xml_gconf.py::TestParsingMethods::test_if_input_document_is_simple_gconf_tree__the_format_object_contains_correct_dictionary",
"tests/templates/format/test_xml_gconf.py::TestParsingMethods::test_if_input_document_is_simple_gconf__the_format_object_contains_correct_dictionary",
"tests/templates/format/test_xml_gconf.py::TestParsingMethods::test_joining_documents_1",
"tests/templates/format/test_xml_xfce.py::TestParsingMethods::test_if_input_document_contains_just_few_parameter_lines__the_initialised_object_contains_correct_dictionary",
"tests/templates/format/test_xml_xfce.py::TestParsingMethods::test_joining_documents_1",
"tests/utils/test_files.py::TestUtils::test_if_single_correct_command_executed_using_Process_object__it_successfully_executes",
"tests/utils/test_files.py::TestUtils::test_if_pipe_is_executed_using_Process_object__it_has_successfully_executed",
"tests/utils/test_files.py::TestUtils::test_if_a_pipe_Process_object_uses_for_several_writes_without_readings__it_successfully_executes",
"tests/utils/test_files.py::TestUtils::test_if_a_pipe_Process_object_uses_for_several_writes__it_successfully_executes_even_after_read",
"tests/utils/test_package.py::TestContents::test_if_two_Version_objects_compared_using_lt_operation_and_the_left_version_value_is_less_than_the_right_version__the_result_of_the_comparing_would_be_True",
"tests/utils/test_package.py::TestContents::test_if_two_Version_objects_compared_using_le_operation_and_the_left_version_value_is_less_than_or_equal_to_the_right_version__the_result_of_the_comparing_would_be_True",
"tests/utils/test_package.py::TestContents::test_if_two_Version_objects_compared_using_gt_operation_and_the_left_version_value_is_less_than_the_right_version__the_result_of_the_comparing_would_be_True",
"tests/utils/test_package.py::TestContents::test_if_two_Version_objects_compared_using_ge_operation_and_the_left_version_value_is_less_than_or_equal_to_the_right_version__the_result_of_the_comparing_would_be_True",
"tests/utils/test_package.py::TestContents::test_if_two_Version_objects_compared_using_ne_operation_and_the_left_version_value_is_less_than_or_equal_to_the_right_version__the_result_of_the_comparing_would_be_True",
"tests/utils/test_package.py::TestContents::test_if_two_Version_objects_compared_using_eq_operation_and_the_left_version_value_is_less_than_or_equal_to_the_right_version__the_result_of_the_comparing_would_be_True",
"tests/utils/test_package.py::TestContents::test_if_PackageContents_object_initialized_by_existing_package__it_contains_dictionary_of_items_from_contents_file",
"tests/utils/test_package.py::TestContents::test_if_PackageContents_object_contains_contents_dictionary__it_renders_CONTENTS_file_correctly",
"tests/utils/test_package.py::TestContents::test_if_new_directory_is_added_in_contents_file_using_add_dir_method__the_PackageContents_object_renders_the_contents_file_with_new_dir",
"tests/utils/test_package.py::TestContents::test_if_new_object_is_added_in_contents_file_using_add_obj_method__the_PackageContents_object_renders_the_contents_file_with_new_obj",
"tests/utils/test_package.py::TestContents::test_if_new_link_is_added_in_contents_file_using_add_sym_method__the_PackageContents_object_renders_the_contents_file_with_new_sym",
"tests/utils/test_package.py::TestContents::test_if_the_PackageAtom_object_parsed_a_correct_package_atom_name_but_without_a_slot_and_use_flags__the_PackageAtom_object_returns_atom_name_of_package",
"tests/utils/test_package.py::TestContents::test_if_the_PackageAtom_object_parsed_a_correct_package_atom_name_with_a_slot_value__the_PackageAtom_returns_atom_name_of_package_with_this_slot",
"tests/utils/test_package.py::TestContents::test_if_the_PackageAtom_object_parsed_a_correct_package_atom_name_with_an_empty_slot_value__the_PackageAtom_object_returns_atom_name_of_package",
"tests/utils/test_package.py::TestContents::test_if_the_PackageAtom_object_parsed_a_correct_package_atom_name_with_a_uses_value__the_PackageAtom_object_returns_atom_name_of_package_with_this_use_flags",
"tests/utils/test_package.py::TestContents::test_if_the_PackageAtom_object_parses_a_correct_package_atom_name_without_version_value_but_with_slot_value__the_PackageAtom_object_looks_for_package_with_assigned_slot_value",
"tests/utils/test_package.py::TestContents::test_if_the_PackageAtom_object_parses_a_correct_package_atom_name_without_version_value_but_with_use_flags_value__the_PackageAtom_object_looks_for_package_with_assigned_use_flags",
"tests/utils/test_package.py::TestContents::test_if_the_PackageAtom_object_tried_to_parse_an_incorrect_package_atom_name__the_PackageAtom_object_throws_the_PackageAtomError_exception",
"tests/utils/test_package.py::TestContents::test_if_the_PackageAtom_object_tried_to_parse_an_package_atom_name_with_incorrect_use_flags__the_PackageAtom_object_throws_the_PackageAtomError_exception",
"tests/utils/test_package.py::TestContents::test_if_the_PackageAtom_object_tried_to_parse_an_correct_package_atom_name_that_matches_multiple_packages__the_PackageAtom_object_gets_info_for_package_with_older_version",
"tests/utils/test_package.py::TestContents::test_if_the_get_file_package_method_of_the_PackageAtom_object_is_called_with_a_name_of_a_file_that_belongs_to_any_package__the_PackageAtom_object_contains_dictionary_with_an_owner_package",
"tests/utils/test_package.py::TestContents::test_if_the_get_file_package_method_of_the_PackageAtom_object_is_called_with_a_name_of_a_file_that_does_not_belong_to_any_package__the_PackageAtom_object_throws_the_PackageAtomError_exception",
"tests/vars/test_namespace.py::TestNamespace::test_init_empty_namespace",
"tests/vars/test_namespace.py::TestNamespace::test_init_default_path"
]

@ -4,6 +4,7 @@
# не весь файл -- выдаем ошибку. # не весь файл -- выдаем ошибку.
# #
from .base_format import BaseFormat from .base_format import BaseFormat
from ..template_engine import ParametersContainer
from collections import OrderedDict from collections import OrderedDict
from pyparsing import originalTextFor, OneOrMore, Word, alphanums, Literal,\ from pyparsing import originalTextFor, OneOrMore, Word, alphanums, Literal,\
ZeroOrMore, Forward, Optional, Group, restOfLine,\ ZeroOrMore, Forward, Optional, Group, restOfLine,\
@ -20,7 +21,7 @@ class BINDFormat(BaseFormat):
def __init__(self, document_text: str, def __init__(self, document_text: str,
ignore_comments=False, ignore_comments=False,
join_before=False, join_before=False,
comment_symbol=''): parameters=ParametersContainer()):
processing_methods = [] processing_methods = []
super().__init__(processing_methods) super().__init__(processing_methods)
@ -28,7 +29,6 @@ class BINDFormat(BaseFormat):
self._ignore_comments = ignore_comments self._ignore_comments = ignore_comments
self._comments_processing = True self._comments_processing = True
self._join_before = join_before self._join_before = join_before
self._comment_symbol = comment_symbol
self._last_comments_list = [] self._last_comments_list = []
self._initialize_parser() self._initialize_parser()
@ -114,20 +114,10 @@ class BINDFormat(BaseFormat):
# Для парсинга комментариев. # Для парсинга комментариев.
python_style_comment = originalTextFor(Literal('#') + restOfLine) python_style_comment = originalTextFor(Literal('#') + restOfLine)
if not self._comment_symbol: comments = (cppStyleComment |
comments = (cppStyleComment | python_style_comment).setParseAction(
python_style_comment).setParseAction(
self._create_comment_list self._create_comment_list
) )
else:
custom_style_comment = originalTextFor(
Literal(self._comment_symbol) + restOfLine
)
comments = (cppStyleComment |
python_style_comment |
custom_style_comment).setParseAction(
self._create_comment_list
)
# Для парсинга директивы include. # Для парсинга директивы include.
include_line = (Optional(action_symbols, default='')('action') include_line = (Optional(action_symbols, default='')('action')

@ -1,6 +1,7 @@
# vim: fileencoding=utf-8 # vim: fileencoding=utf-8
# #
from .base_format import BaseFormat from .base_format import BaseFormat
from ..template_engine import ParametersContainer
from collections import OrderedDict from collections import OrderedDict
from pyparsing import originalTextFor, Literal, ZeroOrMore, Word, printables,\ from pyparsing import originalTextFor, Literal, ZeroOrMore, Word, printables,\
OneOrMore, alphanums, ParseException, restOfLine,\ OneOrMore, alphanums, ParseException, restOfLine,\
@ -20,7 +21,8 @@ class CompizFormat(BaseFormat):
def __init__(self, document_text: str, def __init__(self, document_text: str,
ignore_comments=False, ignore_comments=False,
join_before=False): join_before=False,
parameters=ParametersContainer()):
processing_methods = [self._parse_comment_line, processing_methods = [self._parse_comment_line,
self._parse_section_line, self._parse_section_line,
self._parse_parameter_line, self._parse_parameter_line,

@ -22,6 +22,7 @@ class ContentsFormat(BaseFormat):
def __init__(self, document_text: str, def __init__(self, document_text: str,
ignore_comments=False, ignore_comments=False,
join_before=False, join_before=False,
parameters=None,
template_parser=True): template_parser=True):
processing_methods = [self._parse_dir_line, processing_methods = [self._parse_dir_line,
self._parse_sym_line, self._parse_sym_line,

@ -1,6 +1,7 @@
# vim: fileencoding=utf-8 # vim: fileencoding=utf-8
# #
from .base_format import BaseFormat from .base_format import BaseFormat
from ..template_engine import ParametersContainer
from calculate.utils.files import Process from calculate.utils.files import Process
from calculate.templates.format.base_format import FormatError from calculate.templates.format.base_format import FormatError
from os import path from os import path
@ -11,37 +12,48 @@ class DiffFormat(BaseFormat):
EXECUTABLE = True EXECUTABLE = True
def __init__(self, document_text: str, def __init__(self, document_text: str,
join_before=False): join_before=False,
parameters=ParametersContainer()):
self._patch_text = document_text self._patch_text = document_text
self._root_path = '' self._cwd_path = '/'
self._last_level = 0 self._last_level = 0
# вынести в более общий класс или куда-то еще. # Измененные файлы.
self._changed_files_list = [] self.changed_files = dict()
def execute_format(self, root_path): def execute_format(self, target_path):
'''Метод для запуска работы формата.''' '''Метод для запуска работы формата.'''
if path.exists(root_path): self._cwd_path = target_path
self._root_path = root_path if not path.isdir(self._cwd_path):
else: # Если target_path -- путь к файлу, запускаем все процессы из
# директории, в которой этот файл находится.
self._cwd_path = path.dirname(self._cwd_path)
if not path.exists(self._cwd_path):
raise FormatError('root path does not exist') raise FormatError('root path does not exist')
if self._patch_text: if self._patch_text:
return self._patch_document() self._patch_document()
return self.changed_files
else: else:
raise FormatError('empty patch file') raise FormatError('empty patch file')
def _patch_document(self): def _patch_document(self):
'''Метод, производящий наложение патча путем запуска процесса patch.''' '''Метод, производящий наложение патча путем запуска процесса patch.'''
# Сначала определяем на каком уровне накладываем патч.
# Для этого запускаем утилиту patch с --dry-run и смотрим результат
# выполнения.
for level in range(0, 4): for level in range(0, 4):
patch_dry_run = Process('patch', '--dry-run', patch_dry_run = Process('patch', '--dry-run',
'-p{}'.format(level), cwd=self._root_path) '-p{}'.format(level),
cwd=self._cwd_path)
patch_dry_run.write(self._patch_text) patch_dry_run.write(self._patch_text)
if patch_dry_run.success(): if patch_dry_run.success():
break break
patch_dry_run = Process('patch', '-R', '--dry-run', patch_dry_run = Process('patch', '-R', '--dry-run',
'-p{}'.format(level), cwd=self._root_path) '-p{}'.format(level),
cwd=self._cwd_path)
patch_dry_run.write(self._patch_text) patch_dry_run.write(self._patch_text)
if patch_dry_run.success(): if patch_dry_run.success():
return '' return ''
@ -49,13 +61,24 @@ class DiffFormat(BaseFormat):
raise FormatError('correction failed') raise FormatError('correction failed')
self._last_level = level self._last_level = level
patch_run = Process('patch', '-p{}'.format(level), cwd=self._root_path) patch_run = Process('patch', '-p{}'.format(level),
cwd=self._cwd_path)
patch_run.write(self._patch_text) patch_run.write(self._patch_text)
if patch_run.success(): if patch_run.success():
for line in patch_run: for line in patch_run.read_lines():
if line.startswith('patching file'): if line.startswith('patching file'):
self._changed_files_list.append(line[13:].strip()) changed_file_path = path.join(self._cwd_path,
line[13:].strip())
if path.exists(changed_file_path):
self.changed_files.update({changed_file_path:
'modify'})
else:
self.changed_files.update({changed_file_path:
'remove'})
print('Changings: ')
for file_path, change_type in self.changed_files.items():
print('{}: {}'.format(file_path, change_type))
return patch_run.read() return patch_run.read()
else: else:
return '' return ''

@ -4,6 +4,7 @@
# документа. # документа.
# #
from .base_format import BaseFormat from .base_format import BaseFormat
from ..template_engine import ParametersContainer
from collections import OrderedDict from collections import OrderedDict
from pyparsing import originalTextFor, Literal, ZeroOrMore, Word, printables,\ from pyparsing import originalTextFor, Literal, ZeroOrMore, Word, printables,\
OneOrMore, alphanums, ParseException, pyparsing_unicode,\ OneOrMore, alphanums, ParseException, pyparsing_unicode,\
@ -12,9 +13,9 @@ from pyparsing import originalTextFor, Literal, ZeroOrMore, Word, printables,\
class DovecotFormat(BaseFormat): class DovecotFormat(BaseFormat):
FORMAT = 'dovecot' FORMAT = 'dovecot'
EXECUTABLE = False
_initialized = False _initialized = False
_comment_symbol = ''
def __new__(cls, *args, **kwargs): def __new__(cls, *args, **kwargs):
if not cls._initialized: if not cls._initialized:
@ -23,7 +24,8 @@ class DovecotFormat(BaseFormat):
def __init__(self, document_text: str, def __init__(self, document_text: str,
ignore_comments=False, ignore_comments=False,
join_before=False): join_before=False,
parameters=ParametersContainer()):
processing_methods = [self._parse_comment_line, processing_methods = [self._parse_comment_line,
self._parse_section_start_line, self._parse_section_start_line,
self._parse_include_line, self._parse_include_line,

@ -1,15 +1,19 @@
# vim: fileencoding=utf-8 # vim: fileencoding=utf-8
# #
from .base_format import BaseFormat from .base_format import BaseFormat
from ..template_engine import ParametersContainer
from collections import OrderedDict from collections import OrderedDict
import json import json
class JSONFormat(BaseFormat): class JSONFormat(BaseFormat):
FORMAT = 'json' FORMAT = 'json'
EXECUTABLE = False
def __init__(self, document_text: str, ignore_comments=False, def __init__(self, document_text: str,
join_before=False): ignore_comments=False,
join_before=False,
parameters=ParametersContainer()):
processing_methods = [] processing_methods = []
super().__init__(processing_methods) super().__init__(processing_methods)
self._ignore_comments = ignore_comments self._ignore_comments = ignore_comments

@ -1,6 +1,7 @@
# vim: fileencoding=utf-8 # vim: fileencoding=utf-8
# #
from .base_format import BaseFormat from .base_format import BaseFormat
from ..template_engine import ParametersContainer
from collections import OrderedDict from collections import OrderedDict
from pyparsing import originalTextFor, Literal, ZeroOrMore, Word, printables,\ from pyparsing import originalTextFor, Literal, ZeroOrMore, Word, printables,\
OneOrMore, alphanums, ParseException, restOfLine,\ OneOrMore, alphanums, ParseException, restOfLine,\
@ -9,6 +10,7 @@ from pyparsing import originalTextFor, Literal, ZeroOrMore, Word, printables,\
class KDEFormat(BaseFormat): class KDEFormat(BaseFormat):
FORMAT = 'kde' FORMAT = 'kde'
EXECUTABLE = False
_initialized = False _initialized = False
@ -19,7 +21,8 @@ class KDEFormat(BaseFormat):
def __init__(self, document_text: str, def __init__(self, document_text: str,
ignore_comments=False, ignore_comments=False,
join_before=False): join_before=False,
parameters=ParametersContainer()):
processing_methods = [self._parse_comment_line, processing_methods = [self._parse_comment_line,
self._parse_section_line, self._parse_section_line,
self._parse_parameter_line, self._parse_parameter_line,

@ -1,6 +1,7 @@
# vim: fileencoding=utf-8 # vim: fileencoding=utf-8
# #
from .base_format import BaseFormat from .base_format import BaseFormat
from ..template_engine import ParametersContainer
from collections import OrderedDict from collections import OrderedDict
from pyparsing import Word, Literal, alphanums, printables, originalTextFor,\ from pyparsing import Word, Literal, alphanums, printables, originalTextFor,\
ZeroOrMore, OneOrMore, ParseException, restOfLine,\ ZeroOrMore, OneOrMore, ParseException, restOfLine,\
@ -9,6 +10,7 @@ from pyparsing import Word, Literal, alphanums, printables, originalTextFor,\
class KernelFormat(BaseFormat): class KernelFormat(BaseFormat):
FORMAT = 'kernel' FORMAT = 'kernel'
EXECUTABLE = False
_initialized = False _initialized = False
@ -19,7 +21,8 @@ class KernelFormat(BaseFormat):
def __init__(self, document_text: str, def __init__(self, document_text: str,
ignore_comments=False, ignore_comments=False,
join_before=False): join_before=False,
parameters=ParametersContainer()):
processing_methods = [self._parse_comment_line, processing_methods = [self._parse_comment_line,
self._parse_parameter_line, self._parse_parameter_line,
self._parse_to_delete_line] self._parse_to_delete_line]

@ -1,6 +1,7 @@
# vim: fileencoding=utf-8 # vim: fileencoding=utf-8
# #
from .base_format import BaseFormat from .base_format import BaseFormat
from ..template_engine import ParametersContainer
from collections import OrderedDict from collections import OrderedDict
from pyparsing import originalTextFor, Literal, ZeroOrMore, Word, printables,\ from pyparsing import originalTextFor, Literal, ZeroOrMore, Word, printables,\
OneOrMore, alphanums, ParseException, restOfLine,\ OneOrMore, alphanums, ParseException, restOfLine,\
@ -10,6 +11,7 @@ from pyparsing import originalTextFor, Literal, ZeroOrMore, Word, printables,\
class LDAPFormat(BaseFormat): class LDAPFormat(BaseFormat):
FORMAT = 'ldap' FORMAT = 'ldap'
EXECUTABLE = False
_initialized = False _initialized = False
@ -20,7 +22,8 @@ class LDAPFormat(BaseFormat):
def __init__(self, document_text: str, def __init__(self, document_text: str,
ignore_comments=False, ignore_comments=False,
join_before=False): join_before=False,
parameters=ParametersContainer()):
processing_methods = [self._parse_comment_line, processing_methods = [self._parse_comment_line,
self._parse_type_line, self._parse_type_line,
self._parse_access_line, self._parse_access_line,

@ -1,6 +1,7 @@
# vim: fileencoding=utf-8 # vim: fileencoding=utf-8
# #
from .base_format import BaseFormat from .base_format import BaseFormat
from ..template_engine import ParametersContainer
from collections import OrderedDict from collections import OrderedDict
from pyparsing import Word, Literal, printables, originalTextFor, ZeroOrMore,\ from pyparsing import Word, Literal, printables, originalTextFor, ZeroOrMore,\
OneOrMore, ParseException, restOfLine,\ OneOrMore, ParseException, restOfLine,\
@ -9,6 +10,7 @@ from pyparsing import Word, Literal, printables, originalTextFor, ZeroOrMore,\
class OpenRCFormat(BaseFormat): class OpenRCFormat(BaseFormat):
FORMAT = 'openrc' FORMAT = 'openrc'
EXECUTABLE = False
_initialized = False _initialized = False
@ -19,7 +21,8 @@ class OpenRCFormat(BaseFormat):
def __init__(self, document_text: str, def __init__(self, document_text: str,
ignore_comments=False, ignore_comments=False,
join_before=False): join_before=False,
parameters=ParametersContainer()):
processing_methods = [self._parse_comment_line, processing_methods = [self._parse_comment_line,
self._parse_parameter_line, self._parse_parameter_line,
self._parse_to_delete_line] self._parse_to_delete_line]

@ -1,6 +1,7 @@
# vim: fileencoding=utf-8 # vim: fileencoding=utf-8
# #
from .base_format import BaseFormat, FormatError from .base_format import BaseFormat, FormatError
from ..template_engine import ParametersContainer
from collections import OrderedDict from collections import OrderedDict
import re import re
try: try:
@ -11,18 +12,23 @@ except ImportError:
class PatchFormat(BaseFormat): class PatchFormat(BaseFormat):
FORMAT = 'patch' FORMAT = 'patch'
EXECUTABLE = False
FORMAT_PARAMETERS = {'multiline', 'dotall', 'comment'} FORMAT_PARAMETERS = {'multiline', 'dotall', 'comment'}
def __init__(self, document_text: str, multiline=False, dotall=False, def __init__(self, document_text: str,
comment_symbol='', join_before=False): ignore_comments=False,
join_before=False,
parameters=ParametersContainer()):
processing_methods = OrderedDict() processing_methods = OrderedDict()
super().__init__(processing_methods) super().__init__(processing_methods)
self._multiline_flag = multiline self.changed_files = dict()
self._dotall_flag = dotall
self._multiline_flag = parameters.multiline
self._dotall_flag = parameters.dotall
self._parsed_patch = None self._parsed_patch = None
self._document_to_patch = '' self._document_text = document_text
self._FLAG_VALUES = {'True': True, self._FLAG_VALUES = {'True': True,
'False': False, 'False': False,
'true': True, 'true': True,
@ -33,8 +39,6 @@ class PatchFormat(BaseFormat):
self._XML_ROOT_LINE = '<?xml version="1.0" encoding="utf-8"?>\ self._XML_ROOT_LINE = '<?xml version="1.0" encoding="utf-8"?>\
<patch>{0}</patch>' <patch>{0}</patch>'
self._parse_patch(document_text)
def _parse_patch(self, patch_text): def _parse_patch(self, patch_text):
'''Метод, составляющий из текста шаблона xml документ и разбирающий его '''Метод, составляющий из текста шаблона xml документ и разбирающий его
с помощью lxml.''' с помощью lxml.'''
@ -44,21 +48,34 @@ class PatchFormat(BaseFormat):
except Exception: except Exception:
raise FormatError('can not parse patch document') raise FormatError('can not parse patch document')
def execute_format(self, document_to_patch): def join_template(self, template):
tmp_multiline = template._multiline_flag
tmp_dotall = template._dotall_flag
template._multiline_flag = self._multiline_flag
template._dotall_flag = self._dotall_flag
self._document_text = template._join(self._document_text)
template._multiline_flag = tmp_multiline
template._dotall_flag = tmp_dotall
def _join(self, input_text):
'''Метод для запуска наложения патча.''' '''Метод для запуска наложения патча.'''
if not document_to_patch.strip() == '': self._parse_patch(self._document_text)
self._document_to_patch = document_to_patch
if self._parse_patch is None: if not input_text.strip() == '':
return False self._document_to_patch = input_text
else: else:
if not self._patch_document(document_to_patch): return input_text
raise FormatError('Error: Can not run patch.')
else: if not self._patch_document(input_text):
after_patch = self._document_to_patch raise FormatError('Error: Can not run patch.')
self._document_to_patch = '' else:
# Пока что возвращает результат наложения шаблона, это временно after_patch = self._document_to_patch
return after_patch self._document_to_patch = ''
return after_patch
def _patch_document(self, document_to_patch): def _patch_document(self, document_to_patch):
'''Метод, обходящий теги шаблона и использующий указанные в нем '''Метод, обходящий теги шаблона и использующий указанные в нем
@ -160,3 +177,7 @@ class PatchFormat(BaseFormat):
self._document_to_patch) self._document_to_patch)
continue continue
return True return True
@property
def document_text(self):
return self._document_text

@ -1,6 +1,7 @@
# vim: fileencoding=utf-8 # vim: fileencoding=utf-8
# #
from .base_format import BaseFormat from .base_format import BaseFormat
from ..template_engine import ParametersContainer
from collections import OrderedDict from collections import OrderedDict
from pyparsing import Word, Literal, alphanums, printables, originalTextFor,\ from pyparsing import Word, Literal, alphanums, printables, originalTextFor,\
ZeroOrMore, OneOrMore, ParseException,\ ZeroOrMore, OneOrMore, ParseException,\
@ -9,6 +10,7 @@ from pyparsing import Word, Literal, alphanums, printables, originalTextFor,\
class PostfixFormat(BaseFormat): class PostfixFormat(BaseFormat):
FORMAT = 'postfix' FORMAT = 'postfix'
EXECUTABLE = False
_initialized = False _initialized = False
@ -19,7 +21,8 @@ class PostfixFormat(BaseFormat):
def __init__(self, document_text: str, def __init__(self, document_text: str,
ignore_comments=False, ignore_comments=False,
join_before=False): join_before=False,
parameters=ParametersContainer()):
processing_methods = [self._parse_comment_line, processing_methods = [self._parse_comment_line,
self._parse_parameter_line, self._parse_parameter_line,
self._parse_to_delete_line] self._parse_to_delete_line]

@ -1,6 +1,7 @@
# vim: fileencoding=utf-8 # vim: fileencoding=utf-8
# #
from .base_format import BaseFormat from .base_format import BaseFormat
from ..template_engine import ParametersContainer
from collections import OrderedDict from collections import OrderedDict
from pyparsing import Word, Literal, alphanums, printables, originalTextFor,\ from pyparsing import Word, Literal, alphanums, printables, originalTextFor,\
ZeroOrMore, OneOrMore, ParseException, restOfLine,\ ZeroOrMore, OneOrMore, ParseException, restOfLine,\
@ -9,6 +10,7 @@ from pyparsing import Word, Literal, alphanums, printables, originalTextFor,\
class ProcmailFormat(BaseFormat): class ProcmailFormat(BaseFormat):
FORMAT = 'procmail' FORMAT = 'procmail'
EXECUTABLE = False
_initialized = False _initialized = False
@ -20,7 +22,7 @@ class ProcmailFormat(BaseFormat):
def __init__(self, document_text: str, def __init__(self, document_text: str,
ignore_comments=False, ignore_comments=False,
join_before=False, join_before=False,
comment_symbol=''): parameters=ParametersContainer()):
processing_methods = [self._parse_comment_line, processing_methods = [self._parse_comment_line,
self._parse_parameter_line, self._parse_parameter_line,
self._parse_to_delete_line] self._parse_to_delete_line]

@ -1,6 +1,7 @@
# vim: fileencoding=utf-8 # vim: fileencoding=utf-8
# #
from .base_format import BaseFormat, FormatError from .base_format import BaseFormat, FormatError
from ..template_engine import ParametersContainer
from jinja2 import Environment, PackageLoader from jinja2 import Environment, PackageLoader
from collections import OrderedDict from collections import OrderedDict
from pyparsing import originalTextFor, Literal, ZeroOrMore, Word, printables,\ from pyparsing import originalTextFor, Literal, ZeroOrMore, Word, printables,\
@ -16,6 +17,7 @@ class ProFTPDFormat(BaseFormat):
относятся. относятся.
''' '''
FORMAT = 'proftpd' FORMAT = 'proftpd'
EXECUTABLE = False
_initialized = False _initialized = False
@ -27,7 +29,7 @@ class ProFTPDFormat(BaseFormat):
def __init__(self, document_text: str, def __init__(self, document_text: str,
ignore_comments=False, ignore_comments=False,
join_before=False, join_before=False,
comment_symbol=''): parameters=ParametersContainer()):
processing_methods = [self._parse_comment_line, processing_methods = [self._parse_comment_line,
self._parse_section_start_line, self._parse_section_start_line,
self._parse_section_end_line, self._parse_section_end_line,

@ -1,6 +1,7 @@
# vim: fileencoding=utf-8 # vim: fileencoding=utf-8
# #
from .base_format import BaseFormat from .base_format import BaseFormat
from ..template_engine import ParametersContainer
from collections import OrderedDict from collections import OrderedDict
from pyparsing import originalTextFor, Literal, Word, printables, OneOrMore,\ from pyparsing import originalTextFor, Literal, Word, printables, OneOrMore,\
alphanums, ParseException, Optional, Group, restOfLine alphanums, ParseException, Optional, Group, restOfLine
@ -8,6 +9,8 @@ from pyparsing import originalTextFor, Literal, Word, printables, OneOrMore,\
class SambaFormat(BaseFormat): class SambaFormat(BaseFormat):
FORMAT = 'samba' FORMAT = 'samba'
EXECUTABLE = False
_initialized = False _initialized = False
def __new__(cls, *args, **kwargs): def __new__(cls, *args, **kwargs):
@ -17,7 +20,8 @@ class SambaFormat(BaseFormat):
def __init__(self, document_text: str, def __init__(self, document_text: str,
ignore_comments=False, ignore_comments=False,
join_before=False): join_before=False,
parameters=ParametersContainer()):
processing_methods = [self._parse_comment_line, processing_methods = [self._parse_comment_line,
self._parse_section_line, self._parse_section_line,
self._parse_parameter_line, self._parse_parameter_line,

@ -3,6 +3,7 @@
from pyparsing import originalTextFor, Literal, Word, printables, OneOrMore,\ from pyparsing import originalTextFor, Literal, Word, printables, OneOrMore,\
Optional Optional
from .base_format import BaseFormat from .base_format import BaseFormat
from ..template_engine import ParametersContainer
from collections import OrderedDict from collections import OrderedDict
try: try:
from lxml.etree import Element, SubElement, ElementTree, tostring from lxml.etree import Element, SubElement, ElementTree, tostring
@ -13,6 +14,7 @@ except ImportError:
class XMLGConfFormat(BaseFormat): class XMLGConfFormat(BaseFormat):
FORMAT = 'xml_gconf' FORMAT = 'xml_gconf'
EXECUTABLE = False
_initialized = False _initialized = False
@ -21,7 +23,10 @@ class XMLGConfFormat(BaseFormat):
cls._initialize_parser() cls._initialize_parser()
return super().__new__(cls) return super().__new__(cls)
def __init__(self, document_text: str, join_before=False): def __init__(self, document_text: str,
ignore_comments=False,
join_before=False,
parameters=ParametersContainer()):
processing_methods = OrderedDict({'gconf': self._gconf, processing_methods = OrderedDict({'gconf': self._gconf,
'entry': self._entry, 'entry': self._entry,
'dir': self._dir, 'dir': self._dir,

@ -1,6 +1,7 @@
# vim: fileencoding=utf-8 # vim: fileencoding=utf-8
# #
from .base_format import BaseFormat from .base_format import BaseFormat
from ..template_engine import ParametersContainer
from pyparsing import originalTextFor, Literal, Word, printables, OneOrMore,\ from pyparsing import originalTextFor, Literal, Word, printables, OneOrMore,\
Optional Optional
from collections import OrderedDict from collections import OrderedDict
@ -13,6 +14,7 @@ except ImportError:
class XMLXfceFormat(BaseFormat): class XMLXfceFormat(BaseFormat):
FORMAT = 'xml_xfce' FORMAT = 'xml_xfce'
EXECUTABLE = False
_initialized = False _initialized = False
@ -21,8 +23,10 @@ class XMLXfceFormat(BaseFormat):
cls._initialize_parser() cls._initialize_parser()
return super().__new__(cls) return super().__new__(cls)
def __init__(self, document_text: str, ignore_comments=False, def __init__(self, document_text: str,
join_before=False): ignore_comments=False,
join_before=False,
parameters=ParametersContainer()):
processing_methods = OrderedDict({'channel': self._channel, processing_methods = OrderedDict({'channel': self._channel,
'property': self._property, 'property': self._property,
'value': self._value, 'value': self._value,

@ -13,20 +13,22 @@ import glob
import shutil import shutil
import os import os
template_text = '''{% calculate append = 'join' -%} template_text = '''{% calculate append = 'before', source = '/etc/file' -%}
{% calculate package = 'test-category/test-package', format = 'samba' -%} {% calculate package = 'test-category/test-package', format = 'samba',
unbound -%}
[section one] [section one]
parameter_1 = {{ vars_1.value_1 }} parameter_1 = {{ vars_1.value_1 }}
!parameter_2 !parameter_2
''' '''
template_to_run = '''{% calculate run = "/usr/bin/python" -%} template_to_run = '''{% calculate run = "python" -%}
with open('etc/dir/file.conf', 'r') as input_file: with open('etc/dir/file.conf', 'r') as input_file:
print(input_file.read()) print(input_file.read())
''' '''
backup_template_text = '''{% calculate append = 'join', format = 'samba', backup_template_text = '''{% calculate append = 'join', format = 'samba',
package = 'test-category/test-package' -%} autoupdate, package = 'test-category/test-package' -%}
[section one] [section one]
parameter_1 = value parameter_1 = value
parameter_2 = value_2 parameter_2 = value_2
@ -236,6 +238,17 @@ class TemplateWrapper:
" 'mirror' parameter is set") " 'mirror' parameter is set")
self.target_type = None self.target_type = None
if self.format_class.EXECUTABLE:
# Если формат исполняемый, но проверяем, существует ли директория,
# из которой будет выполняться шаблон.
if not os.path.exists(self.target_path):
if self.template_type == DIR:
os.makedirs(self.target_path)
else:
self.target_path = os.path.dirname(self.target_path)
os.makedirs(self.target_path)
return
self.check_conflicts() self.check_conflicts()
self.check_package_collision() self.check_package_collision()
@ -608,6 +621,11 @@ class TemplateExecutor:
self.executor_output['target_path'] =\ self.executor_output['target_path'] =\
template_object.target_path template_object.target_path
if self.executor_output['stdout']:
print(self.executor_output['stdout'])
if self.executor_output['stderr']:
print(self.executor_output['stderr'])
return self.executor_output return self.executor_output
def save_changes(self): def save_changes(self):
@ -683,47 +701,56 @@ class TemplateExecutor:
input_text = input_file.read() input_text = input_file.read()
else: else:
input_text = '' input_text = ''
parsed_input = template_format(input_text, join_before=join_before)
parsed_template = template_format(template_object.template_text, parsed_template = template_format(template_object.template_text,
join_before=join_before) join_before=join_before)
parsed_input.join_template(parsed_template) if not template_object.format_class.EXECUTABLE:
parsed_input = template_format(input_text,
# Результат наложения шаблона. join_before=join_before)
output_text = parsed_input.document_text parsed_input.join_template(parsed_template)
# Удаляем форматный объект входного файла. # Результат наложения шаблона.
del(parsed_input) output_text = parsed_input.document_text
output_text_md5 = hashlib.md5(output_text.encode()).hexdigest() # Удаляем форматный объект входного файла.
del(parsed_input)
for save_path in output_paths: output_text_md5 = hashlib.md5(output_text.encode()).hexdigest()
with open(save_path, 'w') as output_file:
output_file.write(output_text) for save_path in output_paths:
with open(save_path, 'w') as output_file:
if template_object.parameters.chown: output_file.write(output_text)
self.chown_file(save_path,
template_object.parameters.chown, if template_object.parameters.chown:
check_existation=False) self.chown_file(save_path,
template_object.parameters.chown,
if template_object.parameters.chmod: check_existation=False)
self.chmod_file(save_path,
template_object.parameters.chmod, if template_object.parameters.chmod:
check_existation=False) self.chmod_file(save_path,
template_object.parameters.chmod,
# Убираем все ._cfg файлы. check_existation=False)
if template_object.cfg_list:
for cfg_file_path in template_object.cfg_list: # Убираем все ._cfg файлы.
self._remove_file(cfg_file_path) if template_object.cfg_list:
for cfg_file_path in template_object.cfg_list:
# Убираем целевой файл из CL. self._remove_file(cfg_file_path)
self.calculate_config_file.remove_file(template_object.target_path)
# Убираем целевой файл из CL.
# Обновляем CONTENTS. self.calculate_config_file.remove_file(
if template_object.protected: template_object.target_path)
if template_object.parameters.unbound:
template_object.remove_from_contents() # Обновляем CONTENTS.
else: if template_object.protected:
template_object.add_to_contents(file_md5=output_text_md5) if template_object.parameters.unbound:
template_object.remove_from_contents()
else:
template_object.add_to_contents(
file_md5=output_text_md5)
else:
parsed_template.execute_format(
input_text=input_text,
target_path=template_object.target_path)
# Удаляем форматный объект входного файла.
del(parsed_template)
else: else:
if template_object.target_type is not None and not replace: if template_object.target_type is not None and not replace:
with open(input_path, 'r') as input_file: with open(input_path, 'r') as input_file:
@ -767,10 +794,10 @@ class TemplateExecutor:
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): def _append_after_file(self, template_object: TemplateWrapper):
self._append_join_file(self, template_object, join_before=False) self._append_join_file(template_object, join_before=False)
def _append_before_file(self, template_object: TemplateWrapper): def _append_before_file(self, template_object: TemplateWrapper):
self._append_join_file(self, template_object, join_before=True) self._append_join_file(template_object, join_before=True)
def _append_skip_file(self, template_object: TemplateWrapper): def _append_skip_file(self, template_object: TemplateWrapper):
pass pass
@ -1000,13 +1027,11 @@ class TemplateExecutor:
if run_process.readable: if run_process.readable:
stdout = run_process.read() stdout = run_process.read()
if stdout: if stdout:
print("Run output:\n{}".format(stdout))
self.executor_output['stdout'] = stdout self.executor_output['stdout'] = stdout
if run_process.readable_errors: if run_process.readable_errors:
stderr = run_process.read_error() stderr = run_process.read_error()
if stderr: if stderr:
print("Run errors:\n{}".format(stderr))
self.executor_output['stderr'] = stderr self.executor_output['stderr'] = stderr
except FilesError as error: except FilesError as error:
@ -1117,7 +1142,7 @@ template_executor_obj.execute_template(target_path,
template_executor_obj.save_changes() template_executor_obj.save_changes()
input() input()
template_engine.process_template_from_string(backup_template_text, FILE) template_engine.process_template_from_string(template_to_run, FILE)
template_parameters = template_engine.parameters template_parameters = template_engine.parameters
template_text = template_engine.template_text template_text = template_engine.template_text
template_executor_obj = TemplateExecutor( template_executor_obj = TemplateExecutor(
@ -1131,7 +1156,7 @@ template_executor_obj.execute_template(target_path,
template_executor_obj.save_changes() template_executor_obj.save_changes()
input() input()
template_engine.process_template_from_string(template_to_run, FILE) template_engine.process_template_from_string(backup_template_text, FILE)
template_parameters = template_engine.parameters template_parameters = template_engine.parameters
template_text = template_engine.template_text template_text = template_engine.template_text
template_executor_obj = TemplateExecutor( template_executor_obj = TemplateExecutor(

@ -140,70 +140,6 @@ acl "dns_servers" {
bind_object = BINDFormat(document_text) bind_object = BINDFormat(document_text)
assert bind_object._document_dictionary == result assert bind_object._document_dictionary == result
def test_if_comment_parameter_is_set_for_template__format_object_will_parse_comments_with_comment_symbol_from_this_parameter(self):
document_text = '''
@ Comment 1
!pid-file "/run/named/named.pid";
/*
* A very big comment.
* Still here...
* The pure giant of the comment kind.
*/
-disable-empty-zone "10.in-addr.arpa";
@ Comment 2
@ Comment 3
acl "dns_servers" {
!127.0.0.1;
// Comment 4
10.0.1.3;
10.1.0.3;
};
-options {
!response-policy {
/*
* This comment is very important.
* And I have no idea, why this
* comment is so important.
*/
zone "rpz.zone";
};
!recursion yes;
}
'''
acl_section = OrderedDict({'#': ['@ Comment 2', '@ Comment 3'],
('!', '127.0.0.1'): [''],
('', '10.0.1.3'): ['// Comment 4', ''],
('', '10.1.0.3'): ['']})
response_section = OrderedDict({('', 'zone'):
['/*',
'* This comment is very important.',
'* And I have no idea, why this',
'* comment is so important.',
'*/',
'"rpz.zone"']})
options_section = OrderedDict({('!', 'response-policy'):
response_section,
('!', 'recursion'): ['yes']})
result = OrderedDict({('!', 'pid-file'):
['@ Comment 1',
'"/run/named/named.pid"'],
('-', 'disable-empty-zone'):
['/*',
'* A very big comment.',
'* Still here...',
'* The pure giant of the comment kind.',
'*/',
'"10.in-addr.arpa"'],
('', 'acl', '"dns_servers"'): acl_section,
('-', 'options'): options_section})
bind_object = BINDFormat(document_text, comment_symbol='@')
assert bind_object._document_dictionary == result
def test_if_parameters_and_blocks_in_input_document_has_some_comments__the_comments_will_be_collected_in_the_list_of_parameter_value_or_with_special_key_in_block_dictionary(self): def test_if_parameters_and_blocks_in_input_document_has_some_comments__the_comments_will_be_collected_in_the_list_of_parameter_value_or_with_special_key_in_block_dictionary(self):
document_text = ''' document_text = '''
// Comment 1 // Comment 1

@ -9,31 +9,34 @@ import os
class TestExecuteMethods: class TestExecuteMethods:
def test_if_diff_patch_used_for_patching_of_several_files__it_changes_patched_file_correctly(self): def test_if_diff_patch_used_for_patching_of_several_files__it_changes_patched_file_correctly(self):
test_result = True test_result = True
root_path = path.join(os.getcwd(), 'tests/templates/format/testfiles/') cwd_path = path.join(os.getcwd(), 'tests/templates/format/testfiles/')
with open(path.join(root_path, 'diff_1.patch')) as patch_file: with open(path.join(cwd_path, 'diff_1.patch')) as patch_file:
patch_text = patch_file.read() patch_text = patch_file.read()
diff_patch = DiffFormat(patch_text) diff_patch = DiffFormat(patch_text)
print('Path:', root_path) print('Path:', cwd_path)
output = diff_patch.execute_format(root_path=root_path) output = diff_patch.execute_format(target_path=cwd_path)
print('Output:') print('Output:')
print(output) print(output)
if output: if output:
print('Changed files:') print('Changed files:')
for changed_file in diff_patch._changed_files_list: for changed_file, change_type in\
print(changed_file, ':', sep='') diff_patch.changed_files.items():
with open(path.join(diff_patch._root_path, changed_file)) as patched_file: if changed_file.startswith(cwd_path):
changed_file = changed_file[len(cwd_path):]
# print(changed_file, ':', sep='')
with open(path.join(diff_patch._cwd_path, changed_file)) as patched_file:
patched_file_text = patched_file.read() patched_file_text = patched_file.read()
print(patched_file_text) # print(patched_file_text)
other_file_name = 'b' + changed_file[1:] other_file_name = 'b' + changed_file[1:]
with open(path.join(diff_patch._root_path, with open(path.join(diff_patch._cwd_path,
other_file_name)) as other_file: other_file_name)) as other_file:
other_file_text = other_file.read() other_file_text = other_file.read()
test_result = test_result and (other_file_text == patched_file_text) test_result = test_result and (other_file_text == patched_file_text)
return_patch_run = Process('patch', '-R', return_patch_run = Process('patch', '-R',
'-p{}'.format(diff_patch._last_level), '-p{}'.format(diff_patch._last_level),
cwd=root_path) cwd=cwd_path)
return_patch_run.write(patch_text) return_patch_run.write(patch_text)
output = return_patch_run.read() output = return_patch_run.read()
@ -47,7 +50,7 @@ class TestExecuteMethods:
def test_if_diff_patch_used_for_patching_of_directories__it_changes_files_in_directories_and_adds_ones(self): def test_if_diff_patch_used_for_patching_of_directories__it_changes_files_in_directories_and_adds_ones(self):
test_result = True test_result = True
root_path = path.join(os.getcwd(), cwd_path = path.join(os.getcwd(),
'tests/templates/format/testfiles/a1') 'tests/templates/format/testfiles/a1')
patch_path = path.join(os.getcwd(), patch_path = path.join(os.getcwd(),
'tests/templates/format/testfiles/diff_2.patch') 'tests/templates/format/testfiles/diff_2.patch')
@ -55,45 +58,43 @@ class TestExecuteMethods:
patch_text = patch_file.read() patch_text = patch_file.read()
diff_patch = DiffFormat(patch_text) diff_patch = DiffFormat(patch_text)
print('Path:', root_path) output = diff_patch.execute_format(target_path=cwd_path)
output = diff_patch.execute_format(root_path=root_path)
print('Output:')
print(output)
if output:
print('Changed files:')
for changed_file in diff_patch._changed_files_list:
print(changed_file, ':', sep='')
file_path = path.join(diff_patch._root_path, changed_file)
with open(file_path) as patched_file:
patched_file_text = patched_file.read()
print(patched_file_text)
other_file_path = os.path.join(path.dirname(root_path),
'b1', changed_file)
with open(other_file_path) as other_file:
other_file_text = other_file.read()
test_result = test_result and (other_file_text == patched_file_text)
if not test_result:
print('Differences:')
try:
diff_process = Process('diff', '-u',
file_path,
other_file_path)
diff_result = diff_process.read()
print(diff_result)
except Exception as error:
print('diff was not executed.')
print('Reason:', str(error))
reverse_patch_run = Process('patch', '-R', for changed_file, change_type in\
'-p{}'.format(diff_patch._last_level), diff_patch.changed_files.items():
cwd=root_path) if changed_file.startswith(cwd_path):
reverse_patch_run.write(patch_text) changed_file = changed_file[len(cwd_path) + 1:]
output = reverse_patch_run.read() print(changed_file, '', sep='')
file_path = path.join(diff_patch._cwd_path, changed_file)
with open(file_path) as patched_file:
patched_file_text = patched_file.read()
# print(patched_file_text)
other_file_path = os.path.join(path.dirname(cwd_path),
'b1', changed_file)
with open(other_file_path) as other_file:
other_file_text = other_file.read()
test_result = test_result and (other_file_text == patched_file_text)
if not test_result:
# print('Differences:')
try:
diff_process = Process('diff', '-u',
file_path,
other_file_path)
diff_result = diff_process.read()
# print(diff_result)
except Exception as error:
print('diff was not executed.')
print('Reason:', str(error))
if reverse_patch_run.success(): reverse_patch_run = Process('patch', '-R',
print('[*] Changes was returned...') '-p{}'.format(diff_patch._last_level),
else: cwd=cwd_path)
print('[!] Changes was not returned...') reverse_patch_run.write(patch_text)
output = reverse_patch_run.read()
if reverse_patch_run.success():
print('[*] Changes was returned...')
else: else:
test_result = False print('[!] Changes was not returned...')
assert test_result assert test_result
assert False

@ -1,6 +1,7 @@
import pytest import pytest
from collections import OrderedDict from collections import OrderedDict
from calculate.templates.format.patch_format import PatchFormat from calculate.templates.format.patch_format import PatchFormat
from calculate.templates.template_engine import ParametersContainer
@pytest.mark.patch @pytest.mark.patch
@ -28,10 +29,11 @@ Another line of endless sadness.
<text>ParameterName = NewValue</text> <text>ParameterName = NewValue</text>
''' '''
patch = PatchFormat(patch_text) patch_original = PatchFormat(input_text)
patch_result = patch.execute_format(input_text) patch_template = PatchFormat(patch_text)
patch_original.join_template(patch_template)
assert patch_result == output_text assert patch_original.document_text == output_text
def test_if_input_patch_document_contains_regular_expressions_with_global_regex_flags_and_flags_as_attributes__it_correctly_patches_input_document_using_regex_flags(self): def test_if_input_patch_document_contains_regular_expressions_with_global_regex_flags_and_flags_as_attributes__it_correctly_patches_input_document_using_regex_flags(self):
input_text = ''' input_text = '''
@ -65,16 +67,19 @@ Another line of endless sadness.
share modes = no share modes = no
''' '''
patch_text = ''' patch_text = r'''
<reg dotall="1" multiline="0">(\\[netlogon\\].*)writable\\s*=\\s*[a-zA-Z_][a-zA-Z_0-9]*</reg> <reg dotall="1" multiline="0">(\[netlogon\].*)writable\s*=\s*[a-zA-Z_][a-zA-Z_0-9]*</reg>
<text>\\1writable = yes</text> <text>\1writable = yes</text>
<reg multiline="false" dotall="True">(\\[homes\\].*)browseable\\s*=\\s*[a-zA-Z_][a-zA-Z_0-9]*</reg> <reg multiline="false" dotall="True">(\[homes\].*)browseable\s*=\s*[a-zA-Z_][a-zA-Z_0-9]*</reg>
<text>\\1browseable = who knows</text> <text>\1browseable = who knows</text>
<reg>(\\[netlogon\\].*)^\\s*guest ok\\s*=\\s*[a-zA-Z_][a-zA-Z_0-9]*\\n</reg> <reg>(\[netlogon\].*)^\s*guest ok\s*=\s*[a-zA-Z_][a-zA-Z_0-9]*\n</reg>
<text>\\1</text> <text>\1</text>
''' '''
patch = PatchFormat(patch_text, multiline=True, dotall=True) parameters = ParametersContainer({'multiline': True, 'dotall': True})
patch_result = patch.execute_format(input_text)
assert patch_result == output_text patch_original = PatchFormat(input_text, parameters=parameters)
patch_template = PatchFormat(patch_text, parameters=parameters)
patch_original.join_template(patch_template)
assert patch_original.document_text == output_text

@ -1,3 +1,3 @@
dir /etc dir /etc
dir /etc/dir dir /etc/dir
obj /etc/dir/file.conf 0b87fea7f5b65cac5012baa2bf647e72 1590678156 obj /etc/dir/file.conf 0b87fea7f5b65cac5012baa2bf647e72 1590764349

Loading…
Cancel
Save