MCPcopy Create free account
hub / github.com/MemTensor/MemOS / test_export_openapi_success

Method test_export_openapi_success

tests/test_cli.py:22–31  ·  view source on GitHub ↗

Test successful OpenAPI export.

(self, mock_makedirs, mock_file, mock_app)

Source from the content-addressed store, hash-verified

20 @patch("builtins.open", new_callable=mock_open)
21 @patch("os.makedirs")
22 def test_export_openapi_success(self, mock_makedirs, mock_file, mock_app):
23 """Test successful OpenAPI export."""
24 mock_openapi_data = {"openapi": "3.0.0", "info": {"title": "Test API"}}
25 mock_app.return_value.openapi.return_value = mock_openapi_data
26
27 result = export_openapi("/test/path/openapi.json")
28
29 assert result is True
30 mock_makedirs.assert_called_once_with("/test/path", exist_ok=True)
31 mock_file.assert_called_once_with("/test/path/openapi.json", "w")
32
33 @patch("memos.cli.get_openapi_app")
34 @patch("builtins.open", side_effect=OSError("Permission denied"))

Callers

nothing calls this directly

Calls 1

export_openapiFunction · 0.90

Tested by

no test coverage detected