Some corrections for tests.

packages
Denis Ivanov 4 years ago
parent a60ce2317a
commit 146def6f6a

@ -1,10 +1,17 @@
CONFIG_IRQ_WORK=y
CONFIG_BUILDTIME_EXTABLE_SORT=y
CONFIG_THREAD_INFO_IN_TASK=y
#
# General setup
#
CONFIG_INIT_ENV_ARG_LIMIT=16
# CONFIG_COMPILE_TEST is not set
CONFIG_LOCALVERSION=""
# CONFIG_LOCALVERSION_AUTO is not set
CONFIG_BUILD_SALT=""
CONFIG_HAVE_KERNEL_GZIP=y
CONFIG_HAVE_KERNEL_BZIP2=y
CONFIG_HAVE_KERNEL_LZMA=y
CONFIG_HAVE_KERNEL_XZ=y
CONFIG_HAVE_KERNEL_LZO=y
CONFIG_HAVE_KERNEL_LZ4=y

@ -8,3 +8,9 @@ A needle tears a hole
The old familiar sting
Try to kill it all away
But I remember everything.
What have I become
My sweetest friend
Everyone I know
Goes away
In the end

@ -17,15 +17,15 @@
<dir name="apps">
<dir name="gdm">
<dir name="simple-greeter">
<entry mtime="1342486180" name="logo_icon_name" type="string">
<entry name="logo_icon_name" mtime="1342486180" type="string">
<stringvalue>distributor</stringvalue>
</entry>
</dir>
</dir>
<dir name="gnome-terminal">
<dir name="global">
<entry mtime="1342486180" name="use_menu_accelerators" type="bool" value="false"/>
<entry mtime="1342486180" name="use_mnemonics" type="bool" value="false"/>
<entry name="use_menu_accelerators" mtime="1342486180" type="bool" value="false"/>
<entry name="use_mnemonics" mtime="1342486180" type="bool" value="false"/>
</dir>
</dir>
</dir>

@ -622,6 +622,8 @@ class TestTemplateExecutor:
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')
# Делаем директорию пустой.
os.remove(os.path.join(target_path, 'file'))
template_executor._clear_directory(target_path)
assert not os.listdir(target_path)

@ -673,19 +673,24 @@ class TestTemplateWrapper:
assert not template_wrapper.protected
def test_if_a_target_file_is_located_in_a_directory_from_the_protected_mask__the_TemplateWrapper_object_sets_the_protected_flag_as_False(self):
parameters_object = ParametersContainer({'append': 'join',
'format': 'samba'})
try:
template_wrapper = TemplateWrapper(
join_paths(CHROOT_PATH,
'/etc/terminfo/info.json'),
parameters_object, FILE,
'/path/to/template',
chroot_path=CHROOT_PATH,
config_archive_path=CONFIG_ARCHIVE_PATH)
except Exception as error:
pytest.fail("Unexpected exception: {}".format(str(error)))
assert not template_wrapper.protected
if os.environ.get('CONFIG_PROTECT', False):
parameters_object = ParametersContainer({'append': 'join',
'format': 'samba'})
try:
template_wrapper = TemplateWrapper(
join_paths(CHROOT_PATH,
'/etc/terminfo/info.json'),
parameters_object, FILE,
'/path/to/template',
chroot_path=CHROOT_PATH,
config_archive_path=CONFIG_ARCHIVE_PATH)
except Exception as error:
pytest.fail("Unexpected exception: {}".format(str(error)))
print('PROTECTED SET')
print(template_wrapper._protected_set)
print('UNPROTECTED SET')
print(template_wrapper._unprotected_set)
assert not template_wrapper.protected
# Тестируем проверку хэш-сумм и флаг получаемый в результате нее.
def test_if_a_target_file_is_not_protected__the_TemplateWrapper_sets_the_md5_matching_flag_as_True(self):

@ -1,9 +0,0 @@
#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /path/to/template
#-------------------------------------------------------------------------------
section-name {
parameter-1 yes;
parameter-2 no;
};

@ -1,10 +0,0 @@
#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /home/divanov/Home/development/calculate-lib/tests/templates/testfiles/test_dir_processor_root/templates_8/root/file_2
#-------------------------------------------------------------------------------
options {
parameter-0 yes;
parameter-1 value_1;
parameter-2 value_2;
};

@ -1,9 +0,0 @@
#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /home/divanov/Home/development/calculate-lib/tests/templates/testfiles/test_dir_processor_root/templates_9/root/etc/file_3
#-------------------------------------------------------------------------------
options {
parameter-1 value_1;
parameter-2 value_2;
};

