-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
80da8d0
commit c1bdcac
Showing
1 changed file
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# modified: 2021-07-25 to be a pytest test | ||
import importlib | ||
import re | ||
import sys | ||
import os | ||
|
||
from tests.envdata import EnvData | ||
|
||
|
||
from dar_backup.util import run_command | ||
|
||
def create_test_files(env: EnvData) -> dict: | ||
env.logger.info("Creating test dummy archive files...") | ||
test_files = { | ||
f'dummy_FULL_.1.dar': 'dummy', | ||
} | ||
for filename, content in test_files.items(): | ||
with open(os.path.join(env.test_dir, 'backups', filename), 'w') as f: | ||
f.write(content) | ||
|
||
return test_files | ||
|
||
def test_dar_backup_definition_with_underscore(setup_environment, env): | ||
command = ['dar-backup', '--full-backup', '--config-file', env.config_file, '-d', 'example_2'] | ||
process = run_command(command) | ||
if process.returncode == 0: | ||
raise Exception(f'dar-backup must fail on a backup definition with an underscore in the name') | ||
|
||
def test_dar_backup_nonexistent_definition_(setup_environment, env): | ||
command = ['dar-backup', '--full-backup', '--config-file', env.config_file, '-d', 'nonexistent_definition'] | ||
process = run_command(command) | ||
if process.returncode == 0: | ||
raise Exception(f'dar-backup must fail if backup definition is not found') | ||
|