Add test/list-cmd

Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2022-12-04 15:56:52 +01:00
commit 03da0449c4
4 changed files with 165 additions and 0 deletions

24
test/list-cmd/test.py Normal file
View file

@ -0,0 +1,24 @@
#!/usr/bin/python3.8
from jwutils.misc import multi_regex_edit
from jwutils.log import *
from devtest.os.test import ListCmd as Base
class TestCase(Base):
def _filter(self, output):
slog(WARNING, "Running filter")
output = multi_regex_edit([
('del', 'nonexist'),
('sub', '/usr/bin', '/klaut/bin')
], output)
return output
if __name__ == '__main__':
set_level(INFO)
refpath = 'ps-ref.txt'
testpath = 'ps-out.txt'
with open(testpath, "r") as f:
lines = f.readlines()
features = set(['polp'])
TestCase(refpath, write_response=True).test(lines, features)