From 43333515bf4462133c26b3ea995c1c9b3c96118c Mon Sep 17 00:00:00 2001 From: Muhammad Umar Khan Date: Thu, 21 Dec 2023 16:40:30 +0500 Subject: [PATCH] fix: get_response issue for middleware --- ecommerce/extensions/analytics/tests/test_middleware.py | 2 +- ecommerce/extensions/catalogue/models.py | 4 ++-- ecommerce/extensions/partner/apps.py | 4 ++-- ecommerce/extensions/payment/core/tests/test_sdn.py | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ecommerce/extensions/analytics/tests/test_middleware.py b/ecommerce/extensions/analytics/tests/test_middleware.py index 64adfd5ac3d..b37526b63c1 100644 --- a/ecommerce/extensions/analytics/tests/test_middleware.py +++ b/ecommerce/extensions/analytics/tests/test_middleware.py @@ -19,7 +19,7 @@ class TrackingMiddlewareTests(TestCase): def setUp(self): super(TrackingMiddlewareTests, self).setUp() - self.middleware = middleware.TrackingMiddleware() + self.middleware = middleware.TrackingMiddleware(get_response=lambda request: None) self.request_factory = RequestFactory() self.user = self.create_user() diff --git a/ecommerce/extensions/catalogue/models.py b/ecommerce/extensions/catalogue/models.py index 98049598ed7..117d7e246e7 100644 --- a/ecommerce/extensions/catalogue/models.py +++ b/ecommerce/extensions/catalogue/models.py @@ -97,8 +97,8 @@ def is_executive_education_2u_product(self): CertificateType.UNPAID_EXECUTIVE_EDUCATION ] - def save(self, *args, **kwargs): - super(Product, self).save(*args, **kwargs) # pylint: disable=bad-super-call + def clean(self): + super().clean() try: if not isinstance(self.attr.note, str) and self.attr.note is not None: log_message_and_raise_validation_error( diff --git a/ecommerce/extensions/partner/apps.py b/ecommerce/extensions/partner/apps.py index 8d7820235c1..4d867c3f459 100644 --- a/ecommerce/extensions/partner/apps.py +++ b/ecommerce/extensions/partner/apps.py @@ -1,7 +1,7 @@ -from oscar.apps.partner.apps import PartnerConfig as CorePartnerConfig +from oscar.apps.partner import apps -class PartnerConfig(CorePartnerConfig): +class PartnerConfig(apps.PartnerConfig): name = 'ecommerce.extensions.partner' diff --git a/ecommerce/extensions/payment/core/tests/test_sdn.py b/ecommerce/extensions/payment/core/tests/test_sdn.py index 2597a5b9203..00497a261bb 100644 --- a/ecommerce/extensions/payment/core/tests/test_sdn.py +++ b/ecommerce/extensions/payment/core/tests/test_sdn.py @@ -479,7 +479,7 @@ def test_sdn_is_down_sdn_fallback_called( If there is no hit, allow purchase. """ request = RequestFactory().post('/payment/cybersource/submit/') - middleware = SessionMiddleware() + middleware = SessionMiddleware(get_response=lambda request: None) middleware.process_request(request) request.session.save() site_configuration = self.site.siteconfiguration