Files
Black_Raven b5ae8a1a46 feat(models): Added Validator class
Validator checks response assertions:
- Supports status code validation
- Supports JSON field validation
- Returns True if all assertions pass
2026-08-24 15:47:46 +03:00

18 lines
544 B
Python

from .itm import AssertModel
from .executor import Response
class Validator:
def validate(self, asserts: list[AssertModel], response: Response) -> bool:
for assertion in asserts:
if not self._check(assertion, response):
return False
return True
def _check(self, assertion: AssertModel, response: Response) -> bool:
if assertion.type == "status":
return response.status == assertion.value
if assertion.type == "json":
return True
return True