mirror of
https://github.com/borgbase/vorta
synced 2024-12-22 15:57:34 +00:00
b015368fee
Move existing tests into subfolder `tests/unit`. Write integration tests that actually run the installed borg executable. Those tests can be found in `tests/integration`. Those pytest fixtures that are the same for both kinds of tests remain in `tests/conftest.py`. The others can be found in `tests/integration/conftest.py` or `tests/unit/conftest.py`. This adds nox to the project and configures it to run the tests with different borg versions. This also updates the ci workflow to run the integration tests using nox. * noxfile.py : Run pytest with a matrix of borg versions OR a specific borg version * Makefile : Run using nox. Add phonies `test-unit` and `test-integration`. * tests/conftest.py : Move some fixtures/functions to `tests/unit/conftest.py`. * tests/test_*.py --> tests/unit/ : Move unittests and assets into subfolder * tests/integration/ : Write integration tests. * requirements.d/dev.txt: Add `nox` and `pkgconfig`. The latter is needed for installing new borg versions. * .github/actions/setup/action.yml : Update to install pre-commit and nox when needed. The action now no longer installs Vorta. * .github/actions/install-dependencies/action.yml : Install system deps of borg with this new composite action. * .github/workflows/test.yml : Rename `test` ci to `test-unit` and update it for the new test setup. Implement `test-integration` ci. Signed-off-by: Chirag Aggarwal <thechiragaggarwal@gmail.com>
51 lines
1.2 KiB
Python
51 lines
1.2 KiB
Python
from vorta.borg.create import BorgCreateJob
|
|
from vorta.store.models import BackupProfileModel, SourceFileModel
|
|
|
|
|
|
def test_create_paths_from_command():
|
|
default_profile = BackupProfileModel.get()
|
|
default_profile.new_archive_name = 'a1'
|
|
|
|
default_profile.repo.create_backup_cmd = '--one-file-system'
|
|
result = BorgCreateJob.prepare(default_profile)
|
|
|
|
assert 'cmd' in result
|
|
assert result['cmd'] == [
|
|
'borg',
|
|
'create',
|
|
'--list',
|
|
'--progress',
|
|
'--info',
|
|
'--log-json',
|
|
'--json',
|
|
'--filter=AM',
|
|
'-C',
|
|
'lz4',
|
|
'--one-file-system',
|
|
'i0fi93@i593.repo.borgbase.com:repo::a1',
|
|
'/tmp/another',
|
|
]
|
|
|
|
default_profile.repo.create_backup_cmd = '--paths-from-command -- echo /tmp/another'
|
|
SourceFileModel.delete().execute()
|
|
|
|
result = BorgCreateJob.prepare(default_profile)
|
|
|
|
assert 'cmd' in result
|
|
assert result['cmd'] == [
|
|
'borg',
|
|
'create',
|
|
'--list',
|
|
'--progress',
|
|
'--info',
|
|
'--log-json',
|
|
'--json',
|
|
'--filter=AM',
|
|
'-C',
|
|
'lz4',
|
|
'--paths-from-command',
|
|
'i0fi93@i593.repo.borgbase.com:repo::a1',
|
|
'--',
|
|
'echo',
|
|
'/tmp/another',
|
|
]
|