aboutsummaryrefslogtreecommitdiffstats
path: root/pyblackbird_cc
diff options
context:
space:
mode:
authorMatthew Lemon <y@yulqen.org>2024-09-09 16:55:09 +0100
committerMatthew Lemon <y@yulqen.org>2024-09-09 16:55:09 +0100
commit0bef50c8097ab52df424c94176e913dcb1d8f7f5 (patch)
treeb1f92c0958062233a84b788e43b2a49695c1f975 /pyblackbird_cc
parent31966b6cbef88006056db44448cdaf59ba40533e (diff)
Clean up and sort imports
Diffstat (limited to 'pyblackbird_cc')
-rw-r--r--pyblackbird_cc/payments/signals.py7
-rw-r--r--pyblackbird_cc/payments/tests.py3
-rw-r--r--pyblackbird_cc/payments/tests/test_models.py18
3 files changed, 13 insertions, 15 deletions
diff --git a/pyblackbird_cc/payments/signals.py b/pyblackbird_cc/payments/signals.py
index c4cdf1a..e660440 100644
--- a/pyblackbird_cc/payments/signals.py
+++ b/pyblackbird_cc/payments/signals.py
@@ -1,11 +1,12 @@
from datetime import timedelta
from allauth.account.signals import user_signed_up
-from django.dispatch import receiver
from django.db import transaction
+from django.dispatch import receiver
from django.utils import timezone
-from .models import SubscriptionPlan, Subscription
+from .models import Subscription
+from .models import SubscriptionPlan
@receiver(user_signed_up)
@@ -18,7 +19,7 @@ def assign_default_subscription(sender, request, user, **kwargs):
"price": 0,
"description": "Free plan description",
"allowed_downloads": 10,
- }
+ },
)
# Create a SubscriptionPlan for the new user
diff --git a/pyblackbird_cc/payments/tests.py b/pyblackbird_cc/payments/tests.py
deleted file mode 100644
index 7ce503c..0000000
--- a/pyblackbird_cc/payments/tests.py
+++ /dev/null
@@ -1,3 +0,0 @@
-from django.test import TestCase
-
-# Create your tests here.
diff --git a/pyblackbird_cc/payments/tests/test_models.py b/pyblackbird_cc/payments/tests/test_models.py
index 342ff14..132d025 100644
--- a/pyblackbird_cc/payments/tests/test_models.py
+++ b/pyblackbird_cc/payments/tests/test_models.py
@@ -3,16 +3,16 @@ from allauth.account.signals import user_signed_up
from django.contrib.auth import get_user_model
from django.test import RequestFactory
-from pyblackbird_cc.payments.models import SubscriptionPlan, Subscription
+from pyblackbird_cc.payments.models import Subscription
+from pyblackbird_cc.payments.models import SubscriptionPlan
User = get_user_model()
+
@pytest.fixture
def user_data():
- return {
- 'email': 'testuser@example.com',
- 'password': 'testpassword123'
- }
+ return {"email": "testuser@example.com", "password": "testpassword123"}
+
@pytest.mark.django_db
def test_user_signup_assigns_free_subscription(user_data):
@@ -23,11 +23,11 @@ def test_user_signup_assigns_free_subscription(user_data):
"price": 0,
"description": "Free plan description",
"allowed_downloads": 10,
- }
- ) # Create a new user
+ },
+ ) # Create a new user
user = User.objects.create_user(**user_data)
# Manually trigger the user_signed_up signal
- request = RequestFactory().get('/')
+ request = RequestFactory().get("/")
user_signed_up.send(sender=user.__class__, request=request, user=user)
# Check if a SubscriptionPlan was created for the user
@@ -38,4 +38,4 @@ def test_user_signup_assigns_free_subscription(user_data):
assert subscription.plan == free_plan
# Additional assertions can be added here to check other properties
- # of the SubscriptionPlan or Subscription as needed \ No newline at end of file
+ # of the SubscriptionPlan or Subscription as needed