@ -2,7 +2,8 @@ import pytest
import shutil
import hashlib
import os
from calculate . templates . template_processor import DirectoryProcessor
from calculate . templates . template_processor import DirectoryProcessor , \
TemplateWrapper
from calculate . utils . package import PackageAtomName , Version , Package
from calculate . utils . files import join_paths
from calculate . utils . io_module import IOModule
@ -35,7 +36,6 @@ new_package_name = PackageAtomName(
' var/db/pkg/test-category/new-package-0.1.1 ' ) ,
' version ' : Version ( ' 1.0 ' ) } )
# Вместо модуля переменных.
group = Variables ( { ' bool ' : True ,
' list ' : [ 1 , 2 , 3 ] } )
@ -91,6 +91,8 @@ def show_tree(dir_path, indent=0):
@pytest.mark.directory_processor
class TestDirectoryProcessor :
def test_create_testfiles ( self ) :
TemplateWrapper . _protected_is_set = False
shutil . copytree ( os . path . join ( CHROOT_PATH , ' etc.backup ' ) ,
os . path . join ( CHROOT_PATH , ' etc ' ) ,
symlinks = True )
@ -105,7 +107,7 @@ class TestDirectoryProcessor:
datavars_module = datavars )
directory_processor . process_template_directories ( )
def if_templates_consist_only_one_directory_with_a_calculate_directory_file_and_a_single_template_file__the_directory_processor_creates_new_file_and_adds_one_in_the_CONTENTS_file( self ) :
def test_ if_templates_consist_only_one_directory_with_a_calculate_directory_file_and_a_single_template_file__the_directory_processor_creates_new_file_and_adds_one_in_the_CONTENTS_file( self ) :
datavars . main [ ' cl_template_path ' ] = os . path . join ( CHROOT_PATH ,
' templates_1 ' )
directory_processor = DirectoryProcessor ( ' install ' ,
@ -123,7 +125,7 @@ class TestDirectoryProcessor:
output_file_text = output_file . read ( )
assert output_file_text == output_text
def if_templates_consist_only_one_directory_with_a_calculate_directory_file_and_a_single_other_directory_with_same_a_file__the_directory_processor_creates_new_directory( self ) :
def test_ if_templates_consist_only_one_directory_with_a_calculate_directory_file_and_a_single_other_directory_with_same_a_file__the_directory_processor_creates_new_directory( self ) :
datavars . main [ ' cl_template_path ' ] = os . path . join ( CHROOT_PATH ,
' templates_2 ' )
directory_processor = DirectoryProcessor ( ' install ' ,
@ -132,7 +134,7 @@ class TestDirectoryProcessor:
assert os . path . exists ( join_paths ( CHROOT_PATH , ' /etc/dir_1 ' ) )
def if_templates_consist_only_one_directory_with_a_calculate_directory_file_and_a_single_other_directory_without_calculate_directory_file__the_directory_processor_creates_new_directory( self ) :
def test_ if_templates_consist_only_one_directory_with_a_calculate_directory_file_and_a_single_other_directory_without_calculate_directory_file__the_directory_processor_creates_new_directory( self ) :
datavars . main [ ' cl_template_path ' ] = os . path . join ( CHROOT_PATH ,
' templates_4 ' )
directory_processor = DirectoryProcessor ( ' install ' ,
@ -141,7 +143,7 @@ class TestDirectoryProcessor:
assert os . path . exists ( join_paths ( CHROOT_PATH , ' /etc/dir_3 ' ) )
def if_templates_consist_only_one_directory_with_a_calculate_directory_file_with_a_single_directory_with_a_single_template_file__the_directory_processor_creates_new_directory_and_file_and_adds_one_in_the_CONTENTS_file( self ) :
def test_ if_templates_consist_only_one_directory_with_a_calculate_directory_file_with_a_single_directory_with_a_single_template_file__the_directory_processor_creates_new_directory_and_file_and_adds_one_in_the_CONTENTS_file( self ) :
datavars . main [ ' cl_template_path ' ] = os . path . join ( CHROOT_PATH ,
' templates_3 ' )
directory_processor = DirectoryProcessor ( ' install ' ,
@ -162,7 +164,7 @@ class TestDirectoryProcessor:
output_file_text = output_file . read ( )
assert output_file_text == output_text
def if_templates_consist_only_one_directory_with_a_calculate_directory_file_and_with_two_directories_with_a_template_files__the_directory_processor_creates_all_new_directories_and_files_and_adds_them_in_the_CONTENTS_file( self ) :
def test_ if_templates_consist_only_one_directory_with_a_calculate_directory_file_and_with_two_directories_with_a_template_files__the_directory_processor_creates_all_new_directories_and_files_and_adds_them_in_the_CONTENTS_file( self ) :
datavars . main [ ' cl_template_path ' ] = os . path . join ( CHROOT_PATH ,
' templates_5 ' )
directory_processor = DirectoryProcessor ( ' install ' ,
@ -197,7 +199,7 @@ class TestDirectoryProcessor:
output_file_text = output_file . read ( )
assert output_file_text == output_text
def if_templates_consist_only_one_directory_with_a_calculate_directory_file_and_a_single_template_file_and_there_is_a_file_without_user_changes_on_its_target_path__the_directory_processor_joins_a_template_file_with_a_target_file_and_updates_the_CONTENTS_file( self ) :
def test_ if_templates_consist_only_one_directory_with_a_calculate_directory_file_and_a_single_template_file_and_there_is_a_file_without_user_changes_on_its_target_path__the_directory_processor_joins_a_template_file_with_a_target_file_and_updates_the_CONTENTS_file( self ) :
datavars . main [ ' cl_template_path ' ] = os . path . join ( CHROOT_PATH ,
' templates_6 ' )
directory_processor = DirectoryProcessor ( ' install ' ,
@ -218,7 +220,7 @@ class TestDirectoryProcessor:
output_file_text = output_file . read ( )
assert output_file_text == output_text
def if_templates_consist_only_one_directory_with_a_calculate_directory_file_with_a_single_directory_with_a_single_template_file_and_there_is_a_file_without_user_changes_on_its_target_path__the_directory_processor_joins_a_template_file_with_a_target_file_and_updates_the_CONTENTS_file( self ) :
def test_ if_templates_consist_only_one_directory_with_a_calculate_directory_file_with_a_single_directory_with_a_single_template_file_and_there_is_a_file_without_user_changes_on_its_target_path__the_directory_processor_joins_a_template_file_with_a_target_file_and_updates_the_CONTENTS_file( self ) :
datavars . main [ ' cl_template_path ' ] = os . path . join ( CHROOT_PATH ,
' templates_7 ' )
directory_processor = DirectoryProcessor ( ' install ' ,
@ -242,7 +244,7 @@ class TestDirectoryProcessor:
hashlib . md5 (
output_text . encode ( ) ) . hexdigest ( ) )
def if_templates_consist_only_one_directory_with_a_calculate_directory_file_and_a_single_template_file_and_there_is_a_file_with_user_changes_on_its_target_path__the_directory_processor_joins_a_template_file_with_a_target_file_and_updates_the_CONTENTS_file( self ) :
def test_ if_templates_consist_only_one_directory_with_a_calculate_directory_file_and_a_single_template_file_and_there_is_a_file_with_user_changes_on_its_target_path__the_directory_processor_joins_a_template_file_with_a_target_file_and_updates_the_CONTENTS_file( self ) :
datavars . main [ ' cl_template_path ' ] = os . path . join ( CHROOT_PATH ,
' templates_8 ' )
directory_processor = DirectoryProcessor ( ' install ' ,
@ -266,7 +268,7 @@ class TestDirectoryProcessor:
hashlib . md5 (
output_text . encode ( ) ) . hexdigest ( ) )
def if_templates_consist_only_one_directory_with_a_calculate_directory_file_one_template_directory_and_a_single_template_file_with_a_target_path_to_a_file_removed_by_user_in_the_last_one__the_directory_processor_creates_a_new_empty_cfg_file__joins_template_with_it_and_updates_the_CONTENTS_file( self ) :
def test_ if_templates_consist_only_one_directory_with_a_calculate_directory_file_one_template_directory_and_a_single_template_file_with_a_target_path_to_a_file_removed_by_user_in_the_last_one__the_directory_processor_creates_a_new_empty_cfg_file__joins_template_with_it_and_updates_the_CONTENTS_file( self ) :
datavars . main [ ' cl_template_path ' ] = os . path . join ( CHROOT_PATH ,
' templates_9 ' )
directory_processor = DirectoryProcessor ( ' install ' ,
@ -290,7 +292,7 @@ class TestDirectoryProcessor:
hashlib . md5 (
output_text . encode ( ) ) . hexdigest ( ) )
def if_templates_are_hierarchy_of_a_multiple_template_files_with_a_removed_or_changed_by_user_targets_and_there_is_the_autoupdate_parameter_in_the_root_calculate_directory_template__the_directory_processor_uses_autoupdate_parameter_for_all_templates_and_joins_all_templates_as_if_target_files_have_no_user_changes( self ) :
def test_ if_templates_are_hierarchy_of_a_multiple_template_files_with_a_removed_or_changed_by_user_targets_and_there_is_the_autoupdate_parameter_in_the_root_calculate_directory_template__the_directory_processor_uses_autoupdate_parameter_for_all_templates_and_joins_all_templates_as_if_target_files_have_no_user_changes( self ) :
datavars . main [ ' cl_template_path ' ] = os . path . join ( CHROOT_PATH ,
' templates_10 ' )
directory_processor = DirectoryProcessor ( ' install ' ,
@ -342,7 +344,7 @@ class TestDirectoryProcessor:
hashlib . md5 (
output_text_2 . encode ( ) ) . hexdigest ( ) )
def if_the_template_directory_have_no_the_action_parameter_value_and_append_parameter_is_not_skip__the_directory_processor_skips_this_template_branch_and_sets_warning( self ) :
def test_ if_the_template_directory_have_no_the_action_parameter_value_and_append_parameter_is_not_skip__the_directory_processor_skips_this_template_branch_and_sets_warning( self ) :
datavars . main [ ' cl_template_path ' ] = os . path . join ( CHROOT_PATH ,
' templates_11 ' )
io_module = IOModule ( )
@ -357,12 +359,12 @@ class TestDirectoryProcessor:
assert not os . path . exists ( join_paths ( CHROOT_PATH , ' /etc/dir_8 ' ) )
assert io_module . messages [ - 1 ] == ( ' warning ' , warning_message )
def if_the_template_has_two_root_directories_with_different_action_values_and_directory_processor_intialized_for_the_one_of_this_actions__the_directory_processor_skips_one_this_template_s_roots_and_processed_a_template_s_root_with_the_same_action_parameter_value( self ) :
def test_ if_the_template_has_two_root_directories_with_different_action_values_and_directory_processor_intialized_for_the_one_of_this_actions__the_directory_processor_skips_one_this_template_s_roots_and_processed_a_template_s_root_with_the_same_action_parameter_value( self ) :
datavars . main [ ' cl_template_path ' ] = os . path . join ( CHROOT_PATH ,
' templates_12 ' )
io_module = IOModule ( )
warning_message = ( " Action parameter value ' {0} ' does not match its "
" current value ' {1} ' . \n Template: {2} " ) . format (
" current value ' {1} ' . Template: {2} " ) . format (
' update ' ,
' install ' ,
join_paths (
@ -376,6 +378,239 @@ class TestDirectoryProcessor:
assert not os . path . exists ( join_paths ( CHROOT_PATH , ' /etc/file_7 ' ) )
assert io_module . messages [ - 1 ] == ( ' warning ' , warning_message )
def test_if_some_template_directories_have_no_the_action_parameter_value_but_the_append_parameter_s_value_is_skip__the_directory_processor_does_not_stop_the_directories_processing_and_sends_no_warnings ( self ) :
datavars . main [ ' cl_template_path ' ] = os . path . join ( CHROOT_PATH ,
' templates_13 ' )
directory_processor = DirectoryProcessor ( ' install ' ,
datavars_module = datavars )
directory_processor . process_template_directories ( )
assert os . path . exists ( join_paths ( CHROOT_PATH , ' /etc/file_8 ' ) )
def test_if_template_s_directory_contains_two_directories_with_single_template_files_that_belongs_to_a_different_packages_and_target_files_does_not_exist__the_directory_processor_creates_two_files_and_adds_them_to_a_different_packages ( self ) :
datavars . main [ ' cl_template_path ' ] = os . path . join ( CHROOT_PATH ,
' templates_14 ' )
directory_processor = DirectoryProcessor ( ' install ' ,
datavars_module = datavars )
directory_processor . process_template_directories ( )
test_package = Package ( test_package_name , chroot_path = CHROOT_PATH )
other_package = Package ( other_package_name , chroot_path = CHROOT_PATH )
assert os . path . exists ( join_paths ( CHROOT_PATH , ' /etc/dir_9 ' ) )
assert os . path . exists ( join_paths ( CHROOT_PATH , ' /etc/dir_9/file_0 ' ) )
assert ' /etc/dir_9/file_0 ' in other_package
assert os . path . exists ( join_paths ( CHROOT_PATH , ' /etc/dir_10 ' ) )
assert os . path . exists ( join_paths ( CHROOT_PATH , ' /etc/dir_10/file_0 ' ) )
assert ' /etc/dir_10/file_0 ' in test_package
def test_if_template_s_directory_contains_one_directory_with_a_template_file_without_a_package_value_target_file_does_not_exist_and_template_executor_is_not_able_to_detect_package_using_target_path__the_directory_processor_skips_this_template_and_sets_error_in_the_output ( self ) :
datavars . main [ ' cl_template_path ' ] = os . path . join ( CHROOT_PATH ,
' templates_15 ' )
error_message = ( " Template execution error: collision: ' package ' "
" parameter is not defined for template with ' append ' "
" parameter. Template: /home/divanov/Home/development/ "
" calculate-lib/tests/templates/testfiles/ "
" test_dir_processor_root/templates_15/root/dir_11 " )
io_module = IOModule ( )
directory_processor = DirectoryProcessor ( ' install ' ,
datavars_module = datavars ,
output_module = io_module )
directory_processor . process_template_directories ( )
assert not os . path . exists ( join_paths ( CHROOT_PATH ,
' /etc/dir_11 ' ) )
assert not os . path . exists ( join_paths ( CHROOT_PATH ,
' /etc/dir_11/file_0 ' ) )
assert io_module . messages [ - 1 ] == ( ' error ' , error_message )
def test_if_template_s_directory_contains_one_directory_with_a_template_file_without_a_package_value_target_file_exists_and_template_executor_is_able_to_detect_package_using_target_path__the_directory_processor_joins_template_to_a_target_file_and_updates_the_CONTENTS_file ( self ) :
datavars . main [ ' cl_template_path ' ] = os . path . join ( CHROOT_PATH ,
' templates_16 ' )
directory_processor = DirectoryProcessor ( ' install ' ,
datavars_module = datavars )
directory_processor . process_template_directories ( )
new_package = Package ( new_package_name , chroot_path = CHROOT_PATH )
assert os . path . exists ( join_paths ( CHROOT_PATH ,
' /etc/dir_12 ' ) )
assert os . path . exists ( join_paths ( CHROOT_PATH ,
' /etc/dir_12/file_0 ' ) )
assert ' /etc/dir_12/file_0 ' in new_package
def test_if_template_s_directory_contains_two_directories_with_single_template_files_that_belongs_to_a_different_packages_and_target_files_does_not_exist_and_directory_processor_is_used_for_a_package__the_directory_processor_creates_one_file_using_template_with_actual_package_parameter_and_adds_it_to_a_package_and_add_to_the_packages_file_trees_a_directory_with_an_other_template ( self ) :
datavars . main [ ' cl_template_path ' ] = os . path . join ( CHROOT_PATH ,
' templates_17 ' )
directory_processor = DirectoryProcessor ( ' install ' ,
datavars_module = datavars ,
package = other_package_name )
directory_processor . process_template_directories ( )
test_package = Package ( test_package_name , chroot_path = CHROOT_PATH )
other_package = Package ( other_package_name , chroot_path = CHROOT_PATH )
assert os . path . exists ( join_paths ( CHROOT_PATH , ' /etc/dir_13 ' ) )
assert os . path . exists ( join_paths ( CHROOT_PATH , ' /etc/dir_13/file_0 ' ) )
assert ' /etc/dir_13/file_0 ' in other_package
assert not os . path . exists ( join_paths ( CHROOT_PATH , ' /etc/dir_14 ' ) )
assert not os . path . exists ( join_paths ( CHROOT_PATH ,
' /etc/dir_14/file_0 ' ) )
assert ' /etc/dir_14/file_0 ' not in test_package
def test_if_template_s_directory_contains_two_directories_with_single_template_files_that_belongs_to_a_different_packages_and_target_files_does_not_exist_and_one_of_a_template_file_has_the_merge_parameter_with_other_package_and_directory_processor_is_used_for_a_package__the_directory_processor_creates_one_file_using_template_with_actual_package_parameter_and_then_uses_the_packages_file_tree_to_merge_an_other_package ( self ) :
datavars . main [ ' cl_template_path ' ] = os . path . join ( CHROOT_PATH ,
' templates_18 ' )
directory_processor = DirectoryProcessor ( ' install ' ,
datavars_module = datavars ,
package = other_package_name )
directory_processor . process_template_directories ( )
test_package = Package ( test_package_name , chroot_path = CHROOT_PATH )
other_package = Package ( other_package_name , chroot_path = CHROOT_PATH )
assert os . path . exists ( join_paths ( CHROOT_PATH , ' /etc/dir_15 ' ) )
assert os . path . exists ( join_paths ( CHROOT_PATH , ' /etc/dir_15/file_0 ' ) )
assert ' /etc/dir_15/file_0 ' in other_package
assert os . path . exists ( join_paths ( CHROOT_PATH , ' /etc/dir_16 ' ) )
assert os . path . exists ( join_paths ( CHROOT_PATH ,
' /etc/dir_16/file_0 ' ) )
assert ' /etc/dir_16/file_0 ' in test_package
def test_if_template_s_directory_contains_a_template_directory_which_target_is_a_link_to_an_other_directory_and_force_parameter_is_not_set__the_directory_processor_changes_a_template_target_path_to_a_link_source_path_and_joins_all_templates_from_the_template_directory ( self ) :
datavars . main [ ' cl_template_path ' ] = os . path . join ( CHROOT_PATH ,
' templates_19 ' )
directory_processor = DirectoryProcessor ( ' install ' ,
datavars_module = datavars )
directory_processor . process_template_directories ( )
test_package = Package ( test_package_name , chroot_path = CHROOT_PATH )
# Для разнообразия один из шаблонов удаляет файл, а не создает.
assert not os . path . exists ( join_paths ( CHROOT_PATH ,
' /etc/dir_18/file_0 ' ) )
assert ' /etc/dir_18/file_0 ' not in test_package
assert os . path . exists ( join_paths ( CHROOT_PATH ,
' /etc/dir_18/dir_0 ' ) )
assert os . path . exists ( join_paths ( CHROOT_PATH ,
' /etc/dir_18/dir_0/file_0 ' ) )
assert ' /etc/dir_18/dir_0/file_0 ' in test_package
def test_if_template_s_directory_contains_a_template_directory_which_target_is_a_link_to_an_other_directory_and_force_parameter_is_set__the_directory_processor_removes_link_on_a_target_path_and_joins_all_templates_from_a_template_directory ( self ) :
datavars . main [ ' cl_template_path ' ] = os . path . join ( CHROOT_PATH ,
' templates_20 ' )
directory_processor = DirectoryProcessor ( ' install ' ,
datavars_module = datavars )
directory_processor . process_template_directories ( )
test_package = Package ( test_package_name , chroot_path = CHROOT_PATH )
# Для разнообразия один из шаблонов удаляет файл, а не создает.
# Н о в данном случае он ничего не сделает.
assert os . path . exists ( join_paths ( CHROOT_PATH ,
' /etc/dir_20/file_0 ' ) )
assert ' /etc/dir_20/file_0 ' not in test_package
assert not os . path . islink ( join_paths ( CHROOT_PATH , ' /etc/dir_19 ' ) )
assert os . path . isdir ( join_paths ( CHROOT_PATH , ' /etc/dir_19 ' ) )
assert os . path . exists ( join_paths ( CHROOT_PATH ,
' /etc/dir_19/dir_0 ' ) )
assert os . path . exists ( join_paths ( CHROOT_PATH ,
' /etc/dir_19/dir_0/file_0 ' ) )
assert ' /etc/dir_19/dir_0/file_0 ' in test_package
def test_if_template_s_directory_contains_some_directories_with_single_template_files_that_belongs_to_a_different_packages_and_target_files_does_not_exist_and_one_of_a_template_file_has_the_merge_parameter_with_other_packages_and_directory_processor_is_used_for_a_package__the_directory_processor_creates_one_file_using_template_with_actual_package_parameter_and_then_uses_the_packages_file_trees_to_merge_other_packages ( self ) :
datavars . main [ ' cl_template_path ' ] = os . path . join ( CHROOT_PATH ,
' templates_21 ' )
directory_processor = DirectoryProcessor ( ' install ' ,
datavars_module = datavars ,
package = other_package_name )
directory_processor . process_template_directories ( )
test_package = Package ( test_package_name , chroot_path = CHROOT_PATH )
other_package = Package ( other_package_name , chroot_path = CHROOT_PATH )
new_package = Package ( new_package_name , chroot_path = CHROOT_PATH )
assert os . path . exists ( join_paths ( CHROOT_PATH , ' /etc/dir_21 ' ) )
assert os . path . exists ( join_paths ( CHROOT_PATH , ' /etc/dir_21/file_0 ' ) )
assert ' /etc/dir_21/file_0 ' in other_package
assert os . path . exists ( join_paths ( CHROOT_PATH , ' /etc/dir_22 ' ) )
assert os . path . exists ( join_paths ( CHROOT_PATH ,
' /etc/dir_22/file_0 ' ) )
assert ' /etc/dir_22/file_0 ' in test_package
assert os . path . exists ( join_paths ( CHROOT_PATH , ' /etc/dir_23 ' ) )
assert os . path . exists ( join_paths ( CHROOT_PATH ,
' /etc/dir_23/file_0 ' ) )
assert ' /etc/dir_23/file_0 ' in new_package
def test_if_template_s_directory_contains_some_directories_with_single_template_files_that_belong_to_a_different_packages_and_target_files_does_not_exist_and_some_of_a_template_files_have_the_merge_parameters_with_other_packages_and_directory_processor_is_used_for_a_package__the_directory_processor_creates_one_file_using_template_with_actual_package_parameter_and_then_uses_the_packages_file_trees_to_merge_other_packages ( self ) :
datavars . main [ ' cl_template_path ' ] = os . path . join ( CHROOT_PATH ,
' templates_22 ' )
directory_processor = DirectoryProcessor (
' install ' ,
datavars_module = datavars ,
package = ' test-category/other-package ' )
directory_processor . process_template_directories ( )
test_package = Package ( test_package_name , chroot_path = CHROOT_PATH )
other_package = Package ( other_package_name , chroot_path = CHROOT_PATH )
new_package = Package ( new_package_name , chroot_path = CHROOT_PATH )
assert os . path . exists ( join_paths ( CHROOT_PATH , ' /etc/dir_24 ' ) )
assert os . path . exists ( join_paths ( CHROOT_PATH , ' /etc/dir_24/file_0 ' ) )
assert ' /etc/dir_24/file_0 ' in other_package
assert os . path . exists ( join_paths ( CHROOT_PATH , ' /etc/dir_25 ' ) )
assert os . path . exists ( join_paths ( CHROOT_PATH ,
' /etc/dir_25/file_0 ' ) )
assert ' /etc/dir_25/file_0 ' in test_package
assert os . path . exists ( join_paths ( CHROOT_PATH , ' /etc/dir_26 ' ) )
assert os . path . exists ( join_paths ( CHROOT_PATH ,
' /etc/dir_26/file_0 ' ) )
assert ' /etc/dir_26/file_0 ' in new_package
print ( ' DIRECTORY TREE: ' )
for key in directory_processor . packages_file_trees . keys ( ) :
print ( " {} -> {} " . format (
key ,
directory_processor . packages_file_trees [ key ] ) )
def test_if_template_s_directory_contains_some_directories_with_single_template_files_and_file_that_belong_to_a_different_packages_and_target_files_does_not_exist_and_some_of_a_template_files_have_the_merge_parameters_with_other_packages_and_directory_processor_is_used_for_a_package__the_directory_processor_creates_one_file_using_template_with_actual_package_parameter_and_then_uses_the_packages_file_trees_to_merge_other_packages ( self ) :
datavars . main [ ' cl_template_path ' ] = os . path . join ( CHROOT_PATH ,
' templates_23 ' )
directory_processor = DirectoryProcessor (
' install ' ,
datavars_module = datavars ,
package = ' test-category/other-package ' )
directory_processor . process_template_directories ( )
test_package = Package ( test_package_name , chroot_path = CHROOT_PATH )
other_package = Package ( other_package_name , chroot_path = CHROOT_PATH )
print ( ' DIRECTORY TREE: ' )
for key in directory_processor . packages_file_trees . keys ( ) :
print ( " {} -> {} " . format (
key ,
directory_processor . packages_file_trees [ key ] ) )
assert os . path . exists ( join_paths ( CHROOT_PATH , ' /etc/dir_27 ' ) )
assert os . path . exists ( join_paths ( CHROOT_PATH , ' /etc/dir_27/file_0 ' ) )
assert ' /etc/dir_27/file_0 ' in test_package
assert os . path . exists ( join_paths ( CHROOT_PATH , ' /etc/dir_28 ' ) )
assert os . path . exists ( join_paths ( CHROOT_PATH ,
' /etc/dir_28/file_0 ' ) )
assert ' /etc/dir_28/file_0 ' in other_package
assert os . path . exists ( join_paths ( CHROOT_PATH , ' /etc/file_9 ' ) )
assert ' /etc/file_9 ' in test_package
def test_view_tree ( self ) :
list_path = join_paths ( CHROOT_PATH , ' /etc ' )
show_tree ( list_path )