42 lines
1.5 KiB
Python
42 lines
1.5 KiB
Python
from __future__ import annotations
|
|
|
|
import os
|
|
import unittest
|
|
|
|
from services.control_api.contextforge.client import ContextForgeClient
|
|
from services.control_api.contextforge.models import ContextForgeSettings, GatewayDesiredState
|
|
|
|
|
|
@unittest.skipUnless(
|
|
os.getenv("WP050_CONTEXTFORGE_URL") and os.getenv("WP050_CONTEXTFORGE_TOKEN"),
|
|
"set WP050_CONTEXTFORGE_URL and WP050_CONTEXTFORGE_TOKEN for the real 1.0.6 Compose test",
|
|
)
|
|
class RealContextForgeIntegrationTests(unittest.TestCase):
|
|
def test_health_version_and_isolated_gateway_lifecycle(self) -> None:
|
|
settings = ContextForgeSettings(
|
|
base_url=os.environ["WP050_CONTEXTFORGE_URL"],
|
|
auth_token_env="WP050_CONTEXTFORGE_TOKEN", # noqa: S106
|
|
auth_scheme="Bearer",
|
|
retries=1,
|
|
)
|
|
client = ContextForgeClient(settings)
|
|
desired = GatewayDesiredState(
|
|
slug="wp050-integration-gateway",
|
|
url="https://example.com/mcp",
|
|
description="Disposable WP-050 integration gateway",
|
|
)
|
|
try:
|
|
self.assertEqual(client.health().get("status"), "healthy")
|
|
self.assertEqual(client.version(), "1.0.6")
|
|
handle = client.ensure_gateway(desired)
|
|
self.assertEqual(handle.snapshot.slug, desired.slug)
|
|
same = client.ensure_gateway(desired)
|
|
self.assertEqual(same.external_id, handle.external_id)
|
|
client.delete_gateway(handle)
|
|
finally:
|
|
client.close()
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|