tests: update cli tests

This commit is contained in:
Sina Atalay 2024-04-30 20:17:16 +03:00
parent 2526926b90
commit f2eea31b35
1 changed files with 7 additions and 19 deletions

View File

@ -19,6 +19,7 @@ def test_warning():
def test_error():
with pytest.raises(typer.Exit):
cli.error("This is an error message.")
@ -49,15 +50,6 @@ def test_get_error_message_and_location_and_value_from_a_custom_error():
@pytest.mark.parametrize(
"data_model_class, invalid_model",
[
(
dm.EducationEntry,
{
"institution": "Boğaziçi University",
"area": "Mechanical Engineering",
"degree": "BS",
"date": "2028-12-08",
},
),
(
dm.EducationEntry,
{
@ -104,12 +96,6 @@ def test_get_error_message_and_location_and_value_from_a_custom_error():
"name": "My One Line Entry",
},
),
(
dm.NormalEntry,
{
"name": "My Entry",
},
),
(
dm.CurriculumVitae,
{
@ -135,6 +121,7 @@ def test_handle_validation_error(data_model_class, invalid_model):
try:
data_model_class(**invalid_model)
except pydantic.ValidationError as e:
with pytest.raises(typer.Exit):
cli.handle_validation_error(e)
@ -153,6 +140,7 @@ def test_handle_exceptions(exception):
def function_that_raises_exception():
raise exception
with pytest.raises(typer.Exit):
function_that_raises_exception()