Merge pull request #15 from cookiecutter/master

update to upstream release `2022.02.16`
This commit is contained in:
Abdullah Adeel 2022-02-17 18:35:40 +05:00 committed by GitHub
commit c73cf8ce51
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 19 additions and 2 deletions

View File

@ -3,6 +3,16 @@ All enhancements and patches to Cookiecutter Django will be documented in this f
<!-- GENERATOR_PLACEHOLDER --> <!-- GENERATOR_PLACEHOLDER -->
## 2022.02.16
### Fixed
- Fix Swagger schema API endpoint &amp; add a test for it ([#3592](https://github.com/cookiecutter/cookiecutter-django/pull/3592))
## 2022.02.15
### Changed
- Update the drf-spectacular local dev server url to use http instead of https ([#3591](https://github.com/cookiecutter/cookiecutter-django/pull/3591))
## 2022.02.13 ## 2022.02.13
### Changed ### Changed

View File

@ -418,7 +418,7 @@ def remove_drf_starter_files():
) )
os.remove( os.remove(
os.path.join( os.path.join(
"{{cookiecutter.project_slug}}", "users", "tests", "test_swagger_ui.py" "{{cookiecutter.project_slug}}", "users", "tests", "test_swagger.py"
) )
) )

View File

@ -5,7 +5,7 @@ except ImportError:
from distutils.core import setup from distutils.core import setup
# We use calendar versioning # We use calendar versioning
version = "2022.02.13" version = "2022.02.16"
with open("README.rst") as readme_file: with open("README.rst") as readme_file:
long_description = readme_file.read() long_description = readme_file.read()

View File

@ -339,6 +339,7 @@ REST_FRAMEWORK = {
"rest_framework.authentication.TokenAuthentication", "rest_framework.authentication.TokenAuthentication",
), ),
"DEFAULT_PERMISSION_CLASSES": ("rest_framework.permissions.IsAuthenticated",), "DEFAULT_PERMISSION_CLASSES": ("rest_framework.permissions.IsAuthenticated",),
"DEFAULT_SCHEMA_CLASS": "drf_spectacular.openapi.AutoSchema",
} }
# django-cors-headers - https://github.com/adamchainz/django-cors-headers#setup # django-cors-headers - https://github.com/adamchainz/django-cors-headers#setup

View File

@ -14,3 +14,9 @@ def test_swagger_ui_not_accessible_by_normal_user(client):
url = reverse("api-docs") url = reverse("api-docs")
response = client.get(url) response = client.get(url)
assert response.status_code == 403 assert response.status_code == 403
def test_api_schema_generated_successfully(admin_client):
url = reverse("api-schema")
response = admin_client.get(url)
assert response.status_code == 200