[FIX] website_sale(_stock): move test due to dependency to stock
In odoo@98ca5140baf96, a test using a product of type 'product' was added. Since this type is introduced in stock, stock needs be installed. Since the delivery module was split in saas-16.2 to remove the dependency to stock, this test needs to be moved in website_sale_stock. Build error 48757 closes odoo/odoo#148691 X-original-commit: c517b45eb36b02c2f0679be79da565087c5e48ca Signed-off-by: Vallaeys Valentin (vava) <vava@odoo.com>
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
from unittest.mock import patch
|
||||
|
||||
from odoo.fields import Command
|
||||
from odoo.exceptions import UserError, ValidationError
|
||||
from odoo.exceptions import UserError
|
||||
from odoo.tests import tagged
|
||||
|
||||
from odoo.addons.payment.tests.common import PaymentCommon
|
||||
@@ -110,23 +110,3 @@ class TestWebsiteSaleDeliveryController(PaymentCommon, SaleCommon):
|
||||
self.assertEqual(
|
||||
self.empty_order._get_delivery_methods().mapped('name'), ['Under 300', 'Fixed']
|
||||
)
|
||||
|
||||
def test_validate_payment_with_no_available_delivery_method(self):
|
||||
"""
|
||||
An error should be raised if you try to validate an order with a storable
|
||||
product without any delivery method available
|
||||
"""
|
||||
storable_product = self.env['product.product'].create({
|
||||
'name': 'Storable Product',
|
||||
'sale_ok': True,
|
||||
'type': 'product',
|
||||
'website_published': True,
|
||||
})
|
||||
carriers = self.env['delivery.carrier'].search([])
|
||||
carriers.write({'website_published': False})
|
||||
|
||||
with MockRequest(self.env, website=self.website):
|
||||
self.website.sale_get_order(force_create=True)
|
||||
self.Controller.cart_update_json(product_id=storable_product.id, add_qty=1)
|
||||
with self.assertRaises(ValidationError):
|
||||
self.Controller.shop_payment_validate()
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
from . import test_website_sale_stock_abandoned_cart_email
|
||||
from . import test_website_sale_stock_multilang
|
||||
from . import test_website_sale_stock_product_warehouse
|
||||
from . import test_website_sale_stock_delivery
|
||||
from . import test_website_sale_stock_stock_notification
|
||||
from . import test_website_sale_stock_reorder_from_portal
|
||||
from . import test_website_sale_stock_stock_message
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo.tests import tagged
|
||||
|
||||
from odoo.addons.payment.tests.common import PaymentCommon
|
||||
from odoo.addons.sale.tests.common import SaleCommon
|
||||
from odoo.addons.website.tools import MockRequest
|
||||
from odoo.addons.website_sale.controllers.delivery import WebsiteSaleDelivery
|
||||
from odoo.exceptions import ValidationError
|
||||
|
||||
|
||||
@tagged('post_install', '-at_install')
|
||||
class TestWebsiteSaleStockDeliveryController(PaymentCommon, SaleCommon):
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
self.website = self.env.ref('website.default_website')
|
||||
self.Controller = WebsiteSaleDelivery()
|
||||
|
||||
def test_validate_payment_with_no_available_delivery_method(self):
|
||||
"""
|
||||
An error should be raised if you try to validate an order with a storable
|
||||
product without any delivery method available
|
||||
"""
|
||||
storable_product = self.env['product.product'].create({
|
||||
'name': 'Storable Product',
|
||||
'sale_ok': True,
|
||||
'type': 'product',
|
||||
'website_published': True,
|
||||
})
|
||||
carriers = self.env['delivery.carrier'].search([])
|
||||
carriers.write({'website_published': False})
|
||||
|
||||
with MockRequest(self.env, website=self.website):
|
||||
self.website.sale_get_order(force_create=True)
|
||||
self.Controller.cart_update_json(product_id=storable_product.id, add_qty=1)
|
||||
with self.assertRaises(ValidationError):
|
||||
self.Controller.shop_payment_validate()
|
||||
Reference in New Issue
Block a user