Resolve "Write proper tests for test SIGMET sequences"
Closes Write proper tests for test SIGMET sequences (#150 - closed)
To test
Run automatic tests; see that test case /tests/test_sigmet_sequence.py::test_test_sigmet_sequences
succeeds.
Further notes
On Pydantic:
-
It might be useful, at least at development time, if Pydantic validation errors would be more visible to the call site; I managed to waste a whole lot of time before realising that the issue I was having was caused by a missing property on a message (the BE just replies with HTTP status code
400
without any details that I could discern). I believe mr. @ToniNurmi is preparing a tech debt issue about this. -
While running the tests there is a warning issued:
opmet_backend/models/shared.py:84 PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.7/migration/
Not knowing enough about Pydantic, I didn't want to mess around, but this seems a bit tech-debt-y to me as well.
On configuration:
Another test case (/tests/test_sigmet.py::test_cancel_sigmet_type_without_original_type_config
) was changing the state of the BE configuration, which did mess up the test case at hand here. Much confusion ensued.
It seems error-prone that the configurations are not immutable in the first place; accidentally mutating said state in business logic code may lead to hard-to-decipher bug behaviour.