diff --git a/.ci/docker-compose-ci.yml b/.ci/docker-compose-ci.yml index f28b89dd130..1f47c38a2ff 100644 --- a/.ci/docker-compose-ci.yml +++ b/.ci/docker-compose-ci.yml @@ -3,7 +3,7 @@ version: "2" services: db: - image: mysql:5.7 + image: mysql:8.0 container_name: db command: mysqld --character-set-server=utf8 --collation-server=utf8_general_ci environment: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3a235313a9f..f6933830447 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,13 +12,13 @@ jobs: strategy: matrix: include: - - django-env: django32 + - django-env: django42 testname: quality-and-jobs targets: PYTHON_ENV=py38 requirements.js check_translations_up_to_date validate_translations clean_static static quality validate_js check_keywords - - django-env: django32 + - django-env: django42 testname: test-python targets: PYTHON_ENV=py38 requirements.js clean_static static validate_python - - django-env: django32 + - django-env: django42 testname: acceptance-python targets: PYTHON_ENV=py38 requirements.js clean_static static acceptance diff --git a/Makefile b/Makefile index f12310e0016..58b677bac3a 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ NODE_BIN=./node_modules/.bin DIFF_COVER_BASE_BRANCH=master PYTHON_ENV=py38 -DJANGO_ENV_VAR=$(if $(DJANGO_ENV),$(DJANGO_ENV),django32) +DJANGO_ENV_VAR=$(if $(DJANGO_ENV),$(DJANGO_ENV),django42) help: @echo '' 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 69da12c0210..1dbef563cc0 100644 --- a/ecommerce/extensions/catalogue/models.py +++ b/ecommerce/extensions/catalogue/models.py @@ -98,23 +98,24 @@ def is_executive_education_2u_product(self): ] def save(self, *args, **kwargs): - try: - if not isinstance(self.attr.note, str) and self.attr.note is not None: + if self.id: + try: + if not isinstance(self.attr.note, str) and self.attr.note is not None: + log_message_and_raise_validation_error( + 'Failed to create Product. Product note value must be of type string' + ) + except AttributeError: + pass + + try: + if self.attr.notify_email is not None: + validate_email(self.attr.notify_email) + except ValidationError: log_message_and_raise_validation_error( - 'Failed to create Product. Product note value must be of type string' + 'Notification email must be a valid email address.' ) - except AttributeError: - pass - - try: - if self.attr.notify_email is not None: - validate_email(self.attr.notify_email) - except ValidationError: - log_message_and_raise_validation_error( - 'Notification email must be a valid email address.' - ) - except AttributeError: - pass + except AttributeError: + pass super(Product, self).save(*args, **kwargs) # pylint: disable=bad-super-call 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 diff --git a/ecommerce/extensions/refund/__init__.py b/ecommerce/extensions/refund/__init__.py index 9331f12a300..e69de29bb2d 100644 --- a/ecommerce/extensions/refund/__init__.py +++ b/ecommerce/extensions/refund/__init__.py @@ -1 +0,0 @@ -default_app_config = 'ecommerce.extensions.refund.apps.RefundConfig' # pragma: no cover diff --git a/ecommerce/settings/_oscar.py b/ecommerce/settings/_oscar.py index 6439cc1a069..e85fdd0c0f5 100644 --- a/ecommerce/settings/_oscar.py +++ b/ecommerce/settings/_oscar.py @@ -14,48 +14,48 @@ # APP CONFIGURATION OSCAR_APPS = [ - 'oscar', - 'oscar.apps.address', - 'oscar.apps.shipping', - 'oscar.apps.catalogue.reviews', - 'oscar.apps.search', - 'oscar.apps.wishlists', - - 'ecommerce.extensions', - 'ecommerce.extensions.iap', - 'ecommerce.extensions.api', + "oscar.config.Shop", + "oscar.apps.address.apps.AddressConfig", + 'oscar.apps.shipping.apps.ShippingConfig', + 'oscar.apps.catalogue.reviews.apps.CatalogueReviewsConfig', + "oscar.apps.search.apps.SearchConfig", + "oscar.apps.wishlists.apps.WishlistsConfig", + + 'ecommerce.extensions.config.EdxShop', + 'ecommerce.extensions.iap.apps.IapConfig', + 'ecommerce.extensions.api', # isn't an oscar app 'ecommerce.extensions.communication.apps.CommunicationConfig', - 'ecommerce.extensions.fulfillment', - 'ecommerce.extensions.refund', - 'ecommerce.extensions.analytics', - 'ecommerce.extensions.basket', - 'ecommerce.extensions.catalogue', - 'ecommerce.extensions.checkout', - 'ecommerce.extensions.customer', - 'ecommerce.extensions.offer', - 'ecommerce.extensions.order', - 'ecommerce.extensions.partner', - 'ecommerce.extensions.payment', - 'ecommerce.extensions.voucher', + 'ecommerce.extensions.fulfillment', # isn't an oscar app + 'ecommerce.extensions.refund.apps.RefundConfig', + 'ecommerce.extensions.analytics.apps.AnalyticsConfig', + 'ecommerce.extensions.basket.apps.BasketConfig', + 'ecommerce.extensions.catalogue.apps.CatalogueConfig', + 'ecommerce.extensions.checkout.apps.CheckoutConfig', + 'ecommerce.extensions.customer.apps.CustomerConfig', + 'ecommerce.extensions.offer.apps.OfferConfig', + 'ecommerce.extensions.order.apps.OrderConfig', + 'ecommerce.extensions.partner.apps.PartnerConfig', + 'ecommerce.extensions.payment.apps.PaymentConfig', + 'ecommerce.extensions.voucher.apps.VoucherConfig', # Dashboard applications depend on models declared in the core applications (basket, catalogue, etc). # To prevent issues with Oscar’s dynamic model loading, overrides of dashboard applications should # follow overrides of core applications - 'oscar.apps.dashboard.reports', - 'oscar.apps.dashboard.partners', - 'oscar.apps.dashboard.pages', - 'oscar.apps.dashboard.ranges', - 'oscar.apps.dashboard.reviews', - 'oscar.apps.dashboard.vouchers', - 'oscar.apps.dashboard.communications', - 'oscar.apps.dashboard.shipping', - - 'ecommerce.extensions.dashboard', - 'ecommerce.extensions.dashboard.catalogue', - 'ecommerce.extensions.dashboard.offers', + "oscar.apps.dashboard.reports.apps.ReportsDashboardConfig", + "oscar.apps.dashboard.partners.apps.PartnersDashboardConfig", + "oscar.apps.dashboard.pages.apps.PagesDashboardConfig", + "oscar.apps.dashboard.ranges.apps.RangesDashboardConfig", + 'oscar.apps.dashboard.reviews.apps.ReviewsDashboardConfig', + "oscar.apps.dashboard.vouchers.apps.VouchersDashboardConfig", + "oscar.apps.dashboard.communications.apps.CommunicationsDashboardConfig", + 'oscar.apps.dashboard.shipping.apps.ShippingDashboardConfig', + + 'ecommerce.extensions.dashboard.apps.DashboardConfig', + 'ecommerce.extensions.dashboard.catalogue.apps.CatalogueDashboardConfig', + 'ecommerce.extensions.dashboard.offers.apps.OffersDashboardConfig', 'ecommerce.extensions.dashboard.refunds.apps.RefundsDashboardConfig', # Providing full path to make the signals work - 'ecommerce.extensions.dashboard.orders', - 'ecommerce.extensions.dashboard.users', + 'ecommerce.extensions.dashboard.orders.apps.OrdersDashboardConfig', + 'ecommerce.extensions.dashboard.users.apps.UsersDashboardConfig', # 3rd-party apps that oscar depends on 'haystack', diff --git a/requirements/base.txt b/requirements/base.txt index 830eb584595..ae4caedab7e 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -170,7 +170,7 @@ django-oscar==3.2.2 # via # -c requirements/constraints.txt # -r requirements/base.in -django-phonenumber-field==5.0.0 +django-phonenumber-field==5.1.0 # via django-oscar django-simple-history==3.0.0 # via diff --git a/requirements/dev.txt b/requirements/dev.txt index f9d3fe11abc..ba4d2d369a5 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -254,7 +254,7 @@ django-model-utils==4.3.1 # edx-rbac django-oscar==3.2.2 # via -r requirements/test.txt -django-phonenumber-field==5.0.0 +django-phonenumber-field==5.1.0 # via # -r requirements/test.txt # django-oscar diff --git a/requirements/production.txt b/requirements/production.txt index b4ef294ca00..1220d005df5 100644 --- a/requirements/production.txt +++ b/requirements/production.txt @@ -173,7 +173,7 @@ django-oscar==3.2.2 # via # -c requirements/constraints.txt # -r requirements/base.in -django-phonenumber-field==5.0.0 +django-phonenumber-field==5.1.0 # via django-oscar django-ses==3.5.0 # via -r requirements/production.in diff --git a/requirements/test.txt b/requirements/test.txt index 37b793089e5..d5a7e218965 100644 --- a/requirements/test.txt +++ b/requirements/test.txt @@ -246,7 +246,7 @@ django-oscar==3.2.2 # via # -c requirements/constraints.txt # -r requirements/base.txt -django-phonenumber-field==5.0.0 +django-phonenumber-field==5.1.0 # via # -r requirements/base.txt # django-oscar diff --git a/tox.ini b/tox.ini index f2665c563c3..160e6d9824b 100644 --- a/tox.ini +++ b/tox.ini @@ -1,7 +1,6 @@ [tox] skipsdist=True -envlist = py38-django32-{static,pylint,tests,theme_static,check_keywords},py38-{isort,pycodestyle,extract_translations,dummy_translations,compile_translations, detect_changed_translations,validate_translations},docs - +envlist = py38-django42-{static,pylint,tests,theme_static,check_keywords},py38-{isort,pycodestyle,extract_translations,dummy_translations,compile_translations, detect_changed_translations,validate_translations},docs [pytest] addopts = --ds=ecommerce.settings.test --cov=ecommerce --cov-report term --cov-config=.coveragerc --no-cov-on-fail -p no:randomly --no-migrations -m "not acceptance" testpaths = ecommerce @@ -47,7 +46,7 @@ setenv = SELENIUM_BROWSER=firefox deps = -r{toxinidir}/requirements/test.txt - django32: Django>=3.2,<3.3 + django42: Django>=4.2,<4.3 allowlist_externals = /bin/bash changedir =