From e9389bb79e49ed1c9ab48efb5aef8fea0ad6b3e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=98=D0=B2=D0=B0=D0=BD=D0=BE=D0=B2=20=D0=94=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D1=81?= Date: Tue, 9 Jun 2020 18:06:31 +0300 Subject: [PATCH] chown and chmod methods for files and directories are tested. --- .pytest_cache/v/cache/lastfailed | 254 +++++++++++++++++- .pytest_cache/v/cache/nodeids | 15 +- =5.0 | 11 + calculate/templates/template_processor.py | 75 +++--- calculate/utils/mount.py | 12 +- tests/templates/test_template_executor.py | 134 ++++++++- .../etc/chmod_testfiles/file_0 | 0 .../etc/chown_testfiles/file_0 | 0 .../etc/chown_testfiles/file_1 | 0 .../etc/chown_testfiles/file_2 | 0 10 files changed, 445 insertions(+), 56 deletions(-) create mode 100644 =5.0 create mode 100644 tests/templates/testfiles/test_executor_root/etc/chmod_testfiles/file_0 create mode 100644 tests/templates/testfiles/test_executor_root/etc/chown_testfiles/file_0 create mode 100644 tests/templates/testfiles/test_executor_root/etc/chown_testfiles/file_1 create mode 100755 tests/templates/testfiles/test_executor_root/etc/chown_testfiles/file_2 diff --git a/.pytest_cache/v/cache/lastfailed b/.pytest_cache/v/cache/lastfailed index 0a89f93..9c24247 100644 --- a/.pytest_cache/v/cache/lastfailed +++ b/.pytest_cache/v/cache/lastfailed @@ -1,7 +1,257 @@ { + "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_diff.py::TestExecuteMethods::test_if_diff_patch_used_for_patching_of_several_files__it_changes_patched_file_correctly": 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_regex.py::TestParsingMethods::test_if_input_patch_document_contains_only_regular_expressions_without_any_regex_flags__it_correctly_patches_input_document": true, + "tests/templates/format/test_regex.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": 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": true, "tests/templates/test_template_action.py::TestTemplateAction::test_create_directory": true, - "tests/templates/test_template_executor.py::TestTemplateAction::test_if_the_chown_directory_method_input_is_path_to_the_existing_directory_and_correct_chown_value__the_chown_directory_method_succesfully_changes_directory_chown": true, - "tests/templates/test_template_wrapper.py::TestTemplateWrapper::test_if_a_TemplateWrapper_object_successfully_initialized__the_object_can_be_used_for_an_adding_any_files_to_its_package_and_hash_will_be_calculated_automatically": true + "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/templates/test_template_executor.py::TestTemplateAction::test_if_chown_value_is_not_correct__a_TemplateExecutor_object_throws_TemplateExecutorError_exception": true, + "tests/templates/test_template_wrapper.py::TestTemplateWrapper::test_if_TemplateWrapper_object_contains_package_value__the_wrapper_can_use_Package_object_for_changing_CONTENTS_file_of_the_package": true, + "tests/templates/test_template_wrapper.py::TestTemplateWrapper::test_if_a_TemplateWrapper_object_successfully_initialized__the_object_can_be_used_for_a_removing_current_file_from_its_package": true, + "tests/templates/test_template_wrapper.py::TestTemplateWrapper::test_if_a_TemplateWrapper_object_successfully_initialized__the_object_can_be_used_for_an_adding_any_files_to_its_package_and_hash_will_be_calculated_automatically": true, + "tests/templates/test_template_wrapper.py::TestTemplateWrapper::test_if_a_TemplateWrapper_object_successfully_initialized__the_object_can_be_used_for_changing_CONTENTS_using_list_of_changed_files": true, + "tests/templates/test_template_wrapper.py::TestTemplateWrapper::test_if_a_TemplateWrapper_object_successfully_initialized_as_DIR__the_object_can_be_used_for_a_removing_current_directory_and_all_its_contents_from_its_package": true, + "tests/templates/test_template_wrapper.py::TestTemplateWrapper::test_if_a_TemplateWrapper_object_successfully_initialized_as_FILE__the_object_can_be_used_for_an_adding_the_current_file_to_its_package_and_hash_will_be_calculated_automatically": true, + "tests/templates/test_template_wrapper.py::TestTemplateWrapper::test_if_a_TemplateWrapper_object_successfully_initialized_as_FILE__the_object_can_be_used_for_an_adding_the_current_file_to_its_package_with_specified_hash": true, + "tests/templates/test_template_wrapper.py::TestTemplateWrapper::test_if_a_TemplateWrapper_object_successfully_initialized_with_DIR_type__the_object_can_be_used_for_a_removing_all_directory_files_from_its_package": true, + "tests/templates/test_template_wrapper.py::TestTemplateWrapper::test_if_a_TemplateWrapper_was_used_to_change_CONTENTS__it_should_be_saved_using_save_changes_method": true, + "tests/templates/test_template_wrapper.py::TestTemplateWrapper::test_if_a_target_file_directory_contains_no_cfg_files_but_it_is_necessary_to_create_one__the_first_cfg_file_should_be_named_cfg0001_file": true, + "tests/templates/test_template_wrapper.py::TestTemplateWrapper::test_if_a_target_file_directory_contains_some_cfg_files_but_some_of_them_are_missed__the_next_cfg_file_should_be_named_with_the_number_following_the_number_of_the_last_one": true, + "tests/templates/test_template_wrapper.py::TestTemplateWrapper::test_if_a_target_file_directory_contains_some_cfg_files_including_the_first_one__the_next_cfg_file_should_be_named_with_the_number_following_the_number_of_the_last_one": true, + "tests/templates/test_template_wrapper.py::TestTemplateWrapper::test_if_a_target_file_does_not_belong_to_any_package__the_TemplateWrapper_object_sets_the_md5_matching_flag_as_False": true, + "tests/templates/test_template_wrapper.py::TestTemplateWrapper::test_if_a_target_file_does_not_exist_and_CONTENTS_file_of_the_file_s_package_does_not_contain_this_file__the_TemplateWrapper_sets_the_md5_matching_flag_as_True": true, + "tests/templates/test_template_wrapper.py::TestTemplateWrapper::test_if_a_target_file_is_located_in_a_directory_from_the_protected_mask__the_TemplateWrapper_object_sets_the_protected_flag_as_False": true, + "tests/templates/test_template_wrapper.py::TestTemplateWrapper::test_if_a_target_file_is_located_in_a_directory_that_is_not_protected__the_TemplateWrapper_object_sets_the_protected_flag_as_False": true, + "tests/templates/test_template_wrapper.py::TestTemplateWrapper::test_if_a_target_file_is_located_in_a_protected_directory__the_TemplateWrapper_object_sets_the_protected_flag_as_True": true, + "tests/templates/test_template_wrapper.py::TestTemplateWrapper::test_if_a_target_file_is_not_protected__the_TemplateWrapper_sets_the_md5_matching_flag_as_True": true, + "tests/templates/test_template_wrapper.py::TestTemplateWrapper::test_if_a_target_file_s_hash_does_not_match_the_hash_from_the_package_s_CONTENTS_file__the_TemplateWrapper_object_sets_the_md5_matching_flag_as_False": true, + "tests/templates/test_template_wrapper.py::TestTemplateWrapper::test_if_a_target_file_s_hash_matches_the_hash_from_the_package_s_CONTENTS_file__the_TemplateWrapper_object_sets_the_md5_matching_flag_as_True": true, + "tests/templates/test_template_wrapper.py::TestTemplateWrapper::test_if_a_target_file_was_deleted_by_a_user__the_TemplateWrapper_object_sets_the_md5_matching_flag_as_False": true, + "tests/templates/test_template_wrapper.py::TestTemplateWrapper::test_if_a_target_path_is_DIR_and_a_template_is_executable__the_target_path_is_the_same_and_there_is_no_package_type_conflicts_and_other_checks": true, + "tests/templates/test_template_wrapper.py::TestTemplateWrapper::test_if_a_target_path_is_FILE_and_a_template_is_executable__the_target_path_is_replaced_with_the_path_to_the_cwd_directory_and_there_is_no_package_type_conflicts_and_other_checks": true, + "tests/templates/test_template_wrapper.py::TestTemplateWrapper::test_if_a_template_contains_the_autoupdate_parameter__the_TemplateWrapper_sets_the_md5_matching_flag_as_True": true, + "tests/templates/test_template_wrapper.py::TestTemplateWrapper::test_if_a_template_contains_the_autoupdate_parameter_and_a_target_file_does_not_belong_to_any_package__the_TemplateWrapper_sets_the_md5_matching_flag_as_True": true, + "tests/templates/test_template_wrapper.py::TestTemplateWrapper::test_if_a_template_contains_the_unbound_parameter__the_TemplateWrapper_sets_the_md5_matching_flag_as_True": true, + "tests/templates/test_template_wrapper.py::TestTemplateWrapper::test_if_a_template_is_executable_and_contains_package_parameter__the_template_updates_the_CONTENTS_file_for_package_from_parameter": true, + "tests/templates/test_template_wrapper.py::TestTemplateWrapper::test_if_after_removing_some_files_thought_TemplateWrapper_some_directories_become_empty__empty_directories_will_be_removed_saving_changes": true, + "tests/templates/test_template_wrapper.py::TestTemplateWrapper::test_if_after_the_target_file_check_md5_matching_flag_is_set_as_False_and_a_template_contains_source_parameter__the_output_path_is_the_cfg_file_path_and_the_input_path_is_the_calculate_archive_path": true, + "tests/templates/test_template_wrapper.py::TestTemplateWrapper::test_if_after_the_target_file_check_md5_matching_flag_is_set_as_False_and_a_template_does_not_contain_source_parameter__the_output_path_is_the_cfg_file_path_and_the_input_path_is_the_calculate_archive_path": true, + "tests/templates/test_template_wrapper.py::TestTemplateWrapper::test_if_after_the_target_file_check_md5_matching_flag_is_set_as_True_and_a_template_contains_source_parameter__the_output_and_the_input_paths_for_the_TemplateExecutor_is_the_same_and_it_is_target_path": true, + "tests/templates/test_template_wrapper.py::TestTemplateWrapper::test_if_after_the_target_file_check_md5_matching_flag_is_set_as_True_and_a_template_does_not_contain_source_parameter__the_output_and_the_input_paths_for_the_TemplateExecutor_is_the_same_and_it_is_target_path": true, + "tests/templates/test_template_wrapper.py::TestTemplateWrapper::test_if_exec_parameter_is_set_for_template__no_checks_are_carried_out_while_TemplateWrapper_object_initialization": true, + "tests/templates/test_template_wrapper.py::TestTemplateWrapper::test_if_get_archive_path_method_has_the_file_path_as_its_argument__it_returns_the_path_to_the_archive_version_of_the_input_file": true, + "tests/templates/test_template_wrapper.py::TestTemplateWrapper::test_if_mirror_parameter_is_set_and_file_from_the_source_parameter_does_not_exist__a_TemplateWrapper_object_sets_remove_original_flag_as_True": true, + "tests/templates/test_template_wrapper.py::TestTemplateWrapper::test_if_mirror_parameter_is_set_and_target_file_does_not_exist__a_TemplateWrapper_object_throws_TemplateExecutorError": true, + "tests/templates/test_template_wrapper.py::TestTemplateWrapper::test_if_run_parameter_is_set_for_template__no_checks_are_carried_out_while_TemplateWrapper_object_initialization": true, + "tests/templates/test_template_wrapper.py::TestTemplateWrapper::test_if_template_contains_append_parameters_but_does_not_have_package_parameter_and_target_file_does_not_belong_to_any_package__the_TemplateWrapper_throws_TemplateCollisionError_exception": true, + "tests/templates/test_template_wrapper.py::TestTemplateWrapper::test_if_template_contains_package_parameter_and_target_file_belongs_to_the_package_from_package_parameter__the_TemplateWrapper_uses_package_from_them": true, + "tests/templates/test_template_wrapper.py::TestTemplateWrapper::test_if_template_contains_package_parameter_and_target_file_does_not_belong_to_any_package__the_TemplateWrapper_uses_package_from_parameter_and_sets_target_without_package_flag": true, + "tests/templates/test_template_wrapper.py::TestTemplateWrapper::test_if_template_contains_package_parameter_but_target_file_belongs_to_the_other_package__the_TemplateWrapper_throws_TemplateCollisionError": true, + "tests/templates/test_template_wrapper.py::TestTemplateWrapper::test_if_template_does_not_have_package_parameter_but_target_file_belongs_to_the_package__the_TemplateWrapper_uses_package_from_parameter": true, + "tests/templates/test_template_wrapper.py::TestTemplateWrapper::test_if_template_type_is_DIR_and_target_file_is_DIR__the_TemplateWrapper_target_type_is_DIR": true, + "tests/templates/test_template_wrapper.py::TestTemplateWrapper::test_if_template_type_is_DIR_and_target_file_is_DIR_and_force_parameter_is_set__the_TemplateWrapper_target_type_is_DIR_and_target_path_is_the_same": true, + "tests/templates/test_template_wrapper.py::TestTemplateWrapper::test_if_template_type_is_DIR_and_target_file_is_FILE_and_force_parameter_is_set__the_TemplateWrapper_sets_remove_original_flag": true, + "tests/templates/test_template_wrapper.py::TestTemplateWrapper::test_if_template_type_is_DIR_and_target_file_is_a_link_to_a_DIR_and_force_parameter_is_not_set__the_TemplateWrapper_changes_its_target_path_to_the_link_source_file": true, + "tests/templates/test_template_wrapper.py::TestTemplateWrapper::test_if_template_type_is_DIR_and_target_file_is_a_link_to_a_file_and_force_parameter_is_not_set__the_TemplateWrapper_throws_TemplateTypeConflict_exception": true, + "tests/templates/test_template_wrapper.py::TestTemplateWrapper::test_if_template_type_is_DIR_and_target_file_is_the_link_to_a_DIR_and_force_parameter_is_set__the_TemplateWrapper_sets_remove_original_flag": true, + "tests/templates/test_template_wrapper.py::TestTemplateWrapper::test_if_template_type_is_DIR_and_target_file_is_the_link_to_a_FILE_and_force_parameter_is_set__the_TemplateWrapper_sets_remove_original_flag": true, + "tests/templates/test_template_wrapper.py::TestTemplateWrapper::test_if_template_type_is_DIR_but_target_file_is_FILE_and_force_parameter_is_not_set__the_TemplateWrapper_throws_TemplateTypeConflict_exception": true, + "tests/templates/test_template_wrapper.py::TestTemplateWrapper::test_if_template_type_is_DIR_with_the_append_link_parameter_and_target_file_is_DIR_and_force_parameter_is_not_set__the_TemplateWrapper_throws_TemplateTypeConflict_exception": true, + "tests/templates/test_template_wrapper.py::TestTemplateWrapper::test_if_template_type_is_DIR_with_the_append_link_parameter_and_target_file_is_DIR_and_force_parameter_is_set__the_TemplateWrapper_sets_remove_original_flag": true, + "tests/templates/test_template_wrapper.py::TestTemplateWrapper::test_if_template_type_is_DIR_with_the_append_link_parameter_and_target_file_is_FILE_and_force_parameter_is_not_set__the_TemplateWrapper_throws_TemplateTypeConflict_exception": true, + "tests/templates/test_template_wrapper.py::TestTemplateWrapper::test_if_template_type_is_DIR_with_the_append_link_parameter_and_target_file_is_FILE_and_force_parameter_is_set__the_TemplateWrapper_sets_remove_original_flag": true, + "tests/templates/test_template_wrapper.py::TestTemplateWrapper::test_if_template_type_is_DIR_with_the_append_link_parameter_and_target_file_is_the_link_to_a_DIR__the_TemplateWrapper_sets_remove_original_flag": true, + "tests/templates/test_template_wrapper.py::TestTemplateWrapper::test_if_template_type_is_DIR_with_the_append_link_parameter_and_target_file_is_the_link_to_a_FILE__the_TemplateWrapper_sets_remove_original_flag": true, + "tests/templates/test_template_wrapper.py::TestTemplateWrapper::test_if_template_type_is_FILE_and_target_file_does_not_exist__the_TemplateWrapper_target_type_is_None": true, + "tests/templates/test_template_wrapper.py::TestTemplateWrapper::test_if_template_type_is_FILE_and_target_file_is_FILE__the_TemplateWrapper_target_type_is_FILE": true, + "tests/templates/test_template_wrapper.py::TestTemplateWrapper::test_if_template_type_is_FILE_and_target_file_is_FILE_and_force_parameter_is_set__the_TemplateWrapper_target_type_is_FILE_and_target_path_is_same": true, + "tests/templates/test_template_wrapper.py::TestTemplateWrapper::test_if_template_type_is_FILE_but_target_file_is_DIR_and_force_parameter_is_not_set__the_TemplateWrapper_throws_TemplateTypeConflict_exception": true, + "tests/templates/test_template_wrapper.py::TestTemplateWrapper::test_if_template_type_is_FILE_but_target_file_is_DIR_and_force_parameter_is_set__the_TemplateWrapper_sets_remove_original_flag": true, + "tests/templates/test_template_wrapper.py::TestTemplateWrapper::test_if_template_type_is_FILE_but_target_file_is_a_link_and_force_parameter_is_not_set__the_TemplateWrapper_throws_TemplateTypeConflict_exception": true, + "tests/templates/test_template_wrapper.py::TestTemplateWrapper::test_if_template_type_is_FILE_but_target_file_is_a_link_to_a_DIR_and_force_parameter_is_set__the_TemplateWrapper_sets_remove_original_flag": true, + "tests/templates/test_template_wrapper.py::TestTemplateWrapper::test_if_template_type_is_FILE_but_target_file_is_a_link_to_a_FILE_and_force_parameter_is_set__the_TemplateWrapper_changes_its_target_path_to_the_link_source_file": true, + "tests/templates/test_template_wrapper.py::TestTemplateWrapper::test_if_template_type_is_FILE_with_the_append_link_parameter_and_target_file_is_DIR_and_force_parameter_is_not_set__the_TemplateWrapper_throws_TemplateTypeConflict_exception": true, + "tests/templates/test_template_wrapper.py::TestTemplateWrapper::test_if_template_type_is_FILE_with_the_append_link_parameter_and_target_file_is_DIR_and_force_parameter_is_set__the_TemplateWrapper_sets_remove_original_flag": true, + "tests/templates/test_template_wrapper.py::TestTemplateWrapper::test_if_template_type_is_FILE_with_the_append_link_parameter_and_target_file_is_FILE_and_force_parameter_is_not_set__the_TemplateWrapper_throws_TemplateTypeConflict_exception": true, + "tests/templates/test_template_wrapper.py::TestTemplateWrapper::test_if_template_type_is_FILE_with_the_append_link_parameter_and_target_file_is_FILE_and_force_parameter_is_set__the_TemplateWrapper_sets_remove_original_flag": true, + "tests/templates/test_template_wrapper.py::TestTemplateWrapper::test_if_template_type_is_FILE_with_the_append_link_parameter_and_target_file_is_the_link_to_a_DIR__the_TemplateWrapper_sets_remove_original_flag": true, + "tests/templates/test_template_wrapper.py::TestTemplateWrapper::test_if_template_type_is_FILE_with_the_append_link_parameter_and_target_file_is_the_link_to_a_FILE__the_TemplateWrapper_sets_remove_original_flag": true, + "tests/templates/test_template_wrapper.py::TestTemplateWrapper::test_if_the_TemplateWrapper_object_has_already_been_created__it_contains_the_correct_list_of_protected_and_unprotected_paths": 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 } \ No newline at end of file diff --git a/.pytest_cache/v/cache/nodeids b/.pytest_cache/v/cache/nodeids index 3a38adb..24b0a97 100644 --- a/.pytest_cache/v/cache/nodeids +++ b/.pytest_cache/v/cache/nodeids @@ -38,12 +38,17 @@ "tests/templates/test_template_executor.py::TestTemplateAction::test_if_a_CalculateConfigFile_object_is_used_for_comparing_a_hash_with_a_hash_of_a_file_that_is_not_in_the_config_file__the_compare_md5_method_returns_False", "tests/templates/test_template_executor.py::TestTemplateAction::test_if_a_CalculateConfigFile_object_was_used_to_make_changes_in_the_config_file__the_save_changes_method_will_save_the_changes", "tests/templates/test_template_executor.py::TestTemplateAction::test_if_a_TemplateExecutor_object_is_initialized__the_object_can_return_the_set_of_the_supported_values_of_the_append_parameter", - "tests/templates/test_template_executor.py::TestTemplateAction::test_if_the_chown_directory_method_input_is_path_to_the_existing_directory_and_correct_chown_value__the_chown_directory_method_succesfully_changes_directory_chown", - "tests/templates/test_template_executor.py::TestTemplateAction::test_chown_directory", - "tests/templates/test_template_executor.py::TestTemplateAction::test_chmod_directory", + "tests/templates/test_template_executor.py::TestTemplateAction::test_if_the_chown_directory_method_input_is_path_to_the_existing_directory_and_correct_chown_value__the_chown_directory_method_succesfully_changes_directory_owner", + "tests/templates/test_template_executor.py::TestTemplateAction::test_if_the_chown_directory_method_input_is_path_to_the_unexisting_directory_and_correct_chown_value__the_chown_directory_method_does_nothing", + "tests/templates/test_template_executor.py::TestTemplateAction::test_if_the_chown_directory_method_input_is_a_path_to_the_directory_with_a_fat_filesystem_and_a_correct_chown_value__TemplateExecutor_object_throws_exception", + "tests/templates/test_template_executor.py::TestTemplateAction::test_if_the_chown_file_method_input_is_a_path_to_an_existing_file_and_the_correct_chown_value__the_chown_file_method_succesfully_changes_file_owner", + "tests/templates/test_template_executor.py::TestTemplateAction::test_if_the_chown_file_method_input_is_path_to_the_unexisting_file_and_correct_chown_value__the_chown_directory_method_does_nothing", + "tests/templates/test_template_executor.py::TestTemplateAction::test_if_the_chown_file_method_input_is_a_path_to_the_file_from_the_fat_filesystem_and_a_correct_chown_value__TemplateExecutor_object_throws_exception", + "tests/templates/test_template_executor.py::TestTemplateAction::test_if_the_chmod_directory_method_input_is_path_to_the_existing_directory_and_correct_chmod_value__the_chmod_directory_method_succesfully_changes_directory_mode", + "tests/templates/test_template_executor.py::TestTemplateAction::test_if_the_chmod_directory_method_input_is_path_to_the_unexisting_directory_and_correct_chmod_value__the_chmod_directory_method_does_nothing", + "tests/templates/test_template_executor.py::TestTemplateAction::test_if_the_chmod_directory_method_input_is_a_path_to_the_directory_with_a_fat_filesystem_and_a_correct_chmod_value__TemplateExecutor_object_throws_exception", + "tests/templates/test_template_executor.py::TestTemplateAction::test_if_the_chmod_file_method_input_is_a_path_to_an_existing_file_and_the_correct_chmod_value__the_chmod_file_method_succesfully_changes_file_owner", "tests/templates/test_template_executor.py::TestTemplateAction::test_create_directory", - "tests/templates/test_template_executor.py::TestTemplateAction::test_link_directory", - "tests/templates/test_template_executor.py::TestTemplateAction::test_remove_directory", "tests/templates/test_template_wrapper.py::TestTemplateWrapper::test_if_the_TemplateWrapper_object_has_already_been_created__it_contains_the_correct_list_of_protected_and_unprotected_paths", "tests/templates/test_template_wrapper.py::TestTemplateWrapper::test_if_template_type_is_FILE_and_target_file_does_not_exist__the_TemplateWrapper_target_type_is_None", "tests/templates/test_template_wrapper.py::TestTemplateWrapper::test_if_template_type_is_DIR_and_target_file_is_DIR__the_TemplateWrapper_target_type_is_DIR", diff --git a/=5.0 b/=5.0 new file mode 100644 index 0000000..5102d30 --- /dev/null +++ b/=5.0 @@ -0,0 +1,11 @@ +Requirement already up-to-date: pytest in /root/.local/lib64/python3.6/site-packages (5.4.3) +Requirement already satisfied, skipping upgrade: importlib-metadata>=0.12; python_version < "3.8" in /root/.local/lib64/python3.6/site-packages (from pytest) (1.1.0) +Requirement already satisfied, skipping upgrade: attrs>=17.4.0 in /root/.local/lib64/python3.6/site-packages (from pytest) (19.3.0) +Requirement already satisfied, skipping upgrade: py>=1.5.0 in /root/.local/lib64/python3.6/site-packages (from pytest) (1.8.0) +Requirement already satisfied, skipping upgrade: packaging in /root/.local/lib64/python3.6/site-packages (from pytest) (19.2) +Requirement already satisfied, skipping upgrade: more-itertools>=4.0.0 in /root/.local/lib64/python3.6/site-packages (from pytest) (8.0.0) +Requirement already satisfied, skipping upgrade: pluggy<1.0,>=0.12 in /root/.local/lib64/python3.6/site-packages (from pytest) (0.13.1) +Requirement already satisfied, skipping upgrade: wcwidth in /root/.local/lib64/python3.6/site-packages (from pytest) (0.1.7) +Requirement already satisfied, skipping upgrade: zipp>=0.5 in /root/.local/lib64/python3.6/site-packages (from importlib-metadata>=0.12; python_version < "3.8"->pytest) (0.6.0) +Requirement already satisfied, skipping upgrade: six in /usr/lib64/python3.6/site-packages (from packaging->pytest) (1.12.0) +Requirement already satisfied, skipping upgrade: pyparsing>=2.0.2 in /root/.local/lib64/python3.6/site-packages (from packaging->pytest) (2.4.5) diff --git a/calculate/templates/template_processor.py b/calculate/templates/template_processor.py index d4d8f4d..1d82d58 100644 --- a/calculate/templates/template_processor.py +++ b/calculate/templates/template_processor.py @@ -14,6 +14,7 @@ from ..utils.mount import Mounts import hashlib import fnmatch import shutil +import errno import stat import glob import copy @@ -561,6 +562,9 @@ class TemplateExecutor: self.chroot_path = chroot_path + # Объект для проверки файловых систем. Пока не инициализируем. + self.mounts = None + # Директория для хранения полученных при обработке exec скриптов. self.execute_archive_path = execute_archive_path @@ -748,8 +752,8 @@ class TemplateExecutor: def _append_join_file(self, template_object: TemplateWrapper, join_before=False, replace=False): - '''Метод описывающий действия при append = "join", если шаблон -- - файл. Объединяет шаблон с целевым файлом.''' + '''Метод описывающий действия при append = "join", если шаблон -- файл. + Объединяет шаблон с целевым файлом.''' input_path = template_object.input_path output_path = template_object.output_path @@ -821,8 +825,7 @@ class TemplateExecutor: # Меняем права доступа и владельца всех сохраняемых файлов, # если это необходимо. if chown: - self._chown_file(save_path, chown, - check_existation=False) + self._chown_file(save_path, chown) if chmod: self._chmod_file(save_path, chmod, @@ -887,8 +890,7 @@ class TemplateExecutor: # Меняем права доступа и владельца ._cfg????_ файлов, если # это необходимо. if chown: - self._chown_file(output_path, chown, - check_existation=False) + self._chown_file(output_path, chown) if chmod: self._chmod_file(output_file, chmod, check_existation=False) @@ -943,8 +945,7 @@ class TemplateExecutor: # Меняем владельца и права доступа к очищенному файлу, если нужно. if template_object.chown: self._chown_file(template_object.target_path, - template_object.parameters.chown, - check_existation=False) + template_object.parameters.chown) if template_object.chmod: self._chmod_file(template_object.target_path, @@ -967,8 +968,7 @@ class TemplateExecutor: if template_object.parameters.chown: self._chown_file(template_object.parameters.source, - template_object.parameters.chown, - check_existation=False) + template_object.parameters.chown) template_object.add_to_contents() @@ -1193,13 +1193,13 @@ class TemplateExecutor: def _chown_directory(self, target_path, chown_value): """Метод для смены владельца директории.""" try: - os.chown(target_path, chown_value['uid'], chown_value['gid']) + if os.path.exists(target_path): + os.chown(target_path, chown_value['uid'], chown_value['gid']) except (OSError, Exception) as error: if not self._check_os_error(error, target_path): raise TemplateExecutorError( 'Can not chown file: {0} to {1}, reason: {2}'. format(target_path, self._translate_uid_gid( - target_path, chown_value['uid'], chown_value['gid']), str(error))) @@ -1207,35 +1207,37 @@ class TemplateExecutor: def _chmod_directory(self, target_path, chmod_value): '''Метод для смены прав доступа к директории.''' try: - os.chmod(target_path, chmod_value) + if os.path.exists(target_path): + print('directory exists') + print('chmod_value = {}'.format(oct(chmod_value))) + os.chmod(target_path, chmod_value) + else: + print('directory does not exist') except (OSError, Exception) as error: if not self._check_os_error(error, target_path): - self.output.set_error( + raise TemplateExecutorError( 'Can not chmod directory: {0}, reason: {1}'. format(target_path, str(error))) - def _chown_file(self, target_path, chown_value, check_existation=True): + def _chown_file(self, target_path, chown_value): '''Метод для смены владельца файла.''' try: - if check_existation and not os.path.exists(target_path): - open(target_path, 'w').close() - os.lchown(target_path, chown_value['uid'], chown_value['gid']) + if os.path.exists(target_path): + os.lchown(target_path, chown_value['uid'], chown_value['gid']) except (OSError, Exception) as error: if not self._check_os_error(error, target_path): raise TemplateExecutorError( 'Can not chown file: {0} to {1}, reason: {2}'. format(target_path, self._translate_uid_gid( - target_path, chown_value['uid'], chown_value['gid']), str(error))) - def _chmod_file(self, target_path, chmod_value, check_existation=True): + def _chmod_file(self, target_path, chmod_value): '''Метод для смены прав доступа к директории.''' try: - if check_existation and not os.path.exists(target_path): - open(target_path, 'w').close() - os.chmod(target_path, chmod_value) + if os.path.exists(target_path): + os.chmod(target_path, chmod_value) except (OSError, Exception) as error: if not self._check_os_error(error, target_path): raise TemplateExecutorError( @@ -1253,7 +1255,7 @@ class TemplateExecutor: file_stat = os.stat(file_path) return {'uid': file_stat.st_uid, 'gid': file_stat.st_gid} - def _translate_uid_gid(self, target_path, uid, gid): + def _translate_uid_gid(self, uid, gid): '''Метод для получения из uid и gid имен пользователя и группы при, необходимых для выдачи сообщения об ошибке при попытке chown.''' import pwd @@ -1280,11 +1282,11 @@ class TemplateExecutor: def _check_os_error(self, error, path_to_check): '''Метод для проверки причины, по которой не удалось изменить владельца или права доступа файла.''' - if hasattr(error, 'errno') and error.errno == os.errno.EPERM: - if self.is_vfat(path_to_check): + if hasattr(error, 'errno') and error.errno == errno.EPERM: + if self._is_vfat(path_to_check): return True - return hasattr(error, 'errno') and error.errno == os.errno.EACCES and\ + return hasattr(error, 'errno') and error.errno == errno.EACCES and\ 'var/calculate/remote' in path_to_check def _is_vfat(self, path_to_check): @@ -1295,11 +1297,10 @@ class TemplateExecutor: self.mounts = Mounts() # Проверяем файловую систему на пути. - return self.mounts.get_from_fstab(what=self.mounts.TYPE, - where=self.mounts.DIR, - is_in=path_to_check) in {'vfat', - 'ntfs-3g', - 'ntfs'} + fstab_info = self.mounts.get_from_fstab(what=self.mounts.TYPE, + where=self.mounts.DIR, + is_in=path_to_check)[0] + return fstab_info in {'vfat', 'ntfs-3g', 'ntfs'} class DirectoryTree: @@ -1400,11 +1401,11 @@ class DirectoryProcessor: # Инициализируем исполнительный модуль. self.template_executor = TemplateExecutor( - datavars_module=self.datavars_module, - chroot_path=self.cl_chroot_path, - cl_config_archive=self.cl_config_archive, - cl_config_path=self.cl_config_path, - exec_dir_path=self.cl_exec_dir_path + datavars_module=self.datavars_module, + chroot_path=self.cl_chroot_path, + cl_config_archive=self.cl_config_archive, + cl_config_path=self.cl_config_path, + execute_archive_path=self.cl_exec_dir_path ) # Инициализируем шаблонизатор. diff --git a/calculate/utils/mount.py b/calculate/utils/mount.py index 9a3d127..674c650 100644 --- a/calculate/utils/mount.py +++ b/calculate/utils/mount.py @@ -1,6 +1,6 @@ import os import re -from . import device +from calculate.utils.device import udev, get_uuid_dict from . import files import xattr import errno @@ -16,7 +16,7 @@ def is_mount(device_name): device_name = os.path.abspath(old_device_name) yield device_name if device_name.startswith('/dev'): - info = device.udev.get_device_info(name=device_name) + info = udev.get_device_info(name=device_name) if 'DM_VG_NAME' in info and 'DM_LV_NAME' in info: yield '/dev/mapper/{vg}-{lv}'.format(vg=info['DM_VG_NAME'], lv=info['DM_LV_NAME']) @@ -62,7 +62,6 @@ class MountHelper: NAME, DIR, TYPE, OPTS, FREQ, PASSNO = range(0, 6) def __init__(self, data_file=None, devices=()): - from device import get_uuid_dict if data_file: self.DATA_FILE = data_file self.cache = [] @@ -94,7 +93,7 @@ class MountHelper: if device_name.startswith('/'): device_name = os.path.realpath(device_name) - data[0] = device.udev.get_device_info(name=device_name).get( + data[0] = udev.get_device_info(name=device_name).get( 'DEVNAME', data[0]) data[1] = data[1] if data[2] != 'swap' else 'swap' self.rotated_cache = list(zip(*self.cache)) @@ -104,16 +103,21 @@ class MountHelper: if is_equal is not None: def filter_function(tab_line): return tab_line[where] == is_equal + elif is_in is not None: def filter_function(tab_line): return tab_line[where] in is_in + elif contains is not None: def filter_function(tab_line): return contains in tab_line[where] + else: def filter_function(tab_line): return tab_line[where] != is_not_equal + output = [] + for line in filter(filter_function, self.cache): output.append(line[what]) if all_entry: diff --git a/tests/templates/test_template_executor.py b/tests/templates/test_template_executor.py index 2b9f671..ade5503 100644 --- a/tests/templates/test_template_executor.py +++ b/tests/templates/test_template_executor.py @@ -1,5 +1,6 @@ import pytest import os +import stat from calculate.templates.template_processor import TemplateExecutor, DIR,\ FILE, CalculateConfigFile,\ TemplateExecutorError @@ -155,23 +156,140 @@ class TestTemplateAction: assert 'remove' in template_executor.available_appends # Тестируем методы для работы непосредственно с файловой системой. - def test_if_the_chown_directory_method_input_is_path_to_the_existing_directory_and_correct_chown_value__the_chown_directory_method_succesfully_changes_directory_chown(self): + # Тестируем методы для chown и chmod. + def test_if_the_chown_directory_method_input_is_path_to_the_existing_directory_and_correct_chown_value__the_chown_directory_method_succesfully_changes_directory_owner(self): + chown_value = {'uid': os.getuid(), 'gid': os.getgid()} template_executor._chown_directory(join_paths( + CHROOT_PATH, + '/etc/chown_testfiles/dir_0'), + chown_value) + assert os.stat(join_paths(CHROOT_PATH, + '/etc/chown_testfiles/dir_0')).\ + st_uid == chown_value['uid'] + assert os.stat(join_paths(CHROOT_PATH, + '/etc/chown_testfiles/dir_0')).\ + st_gid == chown_value['gid'] + + if os.getuid() == 0 and "SSH_connection" not in os.environ: + chown_value = {'uid': int(os.environ['SUDO_UID']), + 'gid': int(os.environ['SUDO_GID'])} + + template_executor._chown_directory(join_paths( CHROOT_PATH, '/etc/chown_testfiles/dir_0'), - {'uid': 0, 'gid': 0}) + chown_value) + assert os.stat(join_paths(CHROOT_PATH, + '/etc/chown_testfiles/dir_0')).\ + st_uid == chown_value['uid'] + assert os.stat(join_paths(CHROOT_PATH, + '/etc/chown_testfiles/dir_0')).\ + st_gid == chown_value['gid'] - def test_chown_directory(self): - pass + def test_if_the_chown_directory_method_input_is_path_to_the_unexisting_directory_and_correct_chown_value__the_chown_directory_method_does_nothing(self): + chown_value = {'uid': os.getuid(), 'gid': os.getgid()} + template_executor._chown_directory(join_paths( + CHROOT_PATH, + '/etc/chown_testfiles/file_2'), + chown_value) - def test_chmod_directory(self): + def test_if_the_chown_directory_method_input_is_a_path_to_the_directory_with_a_fat_filesystem_and_a_correct_chown_value__TemplateExecutor_object_throws_exception(self): + # Для тестирования нужно примонтировать файловую систему с fat32. pass - def test_create_directory(self): + def test_if_the_chown_file_method_input_is_a_path_to_an_existing_file_and_the_correct_chown_value__the_chown_file_method_succesfully_changes_file_owner(self): + chown_value = {'uid': os.getuid(), 'gid': os.getgid()} + template_executor._chown_file(join_paths( + CHROOT_PATH, + '/etc/chown_testfiles/file_0'), + chown_value) + assert os.stat(join_paths(CHROOT_PATH, + '/etc/chown_testfiles/file_0')).\ + st_uid == chown_value['uid'] + assert os.stat(join_paths(CHROOT_PATH, + '/etc/chown_testfiles/file_0')).\ + st_gid == chown_value['gid'] + + if os.getuid() == 0 and "SSH_connection" not in os.environ: + chown_value = {'uid': int(os.environ['SUDO_UID']), + 'gid': int(os.environ['SUDO_GID'])} + + template_executor._chown_file(join_paths( + CHROOT_PATH, + '/etc/chown_testfiles/file_0'), + chown_value) + assert os.stat(join_paths(CHROOT_PATH, + '/etc/chown_testfiles/file_0')).\ + st_uid == chown_value['uid'] + assert os.stat(join_paths(CHROOT_PATH, + '/etc/chown_testfiles/file_0')).\ + st_gid == chown_value['gid'] + + def test_if_the_chown_file_method_input_is_path_to_the_unexisting_file_and_correct_chown_value__the_chown_directory_method_does_nothing(self): + chown_value = {'uid': os.getuid(), 'gid': os.getgid()} + template_executor._chown_file(join_paths( + CHROOT_PATH, + '/etc/chown_testfiles/file_2'), + chown_value) + + def test_if_the_chown_file_method_input_is_a_path_to_the_file_from_the_fat_filesystem_and_a_correct_chown_value__TemplateExecutor_object_throws_exception(self): + # Для тестирования нужно примонтировать файловую систему с fat32. pass - def test_link_directory(self): + def test_if_the_chmod_directory_method_input_is_path_to_the_existing_directory_and_correct_chmod_value__the_chmod_directory_method_succesfully_changes_directory_mode(self): + chmod_value = int(0o777) + template_executor._chmod_directory(join_paths( + CHROOT_PATH, + '/etc/chmod_testfiles/dir_0'), + chmod_value) + result = stat.S_IMODE(os.stat(join_paths( + CHROOT_PATH, + '/etc/chmod_testfiles/dir_0')).st_mode) + + assert result == chmod_value + + chmod_value = int(0o755) + template_executor._chmod_directory(join_paths( + CHROOT_PATH, + '/etc/chmod_testfiles/dir_0'), + chmod_value) + result = stat.S_IMODE(os.stat(join_paths( + CHROOT_PATH, + '/etc/chmod_testfiles/dir_0')).st_mode) + + assert result == chmod_value + + def test_if_the_chmod_directory_method_input_is_path_to_the_unexisting_directory_and_correct_chmod_value__the_chmod_directory_method_does_nothing(self): + chmod_value = int(0o777) + template_executor._chmod_directory(join_paths( + CHROOT_PATH, + '/etc/chown_testfiles/file_2'), + chmod_value) + + def test_if_the_chmod_directory_method_input_is_a_path_to_the_directory_with_a_fat_filesystem_and_a_correct_chmod_value__TemplateExecutor_object_throws_exception(self): + # Для тестирования нужно примонтировать файловую систему с fat32. pass - def test_remove_directory(self): + def test_if_the_chmod_file_method_input_is_a_path_to_an_existing_file_and_the_correct_chmod_value__the_chmod_file_method_succesfully_changes_file_owner(self): + chmod_value = int(0o777) + template_executor._chmod_file(join_paths(CHROOT_PATH, + '/etc/chmod_testfiles/dir_0'), + chmod_value) + result = stat.S_IMODE(os.stat(join_paths( + CHROOT_PATH, + '/etc/chmod_testfiles/dir_0')).st_mode) + + assert result == chmod_value + + chmod_value = int(0o755) + template_executor._chmod_file(join_paths(CHROOT_PATH, + '/etc/chmod_testfiles/dir_0'), + chmod_value) + result = stat.S_IMODE(os.stat(join_paths( + CHROOT_PATH, + '/etc/chmod_testfiles/dir_0')).st_mode) + + assert result == chmod_value + + # Тесты действий с директориями. + def test_create_directory(self): pass diff --git a/tests/templates/testfiles/test_executor_root/etc/chmod_testfiles/file_0 b/tests/templates/testfiles/test_executor_root/etc/chmod_testfiles/file_0 new file mode 100644 index 0000000..e69de29 diff --git a/tests/templates/testfiles/test_executor_root/etc/chown_testfiles/file_0 b/tests/templates/testfiles/test_executor_root/etc/chown_testfiles/file_0 new file mode 100644 index 0000000..e69de29 diff --git a/tests/templates/testfiles/test_executor_root/etc/chown_testfiles/file_1 b/tests/templates/testfiles/test_executor_root/etc/chown_testfiles/file_1 new file mode 100644 index 0000000..e69de29 diff --git a/tests/templates/testfiles/test_executor_root/etc/chown_testfiles/file_2 b/tests/templates/testfiles/test_executor_root/etc/chown_testfiles/file_2 new file mode 100755 index 0000000..e69de29