Skip to content

Commit 0ab5847

Browse files
authored
Remove forbidden headers from tests (#855)
1 parent 01a7beb commit 0ab5847

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

tests/test_middleware.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,11 @@ def test_file_in_allowed_origins(self):
7373

7474
@override_settings(
7575
CORS_ALLOW_ALL_ORIGINS=True,
76-
CORS_EXPOSE_HEADERS=["accept", "origin", "content-type"],
76+
CORS_EXPOSE_HEADERS=["accept", "content-type"],
7777
)
7878
def test_get_expose_headers(self):
7979
resp = self.client.get("/", HTTP_ORIGIN="http://example.com")
80-
assert resp[ACCESS_CONTROL_EXPOSE_HEADERS] == "accept, origin, content-type"
80+
assert resp[ACCESS_CONTROL_EXPOSE_HEADERS] == "accept, content-type"
8181

8282
@override_settings(CORS_ALLOW_ALL_ORIGINS=True)
8383
def test_get_dont_expose_headers(self):
@@ -95,7 +95,7 @@ def test_get_dont_allow_credentials(self):
9595
assert ACCESS_CONTROL_ALLOW_CREDENTIALS not in resp
9696

9797
@override_settings(
98-
CORS_ALLOW_HEADERS=["content-type", "origin"],
98+
CORS_ALLOW_HEADERS=["content-type"],
9999
CORS_ALLOW_METHODS=["GET", "OPTIONS"],
100100
CORS_PREFLIGHT_MAX_AGE=1002,
101101
CORS_ALLOW_ALL_ORIGINS=True,
@@ -107,12 +107,12 @@ def test_options_allowed_origin(self):
107107
HTTP_ACCESS_CONTROL_REQUEST_METHOD="GET",
108108
)
109109
assert resp.status_code == HTTPStatus.OK
110-
assert resp[ACCESS_CONTROL_ALLOW_HEADERS] == "content-type, origin"
110+
assert resp[ACCESS_CONTROL_ALLOW_HEADERS] == "content-type"
111111
assert resp[ACCESS_CONTROL_ALLOW_METHODS] == "GET, OPTIONS"
112112
assert resp[ACCESS_CONTROL_MAX_AGE] == "1002"
113113

114114
@override_settings(
115-
CORS_ALLOW_HEADERS=["content-type", "origin"],
115+
CORS_ALLOW_HEADERS=["content-type"],
116116
CORS_ALLOW_METHODS=["GET", "OPTIONS"],
117117
CORS_PREFLIGHT_MAX_AGE=1002,
118118
CORS_ALLOW_ALL_ORIGINS=True,
@@ -124,12 +124,12 @@ async def test_async_options_allowed_origin(self):
124124
access_control_request_method="GET",
125125
)
126126
assert resp.status_code == HTTPStatus.OK
127-
assert resp[ACCESS_CONTROL_ALLOW_HEADERS] == "content-type, origin"
127+
assert resp[ACCESS_CONTROL_ALLOW_HEADERS] == "content-type"
128128
assert resp[ACCESS_CONTROL_ALLOW_METHODS] == "GET, OPTIONS"
129129
assert resp[ACCESS_CONTROL_MAX_AGE] == "1002"
130130

131131
@override_settings(
132-
CORS_ALLOW_HEADERS=["content-type", "origin"],
132+
CORS_ALLOW_HEADERS=["content-type"],
133133
CORS_ALLOW_METHODS=["GET", "OPTIONS"],
134134
CORS_PREFLIGHT_MAX_AGE=0,
135135
CORS_ALLOW_ALL_ORIGINS=True,
@@ -140,7 +140,7 @@ def test_options_no_max_age(self):
140140
HTTP_ORIGIN="http://example.com",
141141
HTTP_ACCESS_CONTROL_REQUEST_METHOD="GET",
142142
)
143-
assert resp[ACCESS_CONTROL_ALLOW_HEADERS] == "content-type, origin"
143+
assert resp[ACCESS_CONTROL_ALLOW_HEADERS] == "content-type"
144144
assert resp[ACCESS_CONTROL_ALLOW_METHODS] == "GET, OPTIONS"
145145
assert ACCESS_CONTROL_MAX_AGE not in resp
146146

0 commit comments

Comments
 (0)