Stripe in Blender Studio #93018
@ -27,7 +27,7 @@ class AbstractBaseTestCase(TestCase):
|
||||
|
||||
class AbstractLooperTestCase(AbstractBaseTestCase):
|
||||
log = log.getChild('AbstractLooperTestCase')
|
||||
fixtures = ['devfund', 'testuser', 'systemuser']
|
||||
fixtures = ['gateways', 'devfund', 'testuser', 'systemuser']
|
||||
valid_payload = {
|
||||
'gateway': 'stripe',
|
||||
'email': 'erik@example.com',
|
||||
@ -79,7 +79,7 @@ class AbstractLooperTestCase(AbstractBaseTestCase):
|
||||
self.pay_meth = self.user.customer.payment_method_default
|
||||
|
||||
def create_accountless_customer(self):
|
||||
self.accountless_customer = Customer.objects.create()
|
||||
self.accountless_customer = Customer.objects.create(user=None)
|
||||
self.accountless_customer.billing_address.save()
|
||||
gw = self._get_test_gateway()
|
||||
if gw:
|
||||
|
@ -10,12 +10,11 @@ import looper.taxes
|
||||
User = get_user_model()
|
||||
|
||||
|
||||
@factory.django.mute_signals(signals.pre_save, signals.post_save)
|
||||
class UserFactory(DjangoModelFactory):
|
||||
class Meta:
|
||||
model = User
|
||||
|
||||
id = factory.Sequence(lambda n: 1000 + n)
|
||||
|
||||
first_name = factory.Faker('first_name')
|
||||
last_name = factory.Faker('last_name')
|
||||
username = factory.LazyAttribute(lambda o: f'{o.first_name}_{o.last_name}')
|
||||
@ -30,6 +29,8 @@ class CustomerFactory(DjangoModelFactory):
|
||||
class Meta:
|
||||
model = looper.models.Customer
|
||||
|
||||
user = factory.SubFactory(UserFactory)
|
||||
|
||||
|
||||
class PaymentMethodFactory(DjangoModelFactory):
|
||||
class Meta:
|
||||
@ -58,6 +59,7 @@ class SubscriptionFactory(DjangoModelFactory):
|
||||
class Meta:
|
||||
model = looper.models.Subscription
|
||||
|
||||
customer = factory.SubFactory(CustomerFactory)
|
||||
plan = factory.SubFactory(PlanFactory)
|
||||
payment_method = factory.SubFactory(PaymentMethodFactory)
|
||||
|
||||
|
@ -22,7 +22,7 @@ CHECKOUT = 'looper-braintree:checkout'
|
||||
# Prevent communication with Google's reCAPTCHA API.
|
||||
@override_settings(GOOGLE_RECAPTCHA_SECRET_KEY='')
|
||||
class AbstractCheckoutTestCase(AbstractLooperTestCase):
|
||||
fixtures = ['devfund', 'testuser', 'systemuser']
|
||||
fixtures = ['gateways', 'devfund', 'testuser', 'systemuser']
|
||||
checkout_url = reverse_lazy(CHECKOUT, kwargs={'plan_id': 2, 'plan_variation_id': 5})
|
||||
|
||||
def setUp(self):
|
||||
|
@ -15,7 +15,7 @@ User = get_user_model()
|
||||
|
||||
|
||||
class _BaseTestCase(AbstractLooperTestCase):
|
||||
fixtures = ['devfund', 'testuser', 'systemuser']
|
||||
fixtures = ['gateways', 'devfund', 'testuser', 'systemuser']
|
||||
checkout_url = reverse_lazy('looper:checkout', kwargs={'plan_id': 2, 'plan_variation_id': 5})
|
||||
gateway_name = 'stripe'
|
||||
|
||||
|
@ -19,7 +19,7 @@ from looper.tests.factories import (
|
||||
|
||||
@mock.patch('looper.gateways.stripe.webhook.WebhookSignature.verify_header', return_value=True)
|
||||
class ClockForStripe(ResponsesMixin, TestCase):
|
||||
fixtures = ['devfund', 'systemuser']
|
||||
fixtures = ['gateways', 'devfund', 'systemuser']
|
||||
responses_files = ['clock_stripe.yaml']
|
||||
|
||||
# @_recorder.record(file_path=f'{ResponsesMixin.responses_file_path}/clock_stripe.yaml')
|
||||
|
@ -116,7 +116,7 @@ class BraintreeErrorTest(AbstractBaseTestCase):
|
||||
|
||||
|
||||
class BankGatewayTest(AbstractBaseTestCase):
|
||||
fixtures = ['testuser', 'devfund']
|
||||
fixtures = ['testuser', 'gateways', 'devfund']
|
||||
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
|
@ -10,7 +10,7 @@ from . import AbstractLooperTestCase, AbstractBaseTestCase
|
||||
|
||||
|
||||
class MoneyFieldTest(AbstractBaseTestCase):
|
||||
fixtures = ['testuser', 'devfund', 'systemuser']
|
||||
fixtures = ['testuser', 'gateways', 'devfund', 'systemuser']
|
||||
|
||||
def test_create_instance(self):
|
||||
pv = models.PlanVariation(plan_id=1, currency='EUR', price=Money('EUR', 155))
|
||||
|
@ -15,7 +15,7 @@ User = get_user_model()
|
||||
|
||||
|
||||
class _BaseTestCase(AbstractLooperTestCase):
|
||||
fixtures = ['devfund', 'testuser', 'systemuser']
|
||||
fixtures = ['gateways', 'devfund', 'testuser', 'systemuser']
|
||||
gateway_name = 'stripe'
|
||||
subscription = None
|
||||
|
||||
|
@ -6,7 +6,7 @@ from ..money import Money
|
||||
|
||||
|
||||
class PlanVariationModelTestCase(django.test.TestCase):
|
||||
fixtures = ['devfund']
|
||||
fixtures = ['gateways', 'devfund']
|
||||
|
||||
def setUp(self):
|
||||
product = Product.objects.create(name='Ежедневный Пророк')
|
||||
@ -29,7 +29,7 @@ class PlanVariationModelTestCase(django.test.TestCase):
|
||||
|
||||
|
||||
class PlanVariationTest(django.test.TestCase):
|
||||
fixtures = ['devfund']
|
||||
fixtures = ['gateways', 'devfund']
|
||||
|
||||
def test_variation_for_currency(self):
|
||||
plan = Plan.objects.get(pk=1)
|
||||
|
@ -35,7 +35,7 @@ event_payload_cc = {
|
||||
|
||||
@mock.patch('looper.gateways.stripe.webhook.WebhookSignature.verify_header', return_value=True)
|
||||
class UpsertOrderFromPaymentIntentAndProduct(ResponsesMixin, TestCase):
|
||||
fixtures = ['devfund', 'systemuser']
|
||||
fixtures = ['gateways', 'devfund', 'systemuser']
|
||||
responses_files = [
|
||||
'payment_intent__card.yaml',
|
||||
'payment_intent__ideal.yaml',
|
||||
@ -452,7 +452,7 @@ class UpsertOrderFromPaymentIntentAndProduct(ResponsesMixin, TestCase):
|
||||
|
||||
|
||||
class TestCheckoutPlanVariationAnonymous(ResponsesMixin, TestCase):
|
||||
fixtures = ['devfund', 'systemuser']
|
||||
fixtures = ['gateways', 'devfund', 'systemuser']
|
||||
responses_files = [
|
||||
'checkout_plan_variation_anonymous.yaml',
|
||||
'checkout_plan_variation_webhook.yaml',
|
||||
@ -535,7 +535,7 @@ class TestCheckoutPlanVariationAnonymous(ResponsesMixin, TestCase):
|
||||
|
||||
|
||||
class TestCheckoutPlanVariationLoggedIn(ResponsesMixin, TestCase):
|
||||
fixtures = ['devfund', 'systemuser']
|
||||
fixtures = ['gateways', 'devfund', 'systemuser']
|
||||
responses_files = [
|
||||
'checkout_plan_variation_logged_in.yaml',
|
||||
]
|
||||
|
Loading…
Reference in New Issue
Block a user