mirror of
https://github.com/arcan1s/ahriman.git
synced 2025-04-25 15:57:18 +00:00
also replace single quote to double one to confort PEP docstring + move _check_output to class properties to make it available for mocking
24 lines
702 B
Python
24 lines
702 B
Python
import pytest
|
|
|
|
from ahriman.core.exceptions import InvalidOption
|
|
from ahriman.models.upload_settings import UploadSettings
|
|
|
|
|
|
def test_from_option_invalid() -> None:
|
|
"""
|
|
must raise exception on invalid option
|
|
"""
|
|
with pytest.raises(InvalidOption, match=".* `invalid`$"):
|
|
UploadSettings.from_option("invalid")
|
|
|
|
|
|
def test_from_option_valid() -> None:
|
|
"""
|
|
must return value from valid options
|
|
"""
|
|
assert UploadSettings.from_option("rsync") == UploadSettings.Rsync
|
|
assert UploadSettings.from_option("RSYNC") == UploadSettings.Rsync
|
|
|
|
assert UploadSettings.from_option("s3") == UploadSettings.S3
|
|
assert UploadSettings.from_option("S3") == UploadSettings.S3
|