add first test of addon files

This commit is contained in:
Mauro Regli
2023-05-31 07:26:48 +02:00
committed by André Roth
parent 8d8f4714c3
commit 03f189b62c
3 changed files with 81 additions and 0 deletions

View File

@@ -402,6 +402,15 @@ class BaseTest(object):
else:
raise
def write_file(self, path, content):
full_path = os.path.join(os.environ["HOME"], ".aptly", path)
if not os.path.exists(os.path.dirname(full_path)):
os.makedirs(os.path.dirname(full_path), 0o755)
with open(full_path, "w") as f:
f.write(content)
def read_file(self, path, mode=''):
with open(os.path.join(os.environ["HOME"], self.aptlyDir, path), "r" + mode) as f:
return f.read()