Fix functional tests
This commit is contained in:
parent
9696af6b67
commit
6141468f21
19
src/core/fixtures/shipping_rates.json
Normal file
19
src/core/fixtures/shipping_rates.json
Normal file
@ -0,0 +1,19 @@
|
||||
[{
|
||||
"model": "core.shippingrate",
|
||||
"pk": 1,
|
||||
"fields": {
|
||||
"shipping_provider": "USPS",
|
||||
"name": "Variable",
|
||||
"container": "VARIABLE",
|
||||
"min_order_weight": null,
|
||||
"max_order_weight": null,
|
||||
"is_selectable": false
|
||||
}
|
||||
}, {
|
||||
"model": "core.sitesettings",
|
||||
"pk": 1,
|
||||
"fields": {
|
||||
"usps_user_id": "012BETTE1249",
|
||||
"default_shipping_rate": 1
|
||||
}
|
||||
}]
|
||||
@ -12,7 +12,7 @@ from django.contrib.staticfiles.testing import StaticLiveServerTestCase
|
||||
|
||||
|
||||
class AddressTests(StaticLiveServerTestCase):
|
||||
fixtures = ['products.json']
|
||||
fixtures = ['shipping_rates.json', 'products.json']
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
|
||||
@ -19,7 +19,9 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class CouponTests(StaticLiveServerTestCase):
|
||||
fixtures = ['products.json', 'accounts.json', 'coupons.json']
|
||||
fixtures = [
|
||||
'shipping_rates.json', 'products.json', 'accounts.json', 'coupons.json'
|
||||
]
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
@ -87,7 +89,8 @@ class CouponTests(StaticLiveServerTestCase):
|
||||
state_select.select_by_value('UT')
|
||||
postal_code_input = self.browser.find_element(By.NAME, 'postal_code')
|
||||
postal_code_input.send_keys('84321')
|
||||
self.browser.find_element(By.XPATH,
|
||||
self.browser.find_element(
|
||||
By.XPATH,
|
||||
'//input[@value="Continue"]'
|
||||
).click()
|
||||
|
||||
@ -106,7 +109,8 @@ class CouponTests(StaticLiveServerTestCase):
|
||||
def test_apply_used_coupon_to_order_returns_message(self):
|
||||
# Add item to cart
|
||||
self.browser.get(self.live_server_url + '/products/1/')
|
||||
self.browser.find_element(By.XPATH,
|
||||
self.browser.find_element(
|
||||
By.XPATH,
|
||||
'//input[@value="Add to cart"]'
|
||||
).click()
|
||||
self.assertEqual(
|
||||
@ -118,7 +122,8 @@ class CouponTests(StaticLiveServerTestCase):
|
||||
coupon_input = self.browser.find_element(By.ID, 'id_code')
|
||||
coupon_input.send_keys('MAY2022')
|
||||
self.browser.find_element(By.XPATH, '//input[@value="Apply"]').click()
|
||||
self.browser.find_element(By.XPATH,
|
||||
self.browser.find_element(
|
||||
By.XPATH,
|
||||
'//a[contains(text(), "Proceed to Checkout")]'
|
||||
).click()
|
||||
|
||||
|
||||
@ -99,6 +99,15 @@ WSGI_APPLICATION = 'ptcoffee.wsgi.application'
|
||||
# Database
|
||||
# https://docs.djangoproject.com/en/3.2/ref/settings/#databases
|
||||
|
||||
if DEBUG:
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.postgresql',
|
||||
'USER': 'django',
|
||||
'NAME': 'ptcoffee_dev',
|
||||
},
|
||||
}
|
||||
else:
|
||||
DATABASES = {
|
||||
'default': DATABASE_CONFIG
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user