File: test_create.py

package info (click to toggle)
vorta 0.10.3-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 5,684 kB
  • sloc: python: 11,548; makefile: 89; xml: 63; sh: 51
file content (51 lines) | stat: -rw-r--r-- 1,277 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
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',
    ]