Skip to content

Commit 35fc43f

Browse files
committed
Sanitize values
1 parent e96aba8 commit 35fc43f

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

template/tests/unit/app/controllers/test_{{controller_name}}.py.jinja

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ def client():
1414
{%- for endpoint, method in endpoints.items() %}
1515

1616

17-
def test_{{endpoint}}(client):
18-
response = client.{{method}}("/{{controller_name}}/{{endpoint}}")
17+
def test_{{ endpoint.lower().replace('-','_') }}(client):
18+
response = client.{{ method.lower() }}("/{{ controller_name }}/{{ endpoint.lower().replace('-','_') }}")
1919
assert response.status_code == 200
2020
assert response.json() == {"hello": "world"}
2121

template/{{package_name}}/app/controllers/{{controller_name}}.py.jinja

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ log = logging.getLogger(__name__)
1111
{%- for endpoint, method in endpoints.items() %}
1212

1313

14-
@router.{{ method }}(
15-
"/{{ endpoint }}",
14+
@router.{{ method.lower() }}(
15+
"/{{ endpoint.lower().replace('-','_') }}",
1616
status_code=200,
1717
# Decorator options:
1818
# https://fastapi.tiangolo.com/tutorial/path-operation-configuration/
1919
)
20-
async def {{ endpoint }}():
20+
async def {{ endpoint.lower().replace('-','_') }}():
2121
# Implement endpoint logic here.
2222
return {"hello": "world"}
2323

0 commit comments

Comments
 (0)