chore: formatted stuff
This commit is contained in:
@@ -5,11 +5,14 @@ from django.urls import reverse
|
||||
from rest_framework import status
|
||||
from rest_framework.test import APITestCase
|
||||
from django.conf import settings
|
||||
from django.utils import timezone
|
||||
|
||||
from tpv.models import PaymentTransaction
|
||||
from tpv.redsys import RedsysClient
|
||||
from tpv.settings import ERROR_CODES
|
||||
|
||||
from tpv.utils import validate_expiry_date
|
||||
|
||||
|
||||
class TestRedsysTPV(APITestCase):
|
||||
def test_redsys_client(self):
|
||||
@@ -179,3 +182,14 @@ class TestRedsysTPV(APITestCase):
|
||||
reverse("tpv:ko", kwargs={"transaction": transaction.hash})
|
||||
)
|
||||
assert response.status_code == status.HTTP_200_OK
|
||||
|
||||
def test_expiry_date(self):
|
||||
now = timezone.now()
|
||||
previous_year = str(now.year - 1).rjust(2, "0")
|
||||
current_month = str(now.month).rjust(2, "0")
|
||||
current_year = str(now.year)[-2:]
|
||||
|
||||
assert not validate_expiry_date("042024")
|
||||
assert not validate_expiry_date(f"{previous_year}{current_month}")
|
||||
|
||||
assert validate_expiry_date(f"{current_year}{current_month}")
|
||||
|
||||
Reference in New Issue
Block a user