fix: cleanup
This commit is contained in:
@@ -1,5 +1,3 @@
|
|||||||
import datetime
|
|
||||||
|
|
||||||
from django.utils.text import gettext_lazy as _
|
from django.utils.text import gettext_lazy as _
|
||||||
|
|
||||||
from config.settings.environ import * # noqa
|
from config.settings.environ import * # noqa
|
||||||
@@ -31,7 +29,6 @@ THIRD_PARTY_APPS = [
|
|||||||
'django_extensions',
|
'django_extensions',
|
||||||
'django_filters',
|
'django_filters',
|
||||||
'watchman',
|
'watchman',
|
||||||
'drf_spectacular',
|
|
||||||
'gonk',
|
'gonk',
|
||||||
'rest_framework_simplejwt',
|
'rest_framework_simplejwt',
|
||||||
]
|
]
|
||||||
@@ -134,26 +131,6 @@ STORAGES = {
|
|||||||
'staticfiles': {'BACKEND': 'whitenoise.storage.CompressedManifestStaticFilesStorage'},
|
'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']
|
LOCALE_PATHS = [BASE_DIR / 'locale']
|
||||||
|
|
||||||
if S3_ENABLED:
|
if S3_ENABLED:
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ dependencies = [
|
|||||||
"django-storages==1.13.2",
|
"django-storages==1.13.2",
|
||||||
"django-unfold==0.42.0",
|
"django-unfold==0.42.0",
|
||||||
"django-watchman==1.3.0",
|
"django-watchman==1.3.0",
|
||||||
"djangorestframework==3.15.2",
|
|
||||||
"dj-database-url==1.0.0",
|
"dj-database-url==1.0.0",
|
||||||
"gonk==0.6.1",
|
"gonk==0.6.1",
|
||||||
"ipython==8.16.1",
|
"ipython==8.16.1",
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ django-unfold==0.42.0
|
|||||||
djangorestframework==3.15.2
|
djangorestframework==3.15.2
|
||||||
dj-database-url==1.0.0
|
dj-database-url==1.0.0
|
||||||
djangorestframework-simplejwt==5.4.0
|
djangorestframework-simplejwt==5.4.0
|
||||||
drf-spectacular==0.26.1
|
|
||||||
gonk==0.6.1
|
gonk==0.6.1
|
||||||
ipython==8.16.1
|
ipython==8.16.1
|
||||||
Pillow==11.0.0
|
Pillow==11.0.0
|
||||||
|
|||||||
@@ -1,14 +1,13 @@
|
|||||||
import base64
|
import base64
|
||||||
import json
|
import json
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
|
from django.test import TestCase
|
||||||
from unittest.mock import patch
|
from unittest.mock import patch
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from django.contrib.auth import get_user_model
|
from django.contrib.auth import get_user_model
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
from rest_framework import status
|
|
||||||
from rest_framework.test import APITestCase
|
|
||||||
|
|
||||||
from config.tests.mixins import Response
|
from config.tests.mixins import Response
|
||||||
from shop.exceptions import RedsysPaymentException
|
from shop.exceptions import RedsysPaymentException
|
||||||
@@ -35,7 +34,7 @@ def redsys_response_error(*args, **kwargs):
|
|||||||
return Response(response, status_code=200)
|
return Response(response, status_code=200)
|
||||||
|
|
||||||
|
|
||||||
class TestRedsysTPV(APITestCase, CreateProductsMixin):
|
class TestRedsysTPV(TestCase, CreateProductsMixin):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.tax = Tax.objects.create(code='IVA', value=21)
|
self.tax = Tax.objects.create(code='IVA', value=21)
|
||||||
self.customer = get_user_model().objects.create_user(
|
self.customer = get_user_model().objects.create_user(
|
||||||
@@ -129,7 +128,7 @@ class TestRedsysTPV(APITestCase, CreateProductsMixin):
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
self.order.refresh_from_db()
|
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
|
assert self.order.status == Order.Statuses.STATUS_PAID
|
||||||
|
|
||||||
def test_redsys_webhook_payment_error(self):
|
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()
|
self.order.refresh_from_db()
|
||||||
|
|
||||||
assert self.order.status == Order.Statuses.STATUS_ERROR
|
assert self.order.status == Order.Statuses.STATUS_ERROR
|
||||||
|
|||||||
Reference in New Issue
Block a user