Skip to content

Commit 7040db0

Browse files
committed
fix: PR review 반영
1 parent 5e03f1b commit 7040db0

File tree

8 files changed

+98
-122
lines changed

8 files changed

+98
-122
lines changed

.pre-commit-config.yaml

Lines changed: 76 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -1,81 +1,84 @@
11
# See https://pre-commit.com for more information
22
# See https://pre-commit.com/hooks.html for more hooks
33
default_language_version:
4-
python: python3.12
4+
python: python3.12
55
default_stages: [pre-commit, pre-push]
66
repos:
7-
- repo: https://github.com/pre-commit/pre-commit-hooks
8-
rev: v5.0.0
9-
hooks:
10-
- id: check-toml
11-
- id: check-xml
12-
- id: check-yaml
13-
- id: check-added-large-files
14-
- id: detect-aws-credentials
15-
args:
16-
- --allow-missing-credentials
17-
- id: end-of-file-fixer
18-
- id: mixed-line-ending
19-
- id: pretty-format-json
20-
args:
21-
- --autofix
22-
- id: trailing-whitespace
23-
exclude_types:
24-
- javascript
25-
- markdown
26-
- repo: https://github.com/PyCQA/flake8
27-
rev: 7.2.0
28-
hooks:
29-
- id: flake8
30-
additional_dependencies:
31-
- flake8-bugbear
32-
- flake8-noqa
33-
args:
34-
- --max-line-length=120
35-
- --max-complexity=18
36-
- repo: https://github.com/psf/black
37-
rev: 25.1.0
38-
hooks:
39-
- id: black
40-
language_version: python3.12
41-
args:
42-
- --line-length=120
43-
- repo: https://github.com/PyCQA/bandit
44-
rev: '1.8.3'
45-
hooks:
46-
- id: bandit
47-
- repo: https://github.com/PyCQA/isort
48-
rev: '6.0.1'
49-
hooks:
50-
- id: isort
51-
- repo: https://github.com/dosisod/refurb
52-
rev: v2.0.0
53-
hooks:
54-
- id: refurb
55-
additional_dependencies:
56-
- boto3
57-
- django-constance
58-
- django-cors-headers
59-
- django-environ
60-
- django-extensions
61-
- django-filter
62-
- django-simple-history
63-
- django-stubs[compatible-mypy]
64-
- drf-spectacular
65-
- drf-standardized-errors
66-
- djangorestframework-stubs[compatible-mypy]
67-
- zappa-django-utils
68-
- repo: https://github.com/astral-sh/uv-pre-commit
69-
rev: 0.6.12
70-
hooks:
71-
- id: uv-lock
72-
- repo: https://github.com/astral-sh/ruff-pre-commit
73-
rev: v0.11.4
74-
hooks:
75-
- id: ruff
76-
args:
77-
- --fix
78-
- id: ruff-format
7+
- repo: https://github.com/pre-commit/pre-commit-hooks
8+
rev: v5.0.0
9+
hooks:
10+
- id: check-toml
11+
- id: check-xml
12+
- id: check-yaml
13+
- id: check-added-large-files
14+
- id: detect-aws-credentials
15+
args:
16+
- --allow-missing-credentials
17+
- id: end-of-file-fixer
18+
- id: mixed-line-ending
19+
- id: pretty-format-json
20+
args:
21+
- --autofix
22+
- id: trailing-whitespace
23+
exclude_types:
24+
- javascript
25+
- markdown
26+
- repo: https://github.com/PyCQA/flake8
27+
rev: 7.2.0
28+
hooks:
29+
- id: flake8
30+
additional_dependencies:
31+
- flake8-bugbear
32+
- flake8-noqa
33+
args:
34+
- --max-line-length=120
35+
- --max-complexity=18
36+
- repo: https://github.com/psf/black
37+
rev: 25.1.0
38+
hooks:
39+
- id: black
40+
language_version: python3.12
41+
args:
42+
- --line-length=120
43+
- repo: https://github.com/PyCQA/bandit
44+
rev: "1.8.3"
45+
hooks:
46+
- id: bandit
47+
args:
48+
- -c
49+
- bandit.yaml
50+
- repo: https://github.com/PyCQA/isort
51+
rev: "6.0.1"
52+
hooks:
53+
- id: isort
54+
- repo: https://github.com/dosisod/refurb
55+
rev: v2.0.0
56+
hooks:
57+
- id: refurb
58+
additional_dependencies:
59+
- boto3
60+
- django-constance
61+
- django-cors-headers
62+
- django-environ
63+
- django-extensions
64+
- django-filter
65+
- django-simple-history
66+
- django-stubs[compatible-mypy]
67+
- drf-spectacular
68+
- drf-standardized-errors
69+
- djangorestframework-stubs[compatible-mypy]
70+
- zappa-django-utils
71+
- repo: https://github.com/astral-sh/uv-pre-commit
72+
rev: 0.6.12
73+
hooks:
74+
- id: uv-lock
75+
- repo: https://github.com/astral-sh/ruff-pre-commit
76+
rev: v0.11.4
77+
hooks:
78+
- id: ruff
79+
args:
80+
- --fix
81+
- id: ruff-format
7982
# - repo: https://github.com/pre-commit/mirrors-mypy
8083
# rev: 'v1.15.0'
8184
# hooks:

app/cms/test/page_api_test.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import http
2+
13
import pytest
24
from django.urls import reverse
35

@@ -8,13 +10,11 @@
810
def test_list_view(api_client, create_page):
911
url = reverse(PAGE_SITEMAP)
1012
response = api_client.get(url)
11-
if response.status_code != 200:
12-
raise Exception("cms Page list API raised error")
13+
assert response.status_code == http.HTTPStatus.OK
1314

1415

1516
@pytest.mark.django_db
1617
def test_retrieve_view(api_client, create_page):
1718
url = reverse(PAGE_SITEMAP)
1819
response = api_client.get(url, kwargs={"pk": create_page.id})
19-
if response.status_code != 200:
20-
raise Exception("cms Page retrieve API raised error")
20+
assert response.status_code == http.HTTPStatus.OK

app/cms/test/sitemap_api_test.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import http
2+
13
import pytest
24
from django.urls import reverse
35

@@ -8,13 +10,13 @@
810
def test_list_view(api_client, create_sitemap):
911
url = reverse(CMS_SITEMAP)
1012
response = api_client.get(url)
11-
if response.status_code != 200:
13+
if response.status_code != http.HTTPStatus.OK:
1214
raise Exception("cms Sitemap list API raised error")
1315

1416

1517
@pytest.mark.django_db
1618
def test_retrieve_view(api_client, create_sitemap):
1719
url = reverse(CMS_SITEMAP)
1820
response = api_client.get(url, kwargs={"pk": create_sitemap.id})
19-
if response.status_code != 200:
21+
if response.status_code != http.HTTPStatus.OK:
2022
raise Exception("cms Sitemap retrieve API raised error")

app/cms/urls.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,11 @@
1616
"""
1717

1818
from cms import views
19-
from django.urls import path
19+
from django.urls import include, path
20+
from rest_framework import routers
2021

21-
urlpatterns = [
22-
path("sitemap/", views.SitemapListRetrieveViewSet.as_view({"get": "list"}), name="cms-sitemap"),
23-
path("page/", views.PageListRetrieveViewSet.as_view({"get": "list"}), name="cms-page"),
24-
]
22+
cms_router = routers.SimpleRouter()
23+
cms_router.register("sitemap/", views.SitemapListRetrieveViewSet, base_name="cms-sitemap")
24+
cms_router.register("page/", views.PageListRetrieveViewSet, base_name="cms-page")
25+
26+
urlpatterns = [path("", include(cms_router.urls))]

app/core/urls.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
from django.urls import include, path, re_path, resolvers
2323
from drf_spectacular.views import SpectacularAPIView, SpectacularSwaggerView
2424

25-
v1_apis: list[resolvers.URLPattern | resolvers.URLResolver] = [] # type: ignore[assignment]
25+
# type: ignore[assignment]
26+
v1_apis: list[resolvers.URLPattern | resolvers.URLResolver] = [path("cms/", include("cms.urls"))]
2627

2728
urlpatterns = [
2829
# Health Check
@@ -32,7 +33,6 @@
3233
path("admin/", admin.site.urls),
3334
# V1 API
3435
re_path("^v1/", include((v1_apis, "v1"), namespace="v1")),
35-
path("cms/", include("cms.urls")),
3636
] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
3737

3838
if settings.DEBUG:

bandit.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
assert_used:
2+
skips:
3+
- "test*.py"
4+
- "*_test.py"

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ dependencies = [
2828
"zappa>=0.59.0",
2929
"zappa-django-utils>=0.4.1",
3030
"boto3 (>=1.37.37,<2.0.0)",
31-
"pytest (>=8.3.5,<9.0.0)",
3231
]
3332

3433
[dependency-groups]
@@ -54,6 +53,7 @@ package = false
5453
default-groups = ["dev", "deployment"]
5554

5655
[tool.poetry.group.dev.dependencies]
56+
pytest = ">=8.3.5,<9.0.0"
5757
pytest-django = "^4.11.1"
5858

5959
[build-system]

uv.lock

Lines changed: 0 additions & 35 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)