diff --git a/server/vbv_lernwelt/shop/tests/test_checkout_api.py b/server/vbv_lernwelt/shop/tests/test_checkout_api.py index f5f46b37..23a8bac2 100644 --- a/server/vbv_lernwelt/shop/tests/test_checkout_api.py +++ b/server/vbv_lernwelt/shop/tests/test_checkout_api.py @@ -6,6 +6,8 @@ from rest_framework.test import APITestCase from vbv_lernwelt.core.admin import User from vbv_lernwelt.core.model_utils import add_countries +from vbv_lernwelt.learnpath.consts import COURSE_PROFILE_ALL_CODE, COURSE_PROFILE_ALL_ID +from vbv_lernwelt.learnpath.models import CourseProfile from vbv_lernwelt.shop.const import VV_DE_PRODUCT_SKU from vbv_lernwelt.shop.models import CheckoutInformation, CheckoutState, Product from vbv_lernwelt.shop.services import InitTransactionException @@ -50,6 +52,10 @@ class CheckoutAPITestCase(APITestCase): is_active=True, ) + CourseProfile.objects.get_or_create( + id=COURSE_PROFILE_ALL_ID, code=COURSE_PROFILE_ALL_CODE + ) + self.client.login(username=USER_USERNAME, password=USER_PASSWORD) add_countries(small_set=True) diff --git a/server/vbv_lernwelt/shop/views.py b/server/vbv_lernwelt/shop/views.py index ea752b23..7a660f9c 100644 --- a/server/vbv_lernwelt/shop/views.py +++ b/server/vbv_lernwelt/shop/views.py @@ -94,7 +94,7 @@ def checkout_vv(request): sku = request.data["product"] base_redirect_url = request.data["redirect_url"] - chosen_profile_id = request.data["chosen_profile"] + chosen_profile_id = request.data.get("chosen_profile", COURSE_PROFILE_ALL_ID) log.info("Checkout requested: sku", user_id=request.user.id, sku=sku)