Test main function with export_openapi command.
(self, mock_export)
| 96 | |
| 97 | @patch("memos.cli.export_openapi") |
| 98 | def test_main_export_openapi(self, mock_export): |
| 99 | """Test main function with export_openapi command.""" |
| 100 | mock_export.return_value = True |
| 101 | |
| 102 | with patch("sys.argv", ["memos", "export_openapi", "--output", "/test/openapi.json"]): |
| 103 | with pytest.raises(SystemExit) as exc_info: |
| 104 | main() |
| 105 | assert exc_info.value.code == 0 |
| 106 | mock_export.assert_called_once_with("/test/openapi.json") |