pki_ca/tests/integration/test_zenroom_service_client...

31 lines
939 B
Python

import os
import unittest
import sys
from pathlib import Path
code_path = Path(__file__).parents[2] / "ca_core"
sys.path.insert(0, str(code_path))
from crypto.zenroom_service_client import ZenroomServiceClient
class TestZenroomServiceClientIntegration(unittest.TestCase):
@unittest.skipUnless(
os.getenv("ZENROOM_BASE_URL"),
"No ZENROOM_BASE_URL set",
)
def test_generate_keypair_real_service(self):
client = ZenroomServiceClient(base_url=os.environ["ZENROOM_BASE_URL"])
res = client.generate_keypair("IntegrationUser")
self.assertIn("private_key", res)
self.assertIsInstance(res["private_key"], str)
self.assertTrue(res["private_key"].strip())
# public_key may or may not be returned by this contract variant
if "public_key" in res:
self.assertIsInstance(res["public_key"], str)
self.assertTrue(res["public_key"].strip())