ahriman/tests/ahriman/models/test_report_settings.py
Evgenii Alekseev d90f417cae
Docstring update (#58)
* migrate docstrings from reST to google format

* add raises note

Also change behaviour of the `from_option` method to fallback to
disabled instead of raising exception on unknown option

* fix part of warnings for sphinx

* make identation a bit more readable

* review fixes

* add verbose description for properties to make them parsed by sphinx extenstion

* add demo sphinx generator
2022-04-17 20:25:28 +03:00

26 lines
919 B
Python

from ahriman.models.report_settings import ReportSettings
def test_from_option_invalid() -> None:
"""
must return disabled on invalid option
"""
assert ReportSettings.from_option("invalid") == ReportSettings.Disabled
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
assert ReportSettings.from_option("telegram") == ReportSettings.Telegram
assert ReportSettings.from_option("TElegraM") == ReportSettings.Telegram