From 5f52959a20d89ebb82bc40eae03fc758dbd03861 Mon Sep 17 00:00:00 2001 From: Pablo Moreno Date: Fri, 20 Mar 2026 10:30:52 +0100 Subject: [PATCH] fix: cleanup --- config/settings/base.py | 23 ----------------------- pyproject.toml | 1 - requirements.txt | 1 - shop/tests/test_redsys.py | 9 ++++----- 4 files changed, 4 insertions(+), 30 deletions(-) diff --git a/config/settings/base.py b/config/settings/base.py index 146b455..ee62ed1 100644 --- a/config/settings/base.py +++ b/config/settings/base.py @@ -1,5 +1,3 @@ -import datetime - from django.utils.text import gettext_lazy as _ from config.settings.environ import * # noqa @@ -31,7 +29,6 @@ THIRD_PARTY_APPS = [ 'django_extensions', 'django_filters', 'watchman', - 'drf_spectacular', 'gonk', 'rest_framework_simplejwt', ] @@ -134,26 +131,6 @@ STORAGES = { 'staticfiles': {'BACKEND': 'whitenoise.storage.CompressedManifestStaticFilesStorage'}, } - -# Django Rest Framework Configuration -REST_FRAMEWORK = { - 'DEFAULT_PERMISSION_CLASSES': ('rest_framework.permissions.IsAuthenticated',), - 'DEFAULT_AUTHENTICATION_CLASSES': ( - 'rest_framework_simplejwt.authentication.JWTAuthentication', - 'rest_framework.authentication.SessionAuthentication', - 'rest_framework.authentication.BasicAuthentication', - ), - 'DEFAULT_RENDERER_CLASSES': ('rest_framework.renderers.JSONRenderer',), - 'DEFAULT_FILTER_BACKENDS': [ - 'rest_framework.filters.OrderingFilter', - 'django_filters.rest_framework.DjangoFilterBackend', - 'rest_framework.filters.SearchFilter', - ], - 'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.PageNumberPagination', - 'DEFAULT_SCHEMA_CLASS': 'drf_spectacular.openapi.AutoSchema', - 'PAGE_SIZE': PAGE_SIZE, -} - LOCALE_PATHS = [BASE_DIR / 'locale'] if S3_ENABLED: diff --git a/pyproject.toml b/pyproject.toml index 5c71424..4974a7b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -20,7 +20,6 @@ dependencies = [ "django-storages==1.13.2", "django-unfold==0.42.0", "django-watchman==1.3.0", - "djangorestframework==3.15.2", "dj-database-url==1.0.0", "gonk==0.6.1", "ipython==8.16.1", diff --git a/requirements.txt b/requirements.txt index 2361d4f..4e5d178 100644 --- a/requirements.txt +++ b/requirements.txt @@ -15,7 +15,6 @@ django-unfold==0.42.0 djangorestframework==3.15.2 dj-database-url==1.0.0 djangorestframework-simplejwt==5.4.0 -drf-spectacular==0.26.1 gonk==0.6.1 ipython==8.16.1 Pillow==11.0.0 diff --git a/shop/tests/test_redsys.py b/shop/tests/test_redsys.py index 3ab170c..192497d 100644 --- a/shop/tests/test_redsys.py +++ b/shop/tests/test_redsys.py @@ -1,14 +1,13 @@ import base64 import json from decimal import Decimal +from django.test import TestCase from unittest.mock import patch import pytest from django.contrib.auth import get_user_model from django.urls import reverse from django.utils import timezone -from rest_framework import status -from rest_framework.test import APITestCase from config.tests.mixins import Response from shop.exceptions import RedsysPaymentException @@ -35,7 +34,7 @@ def redsys_response_error(*args, **kwargs): return Response(response, status_code=200) -class TestRedsysTPV(APITestCase, CreateProductsMixin): +class TestRedsysTPV(TestCase, CreateProductsMixin): def setUp(self): self.tax = Tax.objects.create(code='IVA', value=21) self.customer = get_user_model().objects.create_user( @@ -129,7 +128,7 @@ class TestRedsysTPV(APITestCase, CreateProductsMixin): }, ) self.order.refresh_from_db() - assert response.status_code == status.HTTP_200_OK + assert response.status_code == 200 assert self.order.status == Order.Statuses.STATUS_PAID def test_redsys_webhook_payment_error(self): @@ -167,7 +166,7 @@ class TestRedsysTPV(APITestCase, CreateProductsMixin): }, ) - assert response.status_code == status.HTTP_409_CONFLICT + assert response.status_code == 409 self.order.refresh_from_db() assert self.order.status == Order.Statuses.STATUS_ERROR