mirror of
https://github.com/arcan1s/ahriman.git
synced 2025-04-24 23:37:18 +00:00
also add python-requests as explicit dependency and escape symbols in repository name for badges in default tempate
27 lines
861 B
Python
27 lines
861 B
Python
import pytest
|
|
|
|
from ahriman.core.exceptions import InvalidOption
|
|
from ahriman.models.report_settings import ReportSettings
|
|
|
|
|
|
def test_from_option_invalid() -> None:
|
|
"""
|
|
must raise exception on invalid option
|
|
"""
|
|
with pytest.raises(InvalidOption, match=".* `invalid`$"):
|
|
ReportSettings.from_option("invalid")
|
|
|
|
|
|
def test_from_option_valid() -> None:
|
|
"""
|
|
must return value from valid options
|
|
"""
|
|
assert ReportSettings.from_option("html") == ReportSettings.HTML
|
|
assert ReportSettings.from_option("HTML") == ReportSettings.HTML
|
|
|
|
assert ReportSettings.from_option("email") == ReportSettings.Email
|
|
assert ReportSettings.from_option("EmAil") == ReportSettings.Email
|
|
|
|
assert ReportSettings.from_option("console") == ReportSettings.Console
|
|
assert ReportSettings.from_option("conSOle") == ReportSettings.Console
|