From 1d2f3fad99265628be65d30d9d468c15e58732a0 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: Mon, 15 Jun 2020 18:05:14 +0300 Subject: [PATCH] All the methods for a working with directories in a filesystem is tested. --- .pytest_cache/v/cache/lastfailed | 255 +++++++++++- .pytest_cache/v/cache/nodeids | 17 + calculate/templates/template_processor.py | 60 ++- tests/templates/test_template_executor.py | 392 +++++++++++++++++- .../test_config_root_1/etc/dir/file.conf | 5 + .../testfiles/test_config_root_1/etc/file | 3 + .../etc/clear_dir_testfiles/dir_1/file_1 | 0 .../etc/clear_dir_testfiles/dir_1/file_2 | 0 .../etc/clear_dir_testfiles/dir_3/file | 0 .../etc/clear_dir_testfiles/file | 0 .../etc/config_testfiles/file.conf | 5 + .../etc/link_dir_testfiles/link_dir_2 | 1 + .../etc/remove_dir_testfiles/dir_1/dir_1 | 1 + .../etc/remove_dir_testfiles/dir_2/file_1 | 0 .../etc/remove_dir_testfiles/dir_2/file_2 | 0 .../etc/remove_dir_testfiles/file_0 | 0 .../etc/remove_dir_testfiles/link_dir_1 | 1 + .../test-category/test-package-1.0/CONTENTS | 11 +- 18 files changed, 694 insertions(+), 57 deletions(-) create mode 100644 tests/templates/testfiles/test_config_root_1/etc/dir/file.conf create mode 100644 tests/templates/testfiles/test_config_root_1/etc/file create mode 100644 tests/templates/testfiles/test_executor_root/etc/clear_dir_testfiles/dir_1/file_1 create mode 100644 tests/templates/testfiles/test_executor_root/etc/clear_dir_testfiles/dir_1/file_2 create mode 100644 tests/templates/testfiles/test_executor_root/etc/clear_dir_testfiles/dir_3/file create mode 100644 tests/templates/testfiles/test_executor_root/etc/clear_dir_testfiles/file create mode 100644 tests/templates/testfiles/test_executor_root/etc/config_testfiles/file.conf create mode 120000 tests/templates/testfiles/test_executor_root/etc/link_dir_testfiles/link_dir_2 create mode 120000 tests/templates/testfiles/test_executor_root/etc/remove_dir_testfiles/dir_1/dir_1 create mode 100644 tests/templates/testfiles/test_executor_root/etc/remove_dir_testfiles/dir_2/file_1 create mode 100644 tests/templates/testfiles/test_executor_root/etc/remove_dir_testfiles/dir_2/file_2 create mode 100644 tests/templates/testfiles/test_executor_root/etc/remove_dir_testfiles/file_0 create mode 120000 tests/templates/testfiles/test_executor_root/etc/remove_dir_testfiles/link_dir_1 diff --git a/.pytest_cache/v/cache/lastfailed b/.pytest_cache/v/cache/lastfailed index 059b3f4..1bf1884 100644 --- a/.pytest_cache/v/cache/lastfailed +++ b/.pytest_cache/v/cache/lastfailed @@ -1,10 +1,263 @@ { + "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_bla_bla": true, + "tests/templates/test_parameters_processor.py::TestTemplateParameters::test_if_TemplateParameters_object_is_initialized_accoding_to_dictionary_of_correct_template_parameters__the_TemplateParameters_object_contains_processed_parameters_as_its_attributes_including_default_values": true, "tests/templates/test_parameters_processor.py::TestTemplateParameters::test_if_TemplateParameters_object_is_initialized_using_": true, + "tests/templates/test_parameters_processor.py::TestTemplateParameters::test_if_TemplateParameters_object_is_initialized_using_dictionary_with_correct_chown_parameter_and_new_chroot_path__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_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_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": 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_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_executor.py::TestTemplateExecutor::test_if_the_link_directory_method_s_input_is_a_path_to_an_unexisting_source_directory_and_a_target_path__the_method_does_nothing": true, + "tests/templates/test_template_executor.py::TestTemplateExecutor::test_if_the_link_directory_method_s_input_is_a_path_to_an_unexisting_source_directory_and_a_target_path__the_method_raises_the_TemplateExecutorError_exception": true, + "tests/templates/test_template_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 b33f405..bd55167 100644 --- a/.pytest_cache/v/cache/nodeids +++ b/.pytest_cache/v/cache/nodeids @@ -62,6 +62,23 @@ "tests/templates/test_template_executor.py::TestTemplateExecutor::test_if_the_get_file_mode_method_is_called_with_a_path_to_a_file_that_does_not_exists__the_method_throws_TemplateExecutorError_exception", "tests/templates/test_template_executor.py::TestTemplateExecutor::test_if_the_create_directory_method_input_is_a_template_with_a_target_path_to_an_existing_directory_and_chown_and_chmod_parameters_is_not_set__the_method_does_nothing", "tests/templates/test_template_executor.py::TestTemplateExecutor::test_if_the_create_directory_method_input_is_a_template_with_a_target_path_to_an_existing_directory_and_chown_and_chmod_parameters_is_set__the_method_does_nothing", + "tests/templates/test_template_executor.py::TestTemplateExecutor::test_if_the_create_directory_method_input_is_a_template_with_a_target_path_to_an_unexisting_directory_from_an_existing_directory_and_chown_and_chmod_parameters_is_not_set__the_method_creates_one_new_directory_with_a_mode_and_an_owner_of_its_parent_directory", + "tests/templates/test_template_executor.py::TestTemplateExecutor::test_if_the_create_directory_method_input_is_a_template_with_a_target_path_to_an_unexisting_directory_from_an_existing_directory_and_chown_and_chmod_parameters_is_set__the_method_one_new_directory_with_a_mode_and_an_owner_from_the_parameters", + "tests/templates/test_template_executor.py::TestTemplateExecutor::test_if_the_create_directory_method_input_is_a_template_with_a_target_path_to_an_unexisting_directory_from_an_unexisting_directory_and_chown_and_chmod_parameters_is_not_set__the_method_creates_new_directory_and_all_its_parents_with_a_mode_and_an_owner_of_its_existing_parent", + "tests/templates/test_template_executor.py::TestTemplateExecutor::test_if_the_create_directory_method_s_input_is_a_template_with_a_target_path_to_an_unexisting_directory_from_an_unexisting_directory_and_chown_and_chmod_parameters_is_set__the_method_creates_new_directory_and_all_its_parents_with_a_mode_and_an_owner_from_the_parameters", + "tests/templates/test_template_executor.py::TestTemplateExecutor::test_if_the_link_directory_method_s_input_is_a_path_to_an_existing_source_directory_and_a_target_path__the_method_creates_a_link_to_a_source_file", + "tests/templates/test_template_executor.py::TestTemplateExecutor::test_if_the_link_directory_method_s_input_is_a_path_to_an_existing_source_directory_and_a_target_path_to_an_existing_link__the_method_raises_the_TemplateExecutorError_exception", + "tests/templates/test_template_executor.py::TestTemplateExecutor::test_if_the_remove_directory_method_s_input_is_a_path_to_an_existing_empty_directory__the_method_will_remove_the_directory", + "tests/templates/test_template_executor.py::TestTemplateExecutor::test_if_the_remove_directory_method_s_input_is_a_path_to_an_existing_directory_that_contains_a_some_files__the_method_will_remove_the_directory", + "tests/templates/test_template_executor.py::TestTemplateExecutor::test_if_the_remove_directory_method_s_input_is_a_path_to_an_existing_directory_that_contains_directories__the_method_will_remove_the_directory", + "tests/templates/test_template_executor.py::TestTemplateExecutor::test_if_the_remove_directory_method_s_input_is_a_path_to_an_existing_link_to_a_directory__the_method_will_remove_the_link_but_not_the_link_s_source_directory", + "tests/templates/test_template_executor.py::TestTemplateExecutor::test_if_the_remove_directory_method_s_input_is_a_path_to_an_unexisting_directory__the_method_throws_TemplateExecutorError_exception", + "tests/templates/test_template_executor.py::TestTemplateExecutor::test_if_the_remove_directory_method_s_input_is_a_path_to_a_file__the_method_throws_TemplateExecutorError_exception", + "tests/templates/test_template_executor.py::TestTemplateExecutor::test_if_the_clear_directory_method_s_input_is_a_path_to_an_existing_empty_directory__the_method_does_nothing", + "tests/templates/test_template_executor.py::TestTemplateExecutor::test_if_the_clear_directory_method_s_input_is_a_path_to_an_existing_directory_that_contains_some_files__the_method_clears_the_target_directory", + "tests/templates/test_template_executor.py::TestTemplateExecutor::test_if_the_clear_directory_method_s_input_is_a_path_to_an_existing_directory_that_contains_some_directories__the_method_clears_the_target_directory", + "tests/templates/test_template_executor.py::TestTemplateExecutor::test_if_the_clear_directory_method_s_input_is_a_path_to_an_existing_directory_that_contains_some_directories_and_files__the_method_clears_the_target_directory", + "tests/templates/test_template_executor.py::TestTemplateExecutor::test_if_the_clear_directory_method_s_input_is_a_path_to_an_unexisting_directory__the_method_raises_TemplateExecutorError_exception", "tests/templates/test_template_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/calculate/templates/template_processor.py b/calculate/templates/template_processor.py index 4b9d871..761bc2b 100644 --- a/calculate/templates/template_processor.py +++ b/calculate/templates/template_processor.py @@ -133,15 +133,12 @@ class TemplateWrapper: def __new__(cls, *args, **kwargs): if not cls._protected_is_set: - print('protected is not set') # Устанавливаем значения PROTECTED, если не заданы. if 'chroot_path' in kwargs: chroot_path = kwargs['chroot_path'] else: chroot_path = '/' cls._set_protected(chroot_path) - else: - print('protected is already set') return super().__new__(cls) def __init__(self, target_file_path, @@ -764,25 +761,21 @@ class TemplateExecutor: # Задаемся значениями chmod и chown в зависимости от наличия или # отсутствия файла, принадлежности его пакету и наличию значений # параметров по умолчанию. - try: - chmod = template_object.parameters.chmod - if not chmod: - if (template_object.target_type is not None and - not template_object.target_without_package): - chmod = self._get_file_mode(template_object.target_path) - else: - chmod = self.file_default_parameters.get('chmod', False) + chmod = template_object.parameters.chmod + if not chmod: + if (template_object.target_type is not None and + not template_object.target_without_package): + chmod = self._get_file_mode(template_object.target_path) + else: + chmod = self.file_default_parameters.get('chmod', False) - chown = template_object.parameters.chown - if not chown: - if (template_object.target_type is not None and - not template_object.target_without_package): - chown = self._get_file_owner(template_object.target_path) - else: - chown = self.file_default_parameters.get('chown', False) - except OSError: - raise TemplateExecutorError('No access to the directory: {}'. - format(template_object.target_path)) + chown = template_object.parameters.chown + if not chown: + if (template_object.target_type is not None and + not template_object.target_without_package): + chown = self._get_file_owner(template_object.target_path) + else: + chown = self.file_default_parameters.get('chown', False) if template_object.format_class.EXECUTABLE or\ template_object.md5_matching: @@ -1005,21 +998,13 @@ class TemplateExecutor: # получаем информацию о владельце и правах доступа ближайшей # существующей директории. - try: - chmod = template_parameters.chmod - if not chmod: - chmod = self._get_file_mode(directory_path) - else: - chmod = self.directory_default_parameters.get('chmod', False) + chmod = template_parameters.chmod + if not chmod: + chmod = self._get_file_mode(directory_path) - chown = template_parameters.chown - if not chown: - chown = self._get_file_owner(directory_path) - else: - chown = self.directory_default_parameters.get('chown', False) - except OSError: - raise TemplateExecutorError('No access to the directory: {}'. - format(directory_path)) + chown = template_parameters.chown + if not chown: + chown = self._get_file_owner(directory_path) directories_to_create.reverse() @@ -1047,9 +1032,12 @@ class TemplateExecutor: if os.path.isdir(target_path): try: if os.path.islink(target_path): + print('is link') os.unlink(target_path) else: + print('is not link') shutil.rmtree(target_path) + return except Exception as error: raise TemplateExecutorError( ("Failed to delete the directory: {0}," @@ -1091,7 +1079,7 @@ class TemplateExecutor: os.symlink(source, target_path, target_is_directory=True) except OSError: raise TemplateExecutorError("Failed to create symlink: {0} -> {1}". - format(target_path, self.source)) + format(target_path, source)) def _remove_file(self, target_path): '''Метод для удаления файлов.''' diff --git a/tests/templates/test_template_executor.py b/tests/templates/test_template_executor.py index 10270d1..7a7fcdb 100644 --- a/tests/templates/test_template_executor.py +++ b/tests/templates/test_template_executor.py @@ -3,6 +3,7 @@ import os import stat import grp import getpass +import shutil from calculate.templates.template_processor import TemplateExecutor, DIR,\ FILE, CalculateConfigFile,\ TemplateExecutorError,\ @@ -109,8 +110,14 @@ class TestTemplateExecutor: 'r').read().encode()).hexdigest() calculate_config_file.set_files_md5('/etc/file', md5_value_1) - md5_value_2 = hashlib.md5(open(join_paths(CHROOT_PATH, - '/etc/dir/file.conf'), + if os.path.exists(join_paths(CHROOT_PATH, + '/etc/config_testfiles/file.conf')): + print('File exists') + else: + print('File does not exist') + md5_value_2 = hashlib.md5(open(join_paths( + CHROOT_PATH, + '/etc/config_testfiles/file.conf'), 'r').read().encode()).hexdigest() assert not calculate_config_file.compare_md5('/etc/file', md5_value_2) @@ -134,12 +141,12 @@ class TestTemplateExecutor: cl_config_path=temporary_config_path, cl_chroot_path=temporary_chroot) - md5_value_1 = hashlib.md5(open(join_paths(CHROOT_PATH, + md5_value_1 = hashlib.md5(open(join_paths(temporary_chroot, '/etc/file'), 'r').read().encode()).hexdigest() calculate_config_file.set_files_md5('/etc/file', md5_value_1) - md5_value_2 = hashlib.md5(open(join_paths(CHROOT_PATH, + md5_value_2 = hashlib.md5(open(join_paths(temporary_chroot, '/etc/dir/file.conf'), 'r').read().encode()).hexdigest() calculate_config_file.set_files_md5('/etc/dir/file.conf', md5_value_2) @@ -442,7 +449,8 @@ class TestTemplateExecutor: # Тесты действий с директориями. def test_if_the_create_directory_method_input_is_a_template_with_a_target_path_to_an_existing_directory_and_chown_and_chmod_parameters_is_not_set__the_method_does_nothing(self): - target_directory = join_paths(CHROOT_PATH, '/etc/dir') + target_directory = join_paths(CHROOT_PATH, + '/etc/create_dir_testfiles/dir_0') parameters_object = ParametersContainer({'package': test_package_name, 'append': 'join'}) template_wrapper = TemplateWrapper( @@ -459,7 +467,8 @@ class TestTemplateExecutor: assert dir_mode == template_executor._get_file_mode(target_directory) def test_if_the_create_directory_method_input_is_a_template_with_a_target_path_to_an_existing_directory_and_chown_and_chmod_parameters_is_set__the_method_does_nothing(self): - target_directory = join_paths(CHROOT_PATH, '/etc/dir') + target_directory = join_paths(CHROOT_PATH, + '/etc/create_dir_testfiles/dir_0') chown_value = {'uid': os.getuid(), 'gid': os.getgid()} chmod_value = int(0o777) parameters_object = ParametersContainer({'package': test_package_name, @@ -484,10 +493,369 @@ class TestTemplateExecutor: template_executor._chmod_directory(target_directory, dir_mode) if os.getuid() == 0 and "SSH_CONNECTION" not in os.environ: - template_executor._chown_directory(join_paths( - CHROOT_PATH, - '/etc/chown_testfiles/file_0'), - dir_owner) + template_executor._chown_directory(target_directory, dir_owner) - def test_if_the_create_directory_method_input_is_a_template_with_a_target_path_to_an_unexisting_directory_and_chown_and_chmod_parameters_is_not_set__the_method_creates(self): - pass + def test_if_the_create_directory_method_input_is_a_template_with_a_target_path_to_an_unexisting_directory_from_an_existing_directory_and_chown_and_chmod_parameters_is_not_set__the_method_creates_one_new_directory_with_a_mode_and_an_owner_of_its_parent_directory(self): + target_directory = join_paths(CHROOT_PATH, + '/etc/create_dir_testfiles/dir_1/subdir') + parameters_object = ParametersContainer({'package': test_package_name, + 'append': 'join'}) + chown_value = {'uid': os.getuid(), 'gid': os.getgid()} + chmod_value = int(0o777) + + parent_owner = template_executor._get_file_owner(os.path.dirname( + target_directory)) + parent_mode = template_executor._get_file_mode(os.path.dirname( + target_directory)) + + template_executor._chown_directory(os.path.dirname(target_directory), + chown_value) + template_executor._chmod_directory(os.path.dirname(target_directory), + chmod_value) + + template_wrapper = TemplateWrapper( + target_directory, + parameters_object, DIR, + chroot_path=CHROOT_PATH, + config_archive_path=CONFIG_ARCHIVE_PATH) + template_executor._create_directory(template_wrapper) + + assert os.path.exists(target_directory) + assert template_executor._get_file_mode(target_directory) ==\ + chmod_value + assert template_executor._get_file_owner(target_directory) ==\ + chown_value + + os.rmdir(target_directory) + assert not os.path.exists(target_directory) + + template_executor._chown_file(os.path.dirname(target_directory), + parent_owner) + template_executor._chmod_file(os.path.dirname(target_directory), + parent_mode) + + def test_if_the_create_directory_method_input_is_a_template_with_a_target_path_to_an_unexisting_directory_from_an_existing_directory_and_chown_and_chmod_parameters_is_set__the_method_one_new_directory_with_a_mode_and_an_owner_from_the_parameters(self): + target_directory = join_paths(CHROOT_PATH, + '/etc/create_dir_testfiles/dir_1/subdir') + chown_value = {'uid': os.getuid(), 'gid': os.getgid()} + chmod_value = int(0o777) + parameters_object = ParametersContainer({'package': test_package_name, + 'append': 'join', + 'chown': chown_value, + 'chmod': chmod_value}) + template_wrapper = TemplateWrapper( + target_directory, + parameters_object, DIR, + chroot_path=CHROOT_PATH, + config_archive_path=CONFIG_ARCHIVE_PATH) + template_executor._create_directory(template_wrapper) + + assert os.path.exists(target_directory) + assert template_executor._get_file_mode(target_directory) ==\ + chmod_value + assert template_executor._get_file_owner(target_directory) ==\ + chown_value + + os.rmdir(target_directory) + assert not os.path.exists(target_directory) + + def test_if_the_create_directory_method_input_is_a_template_with_a_target_path_to_an_unexisting_directory_from_an_unexisting_directory_and_chown_and_chmod_parameters_is_not_set__the_method_creates_new_directory_and_all_its_parents_with_a_mode_and_an_owner_of_its_existing_parent(self): + target_directory = join_paths( + CHROOT_PATH, + '/etc/create_dir_testfiles/dir_2/subdir/subsubdir') + parent_directory = join_paths(CHROOT_PATH, + '/etc/create_dir_testfiles/dir_2') + parameters_object = ParametersContainer({'package': test_package_name, + 'append': 'join'}) + chown_value = {'uid': os.getuid(), 'gid': os.getgid()} + chmod_value = int(0o777) + + parent_owner = template_executor._get_file_owner(parent_directory) + parent_mode = template_executor._get_file_mode(parent_directory) + + template_executor._chown_directory(parent_directory, chown_value) + template_executor._chmod_directory(parent_directory, chmod_value) + + template_wrapper = TemplateWrapper( + target_directory, + parameters_object, DIR, + chroot_path=CHROOT_PATH, + config_archive_path=CONFIG_ARCHIVE_PATH) + template_executor._create_directory(template_wrapper) + + assert os.path.exists(target_directory) + assert template_executor._get_file_mode(target_directory) ==\ + chmod_value + assert template_executor._get_file_owner(target_directory) ==\ + chown_value + assert template_executor._get_file_mode( + os.path.dirname(target_directory)) == chmod_value + assert template_executor._get_file_owner( + os.path.dirname(target_directory)) == chown_value + + shutil.rmtree(os.path.dirname(target_directory)) + assert not os.path.exists(os.path.dirname(target_directory)) + + template_executor._chown_file(parent_directory, + parent_owner) + template_executor._chmod_file(parent_directory, + parent_mode) + + def test_if_the_create_directory_method_s_input_is_a_template_with_a_target_path_to_an_unexisting_directory_from_an_unexisting_directory_and_chown_and_chmod_parameters_is_set__the_method_creates_new_directory_and_all_its_parents_with_a_mode_and_an_owner_from_the_parameters(self): + target_directory = join_paths( + CHROOT_PATH, + '/etc/create_dir_testfiles/dir_2/subdir/subsubdir') + chown_value = {'uid': os.getuid(), 'gid': os.getgid()} + chmod_value = int(0o777) + + parameters_object = ParametersContainer({'package': test_package_name, + 'append': 'join', + 'chown': chown_value, + 'chmod': chmod_value}) + + template_wrapper = TemplateWrapper( + target_directory, + parameters_object, DIR, + chroot_path=CHROOT_PATH, + config_archive_path=CONFIG_ARCHIVE_PATH) + template_executor._create_directory(template_wrapper) + + assert os.path.exists(target_directory) + assert template_executor._get_file_mode(target_directory) ==\ + chmod_value + assert template_executor._get_file_owner(target_directory) ==\ + chown_value + assert template_executor._get_file_mode( + os.path.dirname(target_directory)) == chmod_value + assert template_executor._get_file_owner( + os.path.dirname(target_directory)) == chown_value + + shutil.rmtree(os.path.dirname(target_directory)) + assert not os.path.exists(os.path.dirname(target_directory)) + + def test_if_the_link_directory_method_s_input_is_a_path_to_an_existing_source_directory_and_a_target_path__the_method_creates_a_link_to_a_source_file(self): + target_path = join_paths(CHROOT_PATH, + '/etc/link_dir_testfiles/link_dir_0') + source_path = join_paths(CHROOT_PATH, '/etc/link_dir_testfiles/dir_0') + template_executor._link_directory(source_path, target_path) + + assert os.path.exists(target_path) + assert os.path.islink(target_path) + + os.unlink(target_path) + + assert not os.path.exists(target_path) + + def test_if_the_link_directory_method_s_input_is_a_path_to_an_existing_source_directory_and_a_target_path_to_an_existing_link__the_method_raises_the_TemplateExecutorError_exception(self): + target_path = join_paths(CHROOT_PATH, + '/etc/link_dir_testfiles/link_dir_2') + source_path = join_paths(CHROOT_PATH, '/etc/link_dir_testfiles/dir_2') + + with pytest.raises(TemplateExecutorError): + template_executor._link_directory(source_path, target_path) + + def test_if_the_remove_directory_method_s_input_is_a_path_to_an_existing_empty_directory__the_method_will_remove_the_directory(self): + target_path = join_paths(CHROOT_PATH, + '/etc/remove_dir_testfiles/dir_0') + parameters_object = ParametersContainer({'package': test_package_name, + 'append': 'join'}) + template_wrapper = TemplateWrapper( + target_path, + parameters_object, DIR, + chroot_path=CHROOT_PATH, + config_archive_path=CONFIG_ARCHIVE_PATH) + + template_executor._remove_directory(target_path) + assert not os.path.exists(target_path) + + template_executor._create_directory(template_wrapper) + assert os.path.exists(target_path) + + def test_if_the_remove_directory_method_s_input_is_a_path_to_an_existing_directory_that_contains_a_some_files__the_method_will_remove_the_directory(self): + target_path = join_paths(CHROOT_PATH, + '/etc/remove_dir_testfiles/dir_2') + parameters_object = ParametersContainer({'package': test_package_name, + 'append': 'join'}) + files_owner = template_executor._get_file_owner( + os.path.join(target_path, 'file_1')) + files_mode = template_executor._get_file_mode( + os.path.join(target_path, 'file_1')) + template_wrapper = TemplateWrapper( + target_path, + parameters_object, DIR, + chroot_path=CHROOT_PATH, + config_archive_path=CONFIG_ARCHIVE_PATH) + + template_executor._remove_directory(target_path) + assert not os.path.exists(target_path) + + template_executor._create_directory(template_wrapper) + assert os.path.exists(target_path) + + open(os.path.join(target_path, 'file_1'), 'w') + template_executor._chown_file(os.path.join(target_path, 'file_1'), + files_owner) + template_executor._chmod_file(os.path.join(target_path, 'file_1'), + files_mode) + + open(os.path.join(target_path, 'file_2'), 'w') + template_executor._chown_file(os.path.join(target_path, 'file_2'), + files_owner) + template_executor._chmod_file(os.path.join(target_path, 'file_2'), + files_mode) + + assert os.path.exists(os.path.join(target_path, 'file_1')) + assert os.path.exists(os.path.join(target_path, 'file_2')) + + def test_if_the_remove_directory_method_s_input_is_a_path_to_an_existing_directory_that_contains_directories__the_method_will_remove_the_directory(self): + target_path = join_paths(CHROOT_PATH, + '/etc/remove_dir_testfiles/dir_3') + parameters_object = ParametersContainer({'package': test_package_name, + 'append': 'join'}) + + template_executor._remove_directory(target_path) + assert not os.path.exists(target_path) + + template_wrapper = TemplateWrapper( + os.path.join(target_path, 'subdir_1'), + parameters_object, DIR, + chroot_path=CHROOT_PATH, + config_archive_path=CONFIG_ARCHIVE_PATH) + template_executor._create_directory(template_wrapper) + assert os.path.exists(os.path.join(target_path, 'subdir_1')) + + template_wrapper = TemplateWrapper( + os.path.join(target_path, 'subdir_2'), + parameters_object, DIR, + chroot_path=CHROOT_PATH, + config_archive_path=CONFIG_ARCHIVE_PATH) + template_executor._create_directory(template_wrapper) + assert os.path.exists(os.path.join(target_path, 'subdir_2')) + + def test_if_the_remove_directory_method_s_input_is_a_path_to_an_existing_link_to_a_directory__the_method_will_remove_the_link_but_not_the_link_s_source_directory(self): + target_path = join_paths(CHROOT_PATH, + '/etc/remove_dir_testfiles/link_dir_1') + source_path = join_paths(CHROOT_PATH, + '/etc/remove_dir_testfiles/dir_1') + + template_executor._remove_directory(target_path) + assert not os.path.exists(target_path) + assert os.path.exists(source_path) + + template_executor._link_directory(source_path, target_path) + assert os.path.exists(target_path) + + def test_if_the_remove_directory_method_s_input_is_a_path_to_an_unexisting_directory__the_method_throws_TemplateExecutorError_exception(self): + target_path = join_paths(CHROOT_PATH, + '/etc/remove_dir_testfiles/dir_4') + + with pytest.raises(TemplateExecutorError): + template_executor._remove_directory(target_path) + + def test_if_the_remove_directory_method_s_input_is_a_path_to_a_file__the_method_throws_TemplateExecutorError_exception(self): + target_path = join_paths(CHROOT_PATH, + '/etc/remove_dir_testfiles/file_0') + + with pytest.raises(TemplateExecutorError): + template_executor._remove_directory(target_path) + + def test_if_the_clear_directory_method_s_input_is_a_path_to_an_existing_empty_directory__the_method_does_nothing(self): + target_path = join_paths(CHROOT_PATH, + '/etc/clear_dir_testfiles/dir_0') + + template_executor._clear_directory(target_path) + + def test_if_the_clear_directory_method_s_input_is_a_path_to_an_existing_directory_that_contains_some_files__the_method_clears_the_target_directory(self): + target_path = join_paths(CHROOT_PATH, + '/etc/clear_dir_testfiles/dir_1') + + files_owner = template_executor._get_file_owner( + os.path.join(target_path, 'file_1')) + files_mode = template_executor._get_file_mode( + os.path.join(target_path, 'file_1')) + + template_executor._clear_directory(target_path) + assert not os.listdir(target_path) + + open(os.path.join(target_path, 'file_1'), 'w') + template_executor._chown_file(os.path.join(target_path, 'file_1'), + files_owner) + template_executor._chmod_file(os.path.join(target_path, 'file_1'), + files_mode) + + open(os.path.join(target_path, 'file_2'), 'w') + template_executor._chown_file(os.path.join(target_path, 'file_2'), + files_owner) + template_executor._chmod_file(os.path.join(target_path, 'file_2'), + files_mode) + + assert os.path.exists(os.path.join(target_path, 'file_1')) + assert os.path.exists(os.path.join(target_path, 'file_2')) + + def test_if_the_clear_directory_method_s_input_is_a_path_to_an_existing_directory_that_contains_some_directories__the_method_clears_the_target_directory(self): + target_path = join_paths(CHROOT_PATH, + '/etc/clear_dir_testfiles/dir_2') + parameters_object = ParametersContainer({'package': test_package_name, + 'append': 'join'}) + + template_executor._clear_directory(target_path) + assert not os.listdir(target_path) + + template_wrapper = TemplateWrapper( + os.path.join(target_path, 'subdir_1'), + parameters_object, DIR, + chroot_path=CHROOT_PATH, + config_archive_path=CONFIG_ARCHIVE_PATH) + template_executor._create_directory(template_wrapper) + assert os.path.exists(os.path.join(target_path, 'subdir_1')) + + template_wrapper = TemplateWrapper( + os.path.join(target_path, 'subdir_2'), + parameters_object, DIR, + chroot_path=CHROOT_PATH, + config_archive_path=CONFIG_ARCHIVE_PATH) + template_executor._create_directory(template_wrapper) + assert os.path.exists(os.path.join(target_path, 'subdir_2')) + + def test_if_the_clear_directory_method_s_input_is_a_path_to_an_existing_directory_that_contains_some_directories_and_files__the_method_clears_the_target_directory(self): + target_path = join_paths(CHROOT_PATH, + '/etc/clear_dir_testfiles/dir_3') + parameters_object = ParametersContainer({'package': test_package_name, + 'append': 'join'}) + + files_owner = template_executor._get_file_owner( + os.path.join(target_path, 'file')) + files_mode = template_executor._get_file_mode( + os.path.join(target_path, 'file')) + + template_executor._clear_directory(target_path) + assert not os.listdir(target_path) + + template_wrapper = TemplateWrapper( + os.path.join(target_path, 'subdir'), + parameters_object, DIR, + chroot_path=CHROOT_PATH, + config_archive_path=CONFIG_ARCHIVE_PATH) + template_executor._create_directory(template_wrapper) + assert os.path.exists(os.path.join(target_path, 'subdir')) + + open(os.path.join(target_path, 'file'), 'w') + template_executor._chown_file(os.path.join(target_path, 'file'), + files_owner) + template_executor._chmod_file(os.path.join(target_path, 'file'), + files_mode) + assert os.path.exists(os.path.join(target_path, 'file')) + + def test_if_the_clear_directory_method_s_input_is_a_path_to_an_unexisting_directory__the_method_raises_TemplateExecutorError_exception(self): + target_path = join_paths(CHROOT_PATH, + '/etc/clear_dir_testfiles/dir_4') + + with pytest.raises(TemplateExecutorError): + template_executor._clear_directory(target_path) + + def test_if_the_clear_directory_method_s_input_is_a_path_to_an_unexisting_directory__the_method_raises_TemplateExecutorError_exception(self): + target_path = join_paths(CHROOT_PATH, + '/etc/clear_dir_testfiles/dir_4') + + with pytest.raises(TemplateExecutorError): + template_executor._clear_directory(target_path) diff --git a/tests/templates/testfiles/test_config_root_1/etc/dir/file.conf b/tests/templates/testfiles/test_config_root_1/etc/dir/file.conf new file mode 100644 index 0000000..afd6900 --- /dev/null +++ b/tests/templates/testfiles/test_config_root_1/etc/dir/file.conf @@ -0,0 +1,5 @@ +[section one] + parameter_1 = value + parameter_2 = value_2 +[section two] + other_parameter = other_value diff --git a/tests/templates/testfiles/test_config_root_1/etc/file b/tests/templates/testfiles/test_config_root_1/etc/file new file mode 100644 index 0000000..a5af483 --- /dev/null +++ b/tests/templates/testfiles/test_config_root_1/etc/file @@ -0,0 +1,3 @@ +# Source file +[section_name] + rare_parameter = eternal_value diff --git a/tests/templates/testfiles/test_executor_root/etc/clear_dir_testfiles/dir_1/file_1 b/tests/templates/testfiles/test_executor_root/etc/clear_dir_testfiles/dir_1/file_1 new file mode 100644 index 0000000..e69de29 diff --git a/tests/templates/testfiles/test_executor_root/etc/clear_dir_testfiles/dir_1/file_2 b/tests/templates/testfiles/test_executor_root/etc/clear_dir_testfiles/dir_1/file_2 new file mode 100644 index 0000000..e69de29 diff --git a/tests/templates/testfiles/test_executor_root/etc/clear_dir_testfiles/dir_3/file b/tests/templates/testfiles/test_executor_root/etc/clear_dir_testfiles/dir_3/file new file mode 100644 index 0000000..e69de29 diff --git a/tests/templates/testfiles/test_executor_root/etc/clear_dir_testfiles/file b/tests/templates/testfiles/test_executor_root/etc/clear_dir_testfiles/file new file mode 100644 index 0000000..e69de29 diff --git a/tests/templates/testfiles/test_executor_root/etc/config_testfiles/file.conf b/tests/templates/testfiles/test_executor_root/etc/config_testfiles/file.conf new file mode 100644 index 0000000..afd6900 --- /dev/null +++ b/tests/templates/testfiles/test_executor_root/etc/config_testfiles/file.conf @@ -0,0 +1,5 @@ +[section one] + parameter_1 = value + parameter_2 = value_2 +[section two] + other_parameter = other_value diff --git a/tests/templates/testfiles/test_executor_root/etc/link_dir_testfiles/link_dir_2 b/tests/templates/testfiles/test_executor_root/etc/link_dir_testfiles/link_dir_2 new file mode 120000 index 0000000..138c00e --- /dev/null +++ b/tests/templates/testfiles/test_executor_root/etc/link_dir_testfiles/link_dir_2 @@ -0,0 +1 @@ +dir_0 \ No newline at end of file diff --git a/tests/templates/testfiles/test_executor_root/etc/remove_dir_testfiles/dir_1/dir_1 b/tests/templates/testfiles/test_executor_root/etc/remove_dir_testfiles/dir_1/dir_1 new file mode 120000 index 0000000..69d761d --- /dev/null +++ b/tests/templates/testfiles/test_executor_root/etc/remove_dir_testfiles/dir_1/dir_1 @@ -0,0 +1 @@ +dir_1 \ No newline at end of file diff --git a/tests/templates/testfiles/test_executor_root/etc/remove_dir_testfiles/dir_2/file_1 b/tests/templates/testfiles/test_executor_root/etc/remove_dir_testfiles/dir_2/file_1 new file mode 100644 index 0000000..e69de29 diff --git a/tests/templates/testfiles/test_executor_root/etc/remove_dir_testfiles/dir_2/file_2 b/tests/templates/testfiles/test_executor_root/etc/remove_dir_testfiles/dir_2/file_2 new file mode 100644 index 0000000..e69de29 diff --git a/tests/templates/testfiles/test_executor_root/etc/remove_dir_testfiles/file_0 b/tests/templates/testfiles/test_executor_root/etc/remove_dir_testfiles/file_0 new file mode 100644 index 0000000..e69de29 diff --git a/tests/templates/testfiles/test_executor_root/etc/remove_dir_testfiles/link_dir_1 b/tests/templates/testfiles/test_executor_root/etc/remove_dir_testfiles/link_dir_1 new file mode 120000 index 0000000..1d97890 --- /dev/null +++ b/tests/templates/testfiles/test_executor_root/etc/remove_dir_testfiles/link_dir_1 @@ -0,0 +1 @@ +/home/divanov/Home/development/calculate-lib/tests/templates/testfiles/test_executor_root/etc/remove_dir_testfiles/dir_1 \ No newline at end of file diff --git a/tests/templates/testfiles/test_executor_root/var/db/pkg/test-category/test-package-1.0/CONTENTS b/tests/templates/testfiles/test_executor_root/var/db/pkg/test-category/test-package-1.0/CONTENTS index aad0da2..d19fe46 100644 --- a/tests/templates/testfiles/test_executor_root/var/db/pkg/test-category/test-package-1.0/CONTENTS +++ b/tests/templates/testfiles/test_executor_root/var/db/pkg/test-category/test-package-1.0/CONTENTS @@ -1,11 +1,6 @@ dir /etc -dir /etc/dir +dir /etc/config_testfiles +dir /etc/config_testfiles/dir +obj /etc/config_testfiles/dir/file.conf 0b87fea7f5b65cac5012baa2bf647e72 1591196541 dir /etc/terminfo obj /etc/terminfo/info.json 7a374d90a202b969ee338ac4334fb14b 1591354184 -obj /etc/dir/deleted.json 11e3a79fe51cce828d973dba8702adaa 1591356795 -dir /etc/dir/subdir -obj /etc/dir/subdir/config.json 506649cf099878124deda2c2452c3693 1591605050 -obj /etc/dir/subdir/file 84bcceb2c8e6de79849ea5f3304f2411 1591343236 -obj /etc/dir/file.conf 0b87fea7f5b65cac5012baa2bf647e72 1591196541 -dir /etc/dir/dir_1 -obj /etc/dir/dir_1/config.json 506649cf099878124deda2c2452c3693 1591617024