mirror of
https://framagit.org/framasoft/framaspace/argos.git
synced 2025-04-28 18:02:41 +02:00
- Start implementing some tests using pytest - Packaged using pyproject.toml - Implemented SSL checks using httpx - Checks can now run partially on the server, to access the configuration and determine the severity of the error if any - Used black to format all the files - Added an utility to convert strings like "3d" and "3w" to days - The internal representation of SSL thresholds is now a list of tuples - Models were lacking some relationship between Tasks and Results
16 lines
526 B
Python
16 lines
526 B
Python
import pytest
|
|
from argos.schemas.config import SSL
|
|
|
|
|
|
def test_ssl_duration_parsing():
|
|
data = {"thresholds": [{"2d": "warning"}, {"3w": "error"}]}
|
|
|
|
# Test the validation and parsing of SSL model
|
|
ssl_object = SSL(**data)
|
|
assert len(ssl_object.thresholds) == 2
|
|
assert ssl_object.thresholds == [(2, "warning"), (21, "error")]
|
|
|
|
# Test the constraint on severity
|
|
with pytest.raises(ValueError):
|
|
erroneous_data = {"thresholds": [{"1d": "caution"}, {"1w": "danger"}]}
|
|
SSL(**erroneous_data)
|