Files
cleveragents-core/features/tdd_automation_profile_di_bypass.feature
T
HAL9000 6a76ea894d
CI / push-validation (pull_request) Successful in 27s
CI / helm (pull_request) Successful in 30s
CI / lint (pull_request) Successful in 39s
CI / build (pull_request) Successful in 52s
CI / quality (pull_request) Successful in 58s
CI / typecheck (pull_request) Successful in 1m19s
CI / security (pull_request) Successful in 1m20s
CI / integration_tests (pull_request) Successful in 3m43s
CI / unit_tests (pull_request) Successful in 4m33s
CI / docker (pull_request) Successful in 1m26s
CI / coverage (pull_request) Successful in 12m0s
CI / status-check (pull_request) Successful in 3s
test(cli): add TDD regression tests for automation_profile._get_service() DI bypass
Three BDD scenarios and two Robot Framework integration tests verifying that
_get_service() in automation_profile.py resolves AutomationProfileService
through the DI container rather than manually calling create_engine or
sessionmaker (bug #990).

Bug #990 was fixed by PR #1181 before this TDD test PR merged; the
@tdd_expected_fail tag is therefore absent and these tests serve as
permanent regression guards confirming the fix remains in place.

ISSUES CLOSED: #1031
2026-05-29 15:26:47 -04:00

33 lines
1.9 KiB
Gherkin

@tdd_bug @tdd_bug_990 @tdd_issue @tdd_issue_990
Feature: TDD Bug #990 — automation_profile._get_service() bypasses DI container
As a developer relying on the DI container for service wiring
I want _get_service() in automation_profile.py to resolve AutomationProfileService
through the DI container
So that service construction is consistent and dependencies are correctly injected
This feature captures bug #990. Previously, _get_service() bypassed the DI
container by directly constructing the persistence layer with create_engine()
and sessionmaker() rather than delegating to container.automation_profile_service().
This caused service wiring to diverge from the canonical DI path and broke
dependency injection for AutomationProfileService.
Bug #990 was fixed by PR #1181, which updated _get_service() to resolve the
service through the DI container. The @tdd_expected_fail tag has been omitted
because the fix landed on master before this TDD test PR merged; these scenarios
serve as permanent regression tests confirming the DI bypass remains fixed.
Scenario: Bug #990 — _get_service resolves AutomationProfileService through the DI container
Given ap990- the DI container has an automation_profile_service provider
When ap990- _get_service is called with the mocked container
Then ap990- the returned service should be the one from container.automation_profile_service
Scenario: Bug #990 — _get_service does not call create_engine directly
Given ap990- create_engine is patched to detect direct calls
When ap990- _get_service is called with a valid DI container
Then ap990- create_engine should not have been called
Scenario: Bug #990 — _get_service does not call sessionmaker directly
Given ap990- sessionmaker is patched to detect direct calls
When ap990- _get_service is called with a valid DI container
Then ap990- sessionmaker should not have been called