-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* fix renaming of CORS_ORIGIN_ALLOW_ALL * test * fixed pep Co-authored-by: Giovanni Allegri <[email protected]>
- Loading branch information
1 parent
c2e0828
commit 150fbba
Showing
10 changed files
with
54 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -126,7 +126,7 @@ DEFAULT_FROM_EMAIL='GeoNode <[email protected]>' | |
|
||
# Session/Access Control | ||
LOCKDOWN_GEONODE=False | ||
CORS_ORIGIN_ALLOW_ALL=True | ||
CORS_ALLOW_ALL_ORIGINS=True | ||
X_FRAME_OPTIONS="SAMEORIGIN" | ||
SESSION_EXPIRED_CONTROL_ENABLED=True | ||
DEFAULT_ANONYMOUS_VIEW_PERMISSION=True | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -129,7 +129,7 @@ DEFAULT_FROM_EMAIL='GeoNode <[email protected]>' | |
|
||
# Session/Access Control | ||
LOCKDOWN_GEONODE=False | ||
CORS_ORIGIN_ALLOW_ALL=True | ||
CORS_ALLOW_ALL_ORIGINS=True | ||
X_FRAME_OPTIONS="SAMEORIGIN" | ||
SESSION_EXPIRED_CONTROL_ENABLED=True | ||
DEFAULT_ANONYMOUS_VIEW_PERMISSION=True | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -123,7 +123,7 @@ DEFAULT_FROM_EMAIL='GeoNode <[email protected]>' | |
|
||
# Session/Access Control | ||
LOCKDOWN_GEONODE=False | ||
CORS_ORIGIN_ALLOW_ALL=True | ||
CORS_ALLOW_ALL_ORIGINS=True | ||
X_FRAME_OPTIONS="SAMEORIGIN" | ||
SESSION_EXPIRED_CONTROL_ENABLED=True | ||
DEFAULT_ANONYMOUS_VIEW_PERMISSION=True | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -123,7 +123,7 @@ DEFAULT_FROM_EMAIL='GeoNode <[email protected]>' | |
|
||
# Session/Access Control | ||
LOCKDOWN_GEONODE=False | ||
CORS_ORIGIN_ALLOW_ALL=True | ||
CORS_ALLOW_ALL_ORIGINS=True | ||
X_FRAME_OPTIONS="SAMEORIGIN" | ||
SESSION_EXPIRED_CONTROL_ENABLED=True | ||
DEFAULT_ANONYMOUS_VIEW_PERMISSION=True | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -123,7 +123,7 @@ DEFAULT_FROM_EMAIL='GeoNode <[email protected]>' | |
|
||
# Session/Access Control | ||
LOCKDOWN_GEONODE=False | ||
CORS_ORIGIN_ALLOW_ALL=True | ||
CORS_ALLOW_ALL_ORIGINS=True | ||
X_FRAME_OPTIONS="SAMEORIGIN" | ||
SESSION_EXPIRED_CONTROL_ENABLED=True | ||
DEFAULT_ANONYMOUS_VIEW_PERMISSION=True | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
######################################################################### | ||
# | ||
# Copyright (C) 2022 OSGeo | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
# | ||
######################################################################### | ||
|
||
from django.shortcuts import reverse | ||
from geonode.tests.base import GeoNodeBaseTestSupport | ||
|
||
from corsheaders.middleware import ACCESS_CONTROL_ALLOW_ORIGIN | ||
|
||
|
||
class TestHeaders(GeoNodeBaseTestSupport): | ||
|
||
def test_cors_headers(self): | ||
categories_url = reverse('categories-list') | ||
headers = { | ||
'HTTP_ORIGIN': "http://127.0.0.1" | ||
} | ||
with self.settings(CORS_ALLOW_ALL_ORIGINS=True, CORS_ALLOW_CREDENTIALS=False): | ||
response = self.client.get( | ||
categories_url, | ||
**headers | ||
) | ||
self.assertEqual(response[ACCESS_CONTROL_ALLOW_ORIGIN], '*') | ||
|
||
with self.settings(CORS_ALLOW_ALL_ORIGINS=False): | ||
response = self.client.get( | ||
categories_url, | ||
**headers | ||
) | ||
self.assertIsNone(getattr(response, 'ACCESS_CONTROL_ALLOW_ORIGIN', None)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters