Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,18 @@ repos:
- id: check-toml
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/crate-ci/typos
rev: 6cb49915af2e93e61f5f0d0a82216e28ad5c7c18 # frozen: v1
hooks:
- id: typos
exclude: |
(?x)^(
.*\.min\.css
|.*\.min\.js
|.*\.css\.map
|.*\.js\.map
|.*\.svg
)$
- repo: https://github.com/tox-dev/pyproject-fmt
rev: 57b6ff7bf72affdd12c7f3fd6de761ba18a33b3a # frozen: v2.5.1
hooks:
Expand Down
13 changes: 13 additions & 0 deletions .typos.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Configuration file for 'typos' tool
# https://github.com/crate-ci/typos

[default]
extend-ignore-re = [
# Single line ignore comments
"(?Rm)^.*(#|//)\\s*typos: ignore$",
# Multi-line ignore comments
"(?s)(#|//)\\s*typos: off.*?\\n\\s*(#|//)\\s*typos: on"
]

[default.extend-words]
Yiu = "Yiu"
10 changes: 5 additions & 5 deletions tests/test_middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from corsheaders.middleware import ACCESS_CONTROL_EXPOSE_HEADERS
from corsheaders.middleware import ACCESS_CONTROL_MAX_AGE
from tests.utils import prepend_middleware
from tests.utils import temporary_check_request_hander
from tests.utils import temporary_check_request_handler


class ShortCircuitMiddleware(MiddlewareMixin):
Expand Down Expand Up @@ -333,7 +333,7 @@ def test_signal_handler_that_returns_false(self):
def handler(*args, **kwargs):
return False

with temporary_check_request_hander(handler):
with temporary_check_request_handler(handler):
resp = self.client.options(
"/",
headers={
Expand All @@ -349,7 +349,7 @@ def test_signal_handler_that_returns_true(self):
def handler(*args, **kwargs):
return True

with temporary_check_request_hander(handler):
with temporary_check_request_handler(handler):
resp = self.client.options(
"/",
headers={
Expand All @@ -365,7 +365,7 @@ def test_signal_handler_allow_some_urls_to_everyone(self):
def allow_api_to_all(sender, request, **kwargs):
return request.path.startswith("/api/")

with temporary_check_request_hander(allow_api_to_all):
with temporary_check_request_handler(allow_api_to_all):
resp = self.client.options(
"/",
headers={
Expand Down Expand Up @@ -395,7 +395,7 @@ def allow_all(sender, request, **kwargs):
calls += 1
return True

with temporary_check_request_hander(allow_all):
with temporary_check_request_handler(allow_all):
self.client.get("/", headers={"origin": "https://example.org"})

assert calls == 1
Expand Down
2 changes: 1 addition & 1 deletion tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def prepend_middleware(path: str) -> modify_settings:


@contextmanager
def temporary_check_request_hander(handler: Callable[..., bool]) -> Generator[None]:
def temporary_check_request_handler(handler: Callable[..., bool]) -> Generator[None]:
check_request_enabled.connect(handler)
try:
yield
Expand Down