new feature: JEV Integration. Now there are a current (native) LLM decision model and a JEV decision model
This commit is contained in:
33
tests/test_jev_endpoint.py
Normal file
33
tests/test_jev_endpoint.py
Normal file
@@ -0,0 +1,33 @@
|
||||
"""Offline regression tests: python -m unittest discover -s tests -p test_jev_endpoint.py"""
|
||||
import importlib.util
|
||||
import os
|
||||
from pathlib import Path
|
||||
import unittest
|
||||
from unittest.mock import patch
|
||||
|
||||
CLIENT = Path(__file__).resolve().parents[1] / 'libs/agent_framework/src/agent_framework/decisions/client.py'
|
||||
spec = importlib.util.spec_from_file_location('jev_client_patch', CLIENT)
|
||||
module = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(module)
|
||||
|
||||
class EndpointTests(unittest.TestCase):
|
||||
def test_default(self):
|
||||
with patch.dict(os.environ, {}, clear=True):
|
||||
self.assertEqual(module._jev_endpoint(), 'https://ai-gateway.vercel.sh/v1/decisions')
|
||||
|
||||
def test_typesafe_endpoint(self):
|
||||
with patch.dict(os.environ, {'JEV_ENDPOINT': 'https://api.typesafe.ai/v1/systemone'}, clear=True):
|
||||
self.assertEqual(module._jev_endpoint(), 'https://api.typesafe.ai/v1/systemone')
|
||||
|
||||
def test_reject_untrusted_host(self):
|
||||
with patch.dict(os.environ, {'JEV_ENDPOINT': 'https://evil.example/v1/decisions'}, clear=True):
|
||||
with self.assertRaises(ValueError):
|
||||
module._jev_endpoint()
|
||||
|
||||
def test_reject_http(self):
|
||||
with patch.dict(os.environ, {'JEV_ENDPOINT': 'http://api.typesafe.ai/v1/systemone'}, clear=True):
|
||||
with self.assertRaises(ValueError):
|
||||
module._jev_endpoint()
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user