|
4 | 4 | __date__ = "2024-11-09" |
5 | 5 | __description__ = "Generates the utPLSQL test skeleton code - package spec & package body." |
6 | 6 |
|
| 7 | +import copy |
| 8 | + |
7 | 9 | from lib.file_system_utils import project_home |
8 | 10 | from lib.config_mgr import ConfigManager |
9 | 11 | from model.db_objects import Table |
|
21 | 23 |
|
22 | 24 |
|
23 | 25 | # Define our substitution placeholder string for indent spaces. |
24 | | -# The number of spaces for an indent tab, is defined in OraTAPI.ini |
| 26 | +# The number of spaces for an indent tab is defined in OraTAPI.ini |
25 | 27 | IDNT = '%indent_spaces%' |
26 | 28 |
|
27 | 29 | APP_HOME = project_home() |
@@ -389,6 +391,9 @@ def gen_package_body(self) -> str: |
389 | 391 |
|
390 | 392 | _procedure_name = constraint_dict["constraint_name_lc"] |
391 | 393 | constraint_type = constraint_dict["constraint_type"] |
| 394 | + if 'sys_' in _procedure_name and constraint_type == 'N': |
| 395 | + _procedure_name = f"{cons_columns[0].lower()}_not_null" |
| 396 | + |
392 | 397 | merged_dict["throws_code"] = self.constraint_exceptions_map[constraint_type] |
393 | 398 |
|
394 | 399 |
|
@@ -519,6 +524,8 @@ def gen_package_spec(self) -> str: |
519 | 524 |
|
520 | 525 | _procedure_name = constraint_dict["constraint_name_lc"] |
521 | 526 | constraint_type = constraint_dict["constraint_type"] |
| 527 | + if 'sys_' in _procedure_name and constraint_type == 'N': |
| 528 | + _procedure_name = f"{cons_columns[0].lower()}_not_null" |
522 | 529 |
|
523 | 530 | merged_dict["throws_code"] = self.constraint_exceptions_map[constraint_type] |
524 | 531 |
|
@@ -560,8 +567,11 @@ def _construct_constraint_test(self, procedure_basename: str, procedure_name: st |
560 | 567 |
|
561 | 568 | procedure = self._package_api_template(template_category="ut_packages", template_type=template_type, |
562 | 569 | template_name='constraint_test') |
| 570 | + _constraint_dict = copy.deepcopy(constraint_dict) |
563 | 571 |
|
564 | | - subst_dict = {"api_type": procedure_basename, "procedure_name": procedure_name} | constraint_dict |
| 572 | + _constraint_dict["constraint_name"] = procedure_name.upper() |
| 573 | + _constraint_dict["constraint_name_lc"] = procedure_name.lower() |
| 574 | + subst_dict = {"api_type": procedure_basename, "procedure_name": procedure_name} | _constraint_dict |
565 | 575 |
|
566 | 576 |
|
567 | 577 | procedure = inject_values(substitutions=subst_dict, |
|
0 commit comments