|
20 | 20 |
|
21 | 21 | import os |
22 | 22 | import json |
| 23 | +from pdb import set_trace |
23 | 24 | from typing import Dict, List, Tuple |
24 | 25 | from unittest.mock import patch, MagicMock |
25 | 26 | import networkx as nx |
@@ -992,3 +993,28 @@ def test_get_all_get_crud_delete_operations(test_fixture_pbw, codeanalyzer_jar_p |
992 | 993 | assert isinstance(crud_op, JCRUDOperation) |
993 | 994 | assert crud_op.line_number > 0 |
994 | 995 | assert crud_op.operation_type.value == "DELETE" |
| 996 | + |
| 997 | + |
| 998 | +def test_get_all_get_crud_operations_daytrader8(test_fixture, codeanalyzer_jar_path): |
| 999 | + """It should return all of the CRUD operations in an application""" |
| 1000 | + code_analyzer = JCodeanalyzer( |
| 1001 | + project_dir=test_fixture, |
| 1002 | + source_code=None, |
| 1003 | + analysis_backend_path=codeanalyzer_jar_path, |
| 1004 | + analysis_json_path=test_fixture / "build", |
| 1005 | + analysis_level=AnalysisLevel.symbol_table, |
| 1006 | + use_graalvm_binary=False, |
| 1007 | + eager_analysis=True, |
| 1008 | + target_files=None, |
| 1009 | + ) |
| 1010 | + crud_operations = code_analyzer.get_all_crud_operations() |
| 1011 | + assert crud_operations is not None |
| 1012 | + for operation in crud_operations: |
| 1013 | + assert operation is not None |
| 1014 | + assert isinstance(operation, Dict) |
| 1015 | + assert isinstance(operation["crud_operations"], list) |
| 1016 | + for crud_op in operation["crud_operations"]: |
| 1017 | + assert crud_op is not None |
| 1018 | + assert isinstance(crud_op, JCRUDOperation) |
| 1019 | + assert crud_op.line_number > 0 |
| 1020 | + assert crud_op.operation_type.value in ["CREATE", "READ", "UPDATE", "DELETE"] |
0 commit comments