29 lines
1.0 KiB
Python
29 lines
1.0 KiB
Python
import pytest
|
|
from BreCal.stubs.participant import get_participant_simple
|
|
|
|
def test_participant_postal_code_len_is_five():
|
|
from BreCal.validators.schema_validation import participant_postal_code_len_is_five
|
|
|
|
participant = get_participant_simple()
|
|
assert participant_postal_code_len_is_five(participant)[0], f"the postal code should be exactly 5 numbers"
|
|
return
|
|
|
|
def test_participant_postal_code_len_is_six_should_assert():
|
|
from BreCal.validators.schema_validation import participant_postal_code_len_is_five
|
|
|
|
participant = get_participant_simple()
|
|
participant.postal_code = "123456"
|
|
with pytest.raises(AssertionError, match="the postal code should be exactly 5 numbers"):
|
|
assert participant_postal_code_len_is_five(participant)[0], f"the postal code should be exactly 5 numbers"
|
|
return
|
|
|
|
# TODO_postal_code_zero -> assert? Is postal_code mandatory?
|
|
|
|
|
|
|
|
|
|
if __name__=="__main__":
|
|
test_participant_postal_code_len_is_five()
|
|
test_participant_postal_code_len_is_six_should_assert()
|
|
|