@ -1,9 +0,0 @@
#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /home/divanov/Home/development/calculate-lib/tests/templates/testfiles/test_dir_processor_root/templates_28/root/file_12
#-------------------------------------------------------------------------------
section-name {
parameter-1 yes;
parameter-3 10;
};

@ -1,9 +0,0 @@
#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /home/divanov/Home/development/calculate-lib/tests/templates/testfiles/test_dir_processor_root/templates_14/root/dir_10/file_0
#-------------------------------------------------------------------------------
options {
parameter-1 value_1;
parameter-2 value_2;
};

@ -1,10 +0,0 @@
#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /home/divanov/Home/development/calculate-lib/tests/templates/testfiles/test_dir_processor_root/templates_16/root/dir_12/file_0
#-------------------------------------------------------------------------------
options {
parameter-0 yes;
parameter-1 value_1;
parameter-2 value_2;
};

@ -1,9 +0,0 @@
#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /home/divanov/Home/development/calculate-lib/tests/templates/testfiles/test_dir_processor_root/templates_17/root/dir_13/file_0
#-------------------------------------------------------------------------------
options {
parameter-1 value_1;
parameter-2 value_2;
};

@ -1,9 +0,0 @@
#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /home/divanov/Home/development/calculate-lib/tests/templates/testfiles/test_dir_processor_root/templates_3/root/dir_2/file_0
#-------------------------------------------------------------------------------
options {
parameter-1 value_1;
parameter-2 value_2;
};

@ -1,9 +0,0 @@
#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /home/divanov/Home/development/calculate-lib/tests/templates/testfiles/test_dir_processor_root/templates_5/root/dir_4/file_0
#-------------------------------------------------------------------------------
options {
parameter-1 value_1;
parameter-2 value_2;
};

@ -1,9 +0,0 @@
#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /home/divanov/Home/development/calculate-lib/tests/templates/testfiles/test_dir_processor_root/templates_5/root/dir_5/file_0
#-------------------------------------------------------------------------------
options {
parameter-1 value_1;
parameter-2 value_2;
};

@ -1,10 +0,0 @@
#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /home/divanov/Home/development/calculate-lib/tests/templates/testfiles/test_dir_processor_root/templates_7/root/dir_6/file_0
#-------------------------------------------------------------------------------
options {
parameter-0 yes;
parameter-1 value_1;
parameter-2 value_2;
};

@ -1,10 +0,0 @@
#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /home/divanov/Home/development/calculate-lib/tests/templates/testfiles/test_dir_processor_root/templates_10/root/etc/dir_7/file_0
#-------------------------------------------------------------------------------
options {
parameter-0 no;
parameter-1 value_1;
parameter-2 value_2;
};

@ -1,9 +0,0 @@
#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /home/divanov/Home/development/calculate-lib/tests/templates/testfiles/test_dir_processor_root/templates_14/root/dir_9/file_0
#-------------------------------------------------------------------------------
options {
parameter-1 value_1;
parameter-2 value_2;
};

@ -1,9 +0,0 @@
#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /home/divanov/Home/development/calculate-lib/tests/templates/testfiles/test_dir_processor_root/templates_1/root/file_0
#-------------------------------------------------------------------------------
options {
parameter-1 value_1;
parameter-2 value_2;
};

@ -1,10 +0,0 @@
#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /home/divanov/Home/development/calculate-lib/tests/templates/testfiles/test_dir_processor_root/templates_6/root/file_1
#-------------------------------------------------------------------------------
options {
parameter-0 yes;
parameter-1 value_1;
parameter-2 value_2;
};

@ -1,10 +0,0 @@
#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /home/divanov/Home/development/calculate-lib/tests/templates/testfiles/test_dir_processor_root/templates_10/root/etc/file_4
#-------------------------------------------------------------------------------
options {
parameter-0 no;
parameter-1 value_1;
parameter-2 value_2;
};

@ -1,9 +0,0 @@
#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /home/divanov/Home/development/calculate-lib/tests/templates/testfiles/test_dir_processor_root/templates_10/root/etc/file_5
#-------------------------------------------------------------------------------
options {
parameter-1 value_1;
parameter-2 value_2;
};

@ -1,9 +0,0 @@
#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /home/divanov/Home/development/calculate-lib/tests/templates/testfiles/test_dir_processor_root/templates_12/root_0/etc/file_6
#-------------------------------------------------------------------------------
options {
parameter-1 value_1;
parameter-2 value_2;
};

@ -1,9 +0,0 @@
#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /home/divanov/Home/development/calculate-lib/tests/templates/testfiles/test_dir_processor_root/templates_13/root/etc/dir_9/file_8
#-------------------------------------------------------------------------------
options {
parameter-1 value_1;
parameter-2 value_2;
};

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

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

@ -1,12 +0,0 @@
dir /etc
obj /etc/file_1 823bb8dc6fdf14449714181a729374a9 1594219444
obj /etc/file_2 178094df387d2f5c2a3516a81fe760de 1594219445
obj /etc/file_3 ed2b41fe5b2e68ad3a974e0b8f9cc99a 1594219445
obj /etc/file_4 da04b7769f94c9702c0edcb8bba4770c 1594219445
dir /etc/dir_6
obj /etc/dir_6/file_0 e6977bce3e6edd818bb72f324a2a74f3 1594219444
obj /etc/dir_7/file_0 664c77aaf2d358d227db03545b083ea3 1594219446
dir /etc/dir_12
obj /etc/dir_12/file_0 a9109c66e7ec71c12bb2d45273f2c46d 1594219447
obj /etc/file_5 916eec267d08950072369b69c10a99ae 1594219445
dir /etc/dir_7

@ -1,3 +0,0 @@
dir /etc
dir /etc/dir_9
obj /etc/dir_9/file_0 78373bda3f7f86f54ca25724291a5492 1594219446

@ -1,18 +0,0 @@
dir /etc
dir /etc/dir_17
obj /etc/dir_17/file_0 c585be6f171462940b44af994a54040d 1593525253
dir /etc/dir_17/dir_0
obj /etc/dir_17/dir_0/file_0 c585be6f171462940b44af994a54040d 1593525253
obj /etc/file_12 ee090b452dbf92d697124eb424f5de5b 1592574626
obj /etc/file_0 d8047d1de0f84955782fb17d9172c283 1594219443
dir /etc/dir_2
obj /etc/dir_2/file_0 4d87707225fe92339257baad74d26220 1594219443
dir /etc/dir_4
obj /etc/dir_4/file_0 2760f4fa242d649cc32b7c27926b5bf9 1594219444
dir /etc/dir_5
dir /etc/dir_5/dir_6
obj /etc/dir_5/dir_6/file_0 c5f1a785f8e5f4af46c74afcb7c2efcc 1594219444
obj /etc/file_6 8ad8eb73b5f86ee77c2f4a89f61a5899 1594219446
obj /etc/file_8 ada08a4f77c8181fa33cac4aa39b2843 1594219446
dir /etc/dir_10
obj /etc/dir_10/file_0 454438a905c36213ec67d2a61b855daa 1594219447

@ -1,9 +0,0 @@
#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /home/divanov/Home/development/calculate-lib/tests/templates/testfiles/test_dir_processor_root/templates_14/root/dir_10/file_0
#-------------------------------------------------------------------------------
options {
parameter-1 value_1;
parameter-2 value_2;
};

@ -1,10 +0,0 @@
#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /home/divanov/Home/development/calculate-lib/tests/templates/testfiles/test_dir_processor_root/templates_16/root/dir_12/file_0
#-------------------------------------------------------------------------------
options {
parameter-0 yes;
parameter-1 value_1;
parameter-2 value_2;
};

@ -1,9 +0,0 @@
#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /home/divanov/Home/development/calculate-lib/tests/templates/testfiles/test_dir_processor_root/templates_3/root/dir_2/file_0
#-------------------------------------------------------------------------------
options {
parameter-1 value_1;
parameter-2 value_2;
};

@ -1,9 +0,0 @@
#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /home/divanov/Home/development/calculate-lib/tests/templates/testfiles/test_dir_processor_root/templates_5/root/dir_4/file_0
#-------------------------------------------------------------------------------
options {
parameter-1 value_1;
parameter-2 value_2;
};

@ -1,9 +0,0 @@
#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /home/divanov/Home/development/calculate-lib/tests/templates/testfiles/test_dir_processor_root/templates_5/root/dir_5/file_0
#-------------------------------------------------------------------------------
options {
parameter-1 value_1;
parameter-2 value_2;
};

@ -1,10 +0,0 @@
#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /home/divanov/Home/development/calculate-lib/tests/templates/testfiles/test_dir_processor_root/templates_7/root/dir_6/file_0
#-------------------------------------------------------------------------------
options {
parameter-0 yes;
parameter-1 value_1;
parameter-2 value_2;
};

@ -1,10 +0,0 @@
#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /home/divanov/Home/development/calculate-lib/tests/templates/testfiles/test_dir_processor_root/templates_10/root/etc/dir_7/file_0
#-------------------------------------------------------------------------------
options {
parameter-0 no;
parameter-1 value_1;
parameter-2 value_2;
};

@ -1,9 +0,0 @@
#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /home/divanov/Home/development/calculate-lib/tests/templates/testfiles/test_dir_processor_root/templates_14/root/dir_9/file_0
#-------------------------------------------------------------------------------
options {
parameter-1 value_1;
parameter-2 value_2;
};

@ -1,9 +0,0 @@
#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /home/divanov/Home/development/calculate-lib/tests/templates/testfiles/test_dir_processor_root/templates_1/root/file_0
#-------------------------------------------------------------------------------
options {
parameter-1 value_1;
parameter-2 value_2;
};

@ -1,10 +0,0 @@
#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /home/divanov/Home/development/calculate-lib/tests/templates/testfiles/test_dir_processor_root/templates_6/root/file_1
#-------------------------------------------------------------------------------
options {
parameter-0 yes;
parameter-1 value_1;
parameter-2 value_2;
};

@ -1,10 +0,0 @@
#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /home/divanov/Home/development/calculate-lib/tests/templates/testfiles/test_dir_processor_root/templates_10/root/etc/file_4
#-------------------------------------------------------------------------------
options {
parameter-0 no;
parameter-1 value_1;
parameter-2 value_2;
};

@ -1,9 +0,0 @@
#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /home/divanov/Home/development/calculate-lib/tests/templates/testfiles/test_dir_processor_root/templates_10/root/etc/file_5
#-------------------------------------------------------------------------------
options {
parameter-1 value_1;
parameter-2 value_2;
};

@ -1,9 +0,0 @@
#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /home/divanov/Home/development/calculate-lib/tests/templates/testfiles/test_dir_processor_root/templates_12/root_0/etc/file_6
#-------------------------------------------------------------------------------
options {
parameter-1 value_1;
parameter-2 value_2;
};

@ -1,9 +0,0 @@
#-------------------------------------------------------------------------------
# Modified by Calculate Utilities 4.0
# Processed template files:
# /home/divanov/Home/development/calculate-lib/tests/templates/testfiles/test_dir_processor_root/templates_13/root/etc/dir_9/file_8
#-------------------------------------------------------------------------------
options {
parameter-1 value_1;
parameter-2 value_2;
};

@ -6,6 +6,6 @@ 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
obj /etc/dir/file.conf 0b87fea7f5b65cac5012baa2bf647e72 1594324832
dir /etc/dir/dir_1
obj /etc/dir/dir_1/config.json 506649cf099878124deda2c2452c3693 1591617024
obj /etc/dir/dir_1/config.json 506649cf099878124deda2c2452c3693 1594324832

@ -1,14 +1,19 @@
import pytest
import os
from calculate.utils.files import Process
from subprocess import run, PIPE
CHROOT_PATH = os.path.join(os.getcwd(), 'tests/utils/testfiles/')
@pytest.mark.files_utils
class TestUtils():
def test_if_single_correct_command_executed_using_Process_object__it_successfully_executes(self):
ls_path = os.path.join(CHROOT_PATH, 'etc')
try:
ls_process = Process('ls', '-a', cwd='/')
ls_result = run('ls -a', shell=True, stdout=PIPE, cwd='/')
ls_process = Process('ls', '-a', cwd=ls_path)
ls_result = run('ls -a', shell=True, stdout=PIPE, cwd=ls_path)
except Exception as error:
print('error:', str(error))
assert False

@ -107,8 +107,10 @@ obj /usr/bin/vim 30acc0f256e11c1ecdb1bd80b688d238 1573538056
sym /usr/bin/vimdiff -> vim 1573538053
dir /etc
dir /etc/test_dir_2
obj /etc/test_dir_2/file_2.cfg a371f4d456d471ac0ed0e8befff1cb6d 1586531028
'''
obj /etc/test_dir_2/file_2.cfg a371f4d456d471ac0ed0e8befff1cb6d {}
'''.format(int(os.lstat(os.path.join(CHROOT_PATH,
'etc/test_dir_2/file_2.cfg')).st_mtime))
contents_object.add_obj('/etc/test_dir_2/file_2.cfg')
print('RESULT:')
print(contents_object.render_contents_file())
@ -125,8 +127,10 @@ obj /usr/bin/vim 30acc0f256e11c1ecdb1bd80b688d238 1573538056
sym /usr/bin/vimdiff -> vim 1573538053
dir /etc
dir /etc/test_dir_2
sym /etc/test_dir_2/symlink -> file_2.cfg 1587117567
'''
sym /etc/test_dir_2/symlink -> file_2.cfg {}
'''.format(int(os.lstat(os.path.join(CHROOT_PATH,
'etc/test_dir_2/symlink')).st_mtime))
contents_object.add_sym('/etc/test_dir_2/symlink')
print('RESULT:')
print(contents_object.render_contents_file())

Loading…
Cancel
Save