Как использовать тест Pyunit для моего кода?
class CheckoutView (CreateView): template_name = "checkout.html"
def checkout(request):
if request.user.is_authenticated:
customer = request.user
cart, created = 'Cart'.objects.get_or_create(owner=customer, completed = False)
cartitems = cart.cartitems_set.all()
else:
cart = []
cartitems = []
cart = {'cartquantity': 0}
context = {'cart': cart, 'cartitems': cartitems}
return render(request, 'cart/checkout.html', context)
Это мой код для проверки и мне нужен модульный тест для этого, используя pyunit test я пытался, но не смог, поэтому мне нужна помощь