|
|
|
@ -1,10 +1,11 @@ |
|
|
|
import pytest |
|
|
|
from tibi_hardlinks.filename_creation import create_backup_directory_name |
|
|
|
from tibi_hardlinks.exceptions import ConfigurationException |
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.usefixtures("canned_data_output") |
|
|
|
@pytest.mark.parametrize("filename", ["example-old", "example-new"]) |
|
|
|
def test_filename_good(filename, canned_data_output): |
|
|
|
def test_filename_good_canned(filename, canned_data_output): |
|
|
|
data = canned_data_output(filename) |
|
|
|
filenames = { |
|
|
|
"example-old": "XT1095/TA44909SO3/QPython3/1.0.3/2017-11-01_07-38-42", |
|
|
|
@ -13,3 +14,16 @@ def test_filename_good(filename, canned_data_output): |
|
|
|
|
|
|
|
generated_filename = create_backup_directory_name(data) |
|
|
|
assert filenames[filename] == generated_filename |
|
|
|
|
|
|
|
|
|
|
|
def test_filename_raise_on_bad_time_format(canned_data_output): |
|
|
|
data = canned_data_output("example-new") |
|
|
|
|
|
|
|
with pytest.raises(ConfigurationException): |
|
|
|
create_backup_directory_name(data, "obviously bogus time format") |
|
|
|
|
|
|
|
|
|
|
|
def test_filename_raise_on_incomplete_exception(canned_data_output): |
|
|
|
data = canned_data_output("example-new") |
|
|
|
with pytest.raises(ConfigurationException): |
|
|
|
create_backup_directory_name(data, "%Y-%M-%D") |