Initialize GovOPlaN SOAP connector
This commit is contained in:
43
tests/test_soap_module_contract.py
Normal file
43
tests/test_soap_module_contract.py
Normal file
@@ -0,0 +1,43 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import unittest
|
||||
|
||||
from govoplan_core.core.modules import ModuleContext
|
||||
|
||||
from govoplan_soap.backend.contracts import SoapOperationDescriptor
|
||||
from govoplan_soap.backend.manifest import get_manifest
|
||||
|
||||
|
||||
class SoapModuleContractTests(unittest.TestCase):
|
||||
def test_manifest_declares_soap_module(self) -> None:
|
||||
manifest = get_manifest()
|
||||
|
||||
self.assertEqual("soap", manifest.id)
|
||||
self.assertTrue(manifest.route_factory)
|
||||
self.assertEqual(("auth.principalResolver", "auth.permissionEvaluator"), manifest.required_capabilities)
|
||||
|
||||
def test_route_factory_exports_status_router(self) -> None:
|
||||
manifest = get_manifest()
|
||||
|
||||
router = manifest.route_factory(ModuleContext(registry=object(), settings=object()))
|
||||
|
||||
self.assertEqual("/soap", router.prefix)
|
||||
self.assertEqual(1, len(router.routes))
|
||||
|
||||
def test_operation_descriptor_is_stable(self) -> None:
|
||||
descriptor = SoapOperationDescriptor(
|
||||
id="demo.ping",
|
||||
module_id="demo",
|
||||
name="Ping",
|
||||
summary="Demo operation",
|
||||
service_name="DemoService",
|
||||
operation_name="Ping",
|
||||
)
|
||||
|
||||
self.assertEqual("DemoService", descriptor.service_name)
|
||||
self.assertEqual("authenticated", descriptor.visibility)
|
||||
self.assertEqual((), descriptor.required_scopes)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user