Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 0.146.1 #2970

Merged
merged 6 commits into from
May 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions RELEASE.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
Release Notes
=============

Version 0.146.1
---------------

- fix: check for courseware object in cms (#2968)
- chore(deps): update dependency ruff to ^0.4.0 (#2962)
- chore(deps): update nginx docker tag to v1.26.0
- fix(deps): update dependency boto3 to v1.34.96

Version 0.146.0 (Released May 02, 2024)
---------------

Expand Down
1 change: 1 addition & 0 deletions affiliate/api.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Affiliate tracking logic"""

from affiliate.constants import AFFILIATE_QS_PARAM
from affiliate.models import Affiliate
from mitxpro.utils import first_or_none
Expand Down
1 change: 1 addition & 0 deletions affiliate/api_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Affiliate tracking logic"""

import pytest
from django.test.client import RequestFactory

Expand Down
1 change: 1 addition & 0 deletions affiliate/apps.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Apps config for affiliate tracking"""

from django.apps import AppConfig


Expand Down
1 change: 1 addition & 0 deletions affiliate/middleware.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Middleware for affiliate tracking"""

from affiliate.api import get_affiliate_code_from_qstring
from affiliate.constants import AFFILIATE_CODE_SESSION_KEY

Expand Down
1 change: 1 addition & 0 deletions affiliate/middleware_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Affiliate middleware tests"""

from django.contrib.sessions.middleware import SessionMiddleware
from django.test.client import RequestFactory

Expand Down
1 change: 1 addition & 0 deletions affiliate/models.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Model definitions for affiliate tracking"""

from django.conf import settings
from django.db import models

Expand Down
1 change: 1 addition & 0 deletions authentication/api.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Authentication api"""

from importlib import import_module

from django.conf import settings
Expand Down
1 change: 1 addition & 0 deletions authentication/api_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""API tests"""

import pytest
from django.db import IntegrityError

Expand Down
1 change: 1 addition & 0 deletions authentication/apps.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Authentication Apps"""

from django.apps import AppConfig


Expand Down
1 change: 1 addition & 0 deletions authentication/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Authentication exceptions"""

from social_core.exceptions import AuthException


Expand Down
1 change: 1 addition & 0 deletions authentication/middleware.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Authentication middleware"""

from urllib.parse import quote

from django.shortcuts import redirect
Expand Down
1 change: 1 addition & 0 deletions authentication/middleware_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for auth middleware"""

from urllib.parse import quote

from django.contrib.sessions.middleware import SessionMiddleware
Expand Down
1 change: 1 addition & 0 deletions authentication/pipeline/compliance.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Compliance pipeline actions"""

import logging

import pycountry
Expand Down
1 change: 1 addition & 0 deletions authentication/pipeline/compliance_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Compliance pipeline tests"""

import pytest
from social_core.exceptions import AuthException

Expand Down
1 change: 1 addition & 0 deletions authentication/pipeline/user.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Auth pipline functions for user authentication"""

import json
import logging

Expand Down
1 change: 1 addition & 0 deletions authentication/serializers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Authentication serializers"""

import logging

from django.contrib.auth import get_user_model
Expand Down
1 change: 1 addition & 0 deletions authentication/serializers_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Serializers tests"""

import pytest
from rest_framework.serializers import ValidationError
from social_core.backends.email import EmailAuth
Expand Down
1 change: 1 addition & 0 deletions authentication/strategy.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Custom strategy"""

from social_django.strategy import DjangoStrategy


Expand Down
1 change: 1 addition & 0 deletions authentication/strategy_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for the strategy"""

from django.http import HttpRequest
from rest_framework.request import Request

Expand Down
1 change: 1 addition & 0 deletions authentication/urls.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""URL configurations for authentication"""

from django.urls import path
from django.urls.conf import include

Expand Down
1 change: 1 addition & 0 deletions authentication/utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Authentication utils"""

import hashlib

from social_core.utils import get_strategy
Expand Down
1 change: 1 addition & 0 deletions authentication/utils_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Utils tests"""

from authentication.strategy import DjangoRestFrameworkStrategy
from authentication.utils import load_drf_strategy

Expand Down
1 change: 1 addition & 0 deletions authentication/views.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Authentication views"""

from urllib.parse import quote, urlencode, urljoin, urlparse

import requests
Expand Down
43 changes: 26 additions & 17 deletions authentication/views_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for authentication views"""

from contextlib import ExitStack, contextmanager
from unittest.mock import patch

Expand Down Expand Up @@ -105,9 +106,10 @@ def noop():
@contextmanager
def export_check_response(response_name):
"""Context manager for configuring export check responses"""
with override_settings(
**get_cybersource_test_settings()
), responses.RequestsMock() as mocked_responses:
with (
override_settings(**get_cybersource_test_settings()),
responses.RequestsMock() as mocked_responses,
):
mock_cybersource_wsdl(mocked_responses, settings)
mock_cybersource_wsdl_operation(mocked_responses, response_name)
yield
Expand Down Expand Up @@ -264,14 +266,15 @@ def register_email_exists(self, recaptcha_enabled):
def register_email_not_exists_with_recaptcha_invalid(self):
"""Yield a function for this step"""
self.flow_started = True
with patch(
"authentication.views.requests.post",
return_value=MockResponse(
content='{"success": false, "error-codes": ["bad-request"]}',
status_code=status.HTTP_200_OK,
),
) as mock_recaptcha_failure, override_settings(
**{"RECAPTCHA_SITE_KEY": "fakse"}
with (
patch(
"authentication.views.requests.post",
return_value=MockResponse(
content='{"success": false, "error-codes": ["bad-request"]}',
status_code=status.HTTP_200_OK,
),
) as mock_recaptcha_failure,
override_settings(**{"RECAPTCHA_SITE_KEY": "fakse"}),
):
assert_api_call(
self.client,
Expand Down Expand Up @@ -449,9 +452,12 @@ def login_password_user_inactive(self, auth_state, verify_exports):
@rule(auth_state=consumes(LoginPasswordAuthStates))
def login_password_exports_temporary_error(self, auth_state):
"""Login for a user who hasn't been OFAC verified yet"""
with override_settings(**get_cybersource_test_settings()), patch(
"authentication.pipeline.compliance.api.verify_user_with_exports",
side_effect=Exception("register_details_export_temporary_error"),
with (
override_settings(**get_cybersource_test_settings()),
patch(
"authentication.pipeline.compliance.api.verify_user_with_exports",
side_effect=Exception("register_details_export_temporary_error"),
),
):
assert_api_call(
self.client,
Expand Down Expand Up @@ -646,9 +652,12 @@ def register_details_export_reject(self, auth_state):
@rule(auth_state=consumes(ConfirmationRedeemedAuthStates))
def register_details_export_temporary_error(self, auth_state):
"""Complete the register confirmation details page with exports raising a temporary error"""
with override_settings(**get_cybersource_test_settings()), patch(
"authentication.pipeline.compliance.api.verify_user_with_exports",
side_effect=Exception("register_details_export_temporary_error"),
with (
override_settings(**get_cybersource_test_settings()),
patch(
"authentication.pipeline.compliance.api.verify_user_with_exports",
side_effect=Exception("register_details_export_temporary_error"),
),
):
assert_api_call(
self.client,
Expand Down
1 change: 1 addition & 0 deletions b2b_ecommerce/admin_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for admin interface for b2b_ecommerce"""

import pytest

from b2b_ecommerce.admin import B2BCouponAdmin, B2BOrderAdmin
Expand Down
1 change: 1 addition & 0 deletions b2b_ecommerce/api.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Functions for b2b_ecommerce"""

import uuid
from decimal import Decimal

Expand Down
1 change: 1 addition & 0 deletions b2b_ecommerce/api_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for b2b_ecommerce functions"""

from decimal import Decimal

import faker
Expand Down
1 change: 1 addition & 0 deletions b2b_ecommerce/apps.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""b2b_ecommerce app settings"""

from django.apps import AppConfig


Expand Down
1 change: 1 addition & 0 deletions b2b_ecommerce/conftest.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Fixtures for b2b_ecommerce"""

from types import SimpleNamespace

import pytest
Expand Down
1 change: 1 addition & 0 deletions b2b_ecommerce/constants.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
"""Constants for b2b_ecommerce"""

REFERENCE_NUMBER_PREFIX = "xpro-bulk-"
B2B_ORDER_PREFIX = "XPRO-B2BORDER"
1 change: 1 addition & 0 deletions b2b_ecommerce/factories.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Factories for b2b_ecommerce"""

from datetime import timezone

import factory
Expand Down
1 change: 1 addition & 0 deletions b2b_ecommerce/models.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Models for business to business ecommerce"""

import uuid

from django.conf import settings
Expand Down
1 change: 1 addition & 0 deletions b2b_ecommerce/models_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""models for b2b_ecommerce"""

from datetime import timedelta

import pytest
Expand Down
1 change: 1 addition & 0 deletions b2b_ecommerce/signals.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Signals for b2b_ecommerce models"""

from django.db.models.signals import post_save
from django.dispatch import receiver

Expand Down
1 change: 1 addition & 0 deletions b2b_ecommerce/urls.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""URLs for business to business ecommerce"""

from django.urls import path

from b2b_ecommerce.views import (
Expand Down
1 change: 1 addition & 0 deletions b2b_ecommerce/views_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Views for b2b_ecommerce"""

import uuid
from urllib.parse import urlencode, urljoin

Expand Down
1 change: 1 addition & 0 deletions blog/api.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""API for the Blog app"""

import logging

import requests
Expand Down
1 change: 1 addition & 0 deletions blog/api_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for Blog API"""

import pytest

from blog.api import fetch_blog, parse_blog
Expand Down
1 change: 1 addition & 0 deletions cms/api.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""API for the CMS app"""

import itertools
import logging
from datetime import MAXYEAR, datetime, timezone
Expand Down
1 change: 1 addition & 0 deletions cms/api_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for CMS API"""

from datetime import timedelta

import pytest
Expand Down
1 change: 1 addition & 0 deletions cms/blocks.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Wagtail custom blocks for the CMS
"""

from django import forms
from django.apps import apps
from django.core.exceptions import ValidationError
Expand Down
1 change: 1 addition & 0 deletions cms/embeds_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for custom embed providers and finders"""

import pytest
from django.core.exceptions import ImproperlyConfigured
from wagtail.embeds.oembed_providers import vimeo
Expand Down
1 change: 1 addition & 0 deletions cms/factories.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Wagtail page factories"""

import factory
import faker
import wagtail_factories
Expand Down
5 changes: 3 additions & 2 deletions cms/forms.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Custom forms for the cms
"""

from django import forms
from django.contrib.contenttypes.models import ContentType
from wagtail.admin.forms import WagtailAdminPageForm
Expand Down Expand Up @@ -44,12 +45,12 @@ def __init__(self, data=None, files=None, parent_page=None, *args, **kwargs):

instance = kwargs.get("instance", None)
if instance and instance.id:
if instance.is_internal_or_external_course_page:
if instance.is_internal_or_external_course_page and instance.course:
course_runs = instance.course.courseruns.all()
course_run_choices = [("", "")] + [(run.id, run) for run in course_runs]
self.fields["course_run"].choices = course_run_choices

elif instance.is_internal_or_external_program_page:
elif instance.is_internal_or_external_program_page and instance.program:
self.fields["price"].initial = instance.program.current_price

def save(self, commit=True): # noqa: FBT002
Expand Down
1 change: 1 addition & 0 deletions cms/management/commands/configure_wagtail.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Management command to fully configure Wagtail"""

from django.core.management.base import BaseCommand

from cms.api import configure_wagtail
Expand Down
1 change: 1 addition & 0 deletions cms/management/commands/setup_index_pages.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Management command to setup courseware index pages"""

from django.core.management.base import BaseCommand

from cms.api import ensure_index_pages
Expand Down
1 change: 1 addition & 0 deletions cms/migrations/0029_setup_course_program_index_pages.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Data migrations moved to cms/migrations/0046_page_data_migrations.py in response to Page model change
"""

from django.db import migrations


Expand Down
1 change: 1 addition & 0 deletions cms/models.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Page models for the CMS
"""

import re
from collections import defaultdict
from datetime import datetime, timedelta
Expand Down
Loading
Loading