local-software-update/test/losoup/test_local_files.py

27 lines
801 B
Python

from losoup.file_operations.local_files import LocalFile
from losoup.models import Asset
import typer
def test_local_files_init(keepassxc):
local_file = LocalFile(keepassxc)
assert local_file.software == keepassxc
def test_get_local_files(local_file):
assert "KeePassXC-2.7.9-x86_64.AppImage" in local_file.get_files_in_folder()
def test_is_file_present(local_file):
assert local_file.is_file_present()
def test_is_file_absent(local_file_not_present):
assert local_file_not_present.is_file_absent()
def test_write_file(keepassxc_digest_file: LocalFile, asset_to_write: Asset):
assert keepassxc_digest_file.is_file_absent()
keepassxc_digest_file.write_file(asset_to_write)
assert keepassxc_digest_file.is_file_present()
keepassxc_digest_file.delete_file()