| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- """
- -----------------------------------------------------------------------------------------
- INTERSEL - 4 cité d'Hauteville - 75010 PARIS
- RCS PARIS 488 379 660 - NAF 721Z
- File : tests/test_context.py
- Object : Tests for the context manager of the MCP server
- -----------------------------------------------------------------------------------------
- Modifications :
- - 2026/01/20 - Damien Lugagne-Delpon - V1.0.0- Creation
- -----------------------------------------------------------------------------------------
- @copyright : Intersel 2026
- @author : Damien Lugagne-Delpon - damien.lugagne-delpon@livinweb.fr
- @version : 1.0.0 (to be updated to the current_version of the developed software if file is touched)
- -----------------------------------------------------------------------------------------
- """
- from mcp_server.config.logger import LOGGER, init_logger
- from mcp_server.tests.test_manager import TestManager
- from mcp_server.core.context.context_manager import ContextManager
- from mcp_server.core.constants import ModxType, actionType
- init_logger()
- tm = TestManager()
- @tm.test("Context manager initializes")
- def test_context_initialization():
- cm = ContextManager()
- tm.assert_is_not_none(cm)
- @tm.test("Set and get context value")
- def test_set_get_context():
- cm = ContextManager()
- cm.add_to_context(ModxType.RESOURCE, {
- 1: {
- actionType.UPDATE: True,
- actionType.READ: True
- },
- 2: {
- actionType.READ: True
- }
- })
- context = cm.get_context()
- tm.assert_equal(len(context[ModxType.RESOURCE]), 2)
- if __name__ == "__main__":
- tm.run()
|