21 lines
642 B
Python
21 lines
642 B
Python
from copy import deepcopy
|
|
|
|
import pytest
|
|
from pydantic import ValidationError
|
|
|
|
from ai_platform.presentation.http.schemas import RunRequest
|
|
|
|
|
|
def test_run_request_contains_caller_rules_and_weights(valid_run_payload):
|
|
request = RunRequest.model_validate(valid_run_payload)
|
|
assert request.scoring_config.rules[0].points == 25
|
|
assert request.scoring_config.ai_weight == 0
|
|
|
|
|
|
def test_run_request_requires_weights_to_sum_to_one(valid_run_payload):
|
|
data = deepcopy(valid_run_payload)
|
|
data["scoring_config"].update(rule_weight=0.5, ai_weight=0.4)
|
|
|
|
with pytest.raises(ValidationError):
|
|
RunRequest.model_validate(data)
|