Repository: DevOps-MBSE/AaC (language: python)

Issue:
📋 [TASK] - Improve Tests in Unique Root Keys Unit Tests
### Parent Feature

#844

### Task Description

As an AaC Test Developer, I want to expand the test coverage in my unit tests, so that I can have more confidence in the robustness of my code.

### Acceptance Criteria

- [ ] Update test logic as necessary to expand test coverage. 
  - [ ] Happy path and sad path at a minimum
- [ ] (Stretch) Incorporate a behave feature file for testing if applicable.
- [ ] Run `flake8` on the targeted test directory and address findings.
- [ ] Document any identified gaps.

### Unresolved questions

_No response_


Discussion / hints:

Fix patch:
diff --git a/python/features/plugin_examples/root_keys.aac b/python/features/plugin_examples/root_keys.aac
new file mode 100644
index 000000000..130dd6b08
--- /dev/null
+++ b/python/features/plugin_examples/root_keys.aac
@@ -0,0 +1,16 @@
+schema:
+  name: One
+  package: test.root_keys
+  root: one
+  fields:
+    - name: name
+      type: string
+---
+schema:
+  name: Two
+  package: test.root_keys
+  root: two
+  fields:
+    - name: name
+      type: string
+---
diff --git a/python/features/plugin_examples/root_keys_duplicate.aac b/python/features/plugin_examples/root_keys_duplicate.aac
new file mode 100644
index 000000000..b1429fb23
--- /dev/null
+++ b/python/features/plugin_examples/root_keys_duplicate.aac
@@ -0,0 +1,16 @@
+schema:
+  name: One
+  package: test.root_keys
+  root: one
+  fields:
+    - name: name
+      type: string
+---
+schema:
+  name: Two
+  package: test.root_keys
+  root: one
+  fields:
+    - name: name
+      type: string
+---
diff --git a/python/features/plugins/unique_root_keys.feature b/python/features/plugins/unique_root_keys.feature
new file mode 100644
index 000000000..23f13a73f
--- /dev/null
+++ b/python/features/plugins/unique_root_keys.feature
@@ -0,0 +1,11 @@
+Feature:  Unique Root Keys Evaluation
+
+    Scenario:  Check the Root Keys example file
+        Given I have the "./features/plugin_examples/root_keys.aac" file
+        When I run the "check" command with arguments "./features/plugin_examples/root_keys.aac" and with no flags
+        Then I should receive a message that the command was successful
+
+    Scenario:  Check the Root Keys Duplicate example file
+        Given I have the "./features/plugin_examples/root_keys_duplicate.aac" file
+        When I run the "check" command with arguments "./features/plugin_examples/root_keys_duplicate.aac" and with no flags
+        Then I should receive a message that the command was not successful
diff --git a/python/features/steps/general_purpose_steps.py b/python/features/steps/general_purpose_steps.py
index 005d09ae7..2a1bac29c 100644
--- a/python/features/steps/general_purpose_steps.py
+++ b/python/features/steps/general_purpose_steps.py
@@ -103,8 +103,6 @@ def command_args_flags(context, command, args, flags):
     flags_list = flags.split()
 
     exit_code, output_message = run_cli_command_with_args(command, args_list + flags_list)
-    print(exit_code)
-    print(output_message)
     context.exit_code = exit_code
     context.output_message = output_message
 
diff --git a/python/src/aac/__init__.py b/python/src/aac/__init__.py
index 36c84566b..11226b40c 100644
--- a/python/src/aac/__init__.py
+++ b/python/src/aac/__init__.py
@@ -12,7 +12,7 @@
 import logging
 import os
 
-__version__ = "0.4.41"
+__version__ = "0.4.42"
 
 __log_file_name__ = os.path.join(os.path.dirname(__file__), "aac.log")
 
diff --git a/python/src/aac/plugins/check/check_aac_impl.py b/python/src/aac/plugins/check/check_aac_impl.py
index 806f194db..d37c5e305 100644
--- a/python/src/aac/plugins/check/check_aac_impl.py
+++ b/python/src/aac/plugins/check/check_aac_impl.py
@@ -187,12 +187,12 @@ def check_schema_constraint(
             if context_constraint.name not in [
                 definition.name for definition in definitions_to_check
             ]:
-                continue
-            callback = all_constraints_by_name[context_constraint.name]
-            result: ExecutionResult = callback(context)
-            if context_constraint.name not in constraint_results:
-                constraint_results[context_constraint.name] = []
-            constraint_results[context_constraint.name].append(result)
+                if context_constraint.name in all_constraints_by_name.keys():
+                    callback = all_constraints_by_name[context_constraint.name]
+                    result: ExecutionResult = callback(context)
+                    if context_constraint.name not in constraint_results:
+                        constraint_results[context_constraint.name] = []
+                    constraint_results[context_constraint.name].append(result)
 
     for check_me in definitions_to_check:
         defining_schema = context.get_defining_schema_for_root(check_me.get_root_key())


Test patch:
diff --git a/python/tests/test_aac/plugins/unique_root_keys/test_unique_root_keys.py b/python/tests/test_aac/plugins/unique_root_keys/test_unique_root_keys.py
index edc91e091..ff03f60a5 100644
--- a/python/tests/test_aac/plugins/unique_root_keys/test_unique_root_keys.py
+++ b/python/tests/test_aac/plugins/unique_root_keys/test_unique_root_keys.py
@@ -1,14 +1,6 @@
 from unittest import TestCase
-from typing import Tuple
-from click.testing import CliRunner
-from aac.execute.command_line import cli, initialize_cli
-from aac.execute.aac_execution_result import ExecutionStatus
 from aac.context.language_context import LanguageContext
 
-
-from aac.plugins.unique_root_keys.unique_root_keys_impl import plugin_name
-
-
 from aac.plugins.unique_root_keys.unique_root_keys_impl import root_key_names_are_unique
 
 
@@ -20,13 +12,15 @@ def test_root_key_names_are_unique(self):
         self.assertTrue(result.is_success())
         context.remove_definitions(definitions)
 
+    def test_root_key_names_are_unique_false(self):
+        context = LanguageContext()
         definitions = context.parse_and_load(BAD_ROOTS)
         result = root_key_names_are_unique(context)
         self.assertFalse(result.is_success())
+        self.assertIn("is not unique", str(result.messages))
         context.remove_definitions(definitions)
 
 
-
 GOOD_ROOTS = """
 schema:
   name: One
@@ -61,4 +55,4 @@ def test_root_key_names_are_unique(self):
   fields:
     - name: name
       type: string
-"""
\ No newline at end of file
+"""