33 lines
1.2 KiB
Python
33 lines
1.2 KiB
Python
import logging
|
|
from decimal import Decimal
|
|
|
|
from django.test import TestCase, Client, RequestFactory
|
|
from django.urls import reverse
|
|
from django.conf import settings
|
|
from measurement.measures import Weight
|
|
from paypalcheckoutsdk.orders import OrdersCreateRequest, OrdersCaptureRequest
|
|
from paypalcheckoutsdk.core import PayPalHttpClient, SandboxEnvironment
|
|
|
|
from accounts.models import User, Address
|
|
from core.models import Product, Order
|
|
from core import CoffeeGrind
|
|
from storefront.forms import AddressForm, OrderCreateForm
|
|
from storefront.views import OrderCreateView, CheckoutAddressView
|
|
from storefront.cart import Cart
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
class CheckoutAddressViewTest(TestCase):
|
|
def setUp(self):
|
|
self.client = Client()
|
|
|
|
def test_view_uses_correct_template(self):
|
|
response = self.client.get(reverse('storefront:checkout-address'))
|
|
self.assertEqual(response.status_code, 200)
|
|
self.assertTemplateUsed(response, 'storefront/checkout_address.html')
|
|
|
|
def test_view_has_correct_form(self):
|
|
response = self.client.get(reverse('storefront:checkout-address'))
|
|
self.assertTrue(response.context['form'])
|
|
self.assertTrue(isinstance(response.context['form'], AddressForm))
|