Fix unit tests

This commit is contained in:
Daniel Egger 2024-07-25 11:26:10 +02:00 committed by Christian Cueni
parent 0c5e48aa30
commit 418eba5623
2 changed files with 7 additions and 1 deletions

View File

@ -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)

View File

@ -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)