Skip to content

Commit 7d34b32

Browse files
committed
add additional tets for code coverage
1 parent 39bdc19 commit 7d34b32

File tree

1 file changed

+65
-0
lines changed

1 file changed

+65
-0
lines changed

src/cloudwatch-appsignals-mcp-server/tests/test_enablement_tools.py

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,3 +134,68 @@ async def test_unsupported_platform_k8s(self):
134134
assert 'Enablement guide not available' in result
135135
assert 'k8s' in result.lower()
136136
assert 'not currently supported' in result
137+
138+
@pytest.mark.asyncio
139+
async def test_case_insensitive_platform(self):
140+
"""Test that uppercase platform names are normalized to lowercase."""
141+
result = await get_enablement_guide(
142+
service_platform='EC2',
143+
service_language='python',
144+
iac_directory=ABSOLUTE_PATHS['iac'],
145+
app_directory=ABSOLUTE_PATHS['app'],
146+
)
147+
148+
# Should work the same as lowercase
149+
assert 'Error: iac_directory and app_directory must be absolute paths' not in result
150+
assert (
151+
'# Application Signals Enablement Guide' in result
152+
or 'Enablement guide not available' in result
153+
)
154+
155+
@pytest.mark.asyncio
156+
async def test_case_insensitive_language(self):
157+
"""Test that uppercase language names are normalized to lowercase."""
158+
result = await get_enablement_guide(
159+
service_platform='ec2',
160+
service_language='PYTHON',
161+
iac_directory=ABSOLUTE_PATHS['iac'],
162+
app_directory=ABSOLUTE_PATHS['app'],
163+
)
164+
165+
# Should work the same as lowercase
166+
assert 'Error: iac_directory and app_directory must be absolute paths' not in result
167+
assert (
168+
'# Application Signals Enablement Guide' in result
169+
or 'Enablement guide not available' in result
170+
)
171+
172+
@pytest.mark.asyncio
173+
async def test_whitespace_trimming(self):
174+
"""Test that leading/trailing whitespace is trimmed from inputs."""
175+
result = await get_enablement_guide(
176+
service_platform=' ec2 ',
177+
service_language=' python ',
178+
iac_directory=ABSOLUTE_PATHS['iac'],
179+
app_directory=ABSOLUTE_PATHS['app'],
180+
)
181+
182+
# Should work the same as trimmed input
183+
assert 'Error: iac_directory and app_directory must be absolute paths' not in result
184+
assert (
185+
'# Application Signals Enablement Guide' in result
186+
or 'Enablement guide not available' in result
187+
)
188+
189+
@pytest.mark.asyncio
190+
async def test_both_paths_relative(self):
191+
"""Test that error message shows both paths when both are relative."""
192+
result = await get_enablement_guide(
193+
service_platform='ec2',
194+
service_language='python',
195+
iac_directory='infrastructure/cdk',
196+
app_directory='app/src',
197+
)
198+
199+
assert 'Error: iac_directory and app_directory must be absolute paths' in result
200+
assert 'infrastructure/cdk' in result
201+
assert 'app/src' in result

0 commit comments

Comments
 (0)