Debian Codegraph @

addons/website_sale_collect/tests/test_in_store_delivery.py

raw symbols SCIP
1 # Part of Odoo. See LICENSE file for full copyright and licensing details.
2
3 from unittest.mock import patch
4 from odoo.tests import tagged
5
6 from odoo.addons.payment.tests.http_common import PaymentHttpCommon
7 from odoo.addons.website_sale_collect.controllers.delivery import InStoreDelivery
8 from odoo.addons.website_sale_collect.tests.common import ClickAndCollectCommon
9
10
11 @tagged('post_install', '-at_install')
12 class TestInStoreDeliveryController(PaymentHttpCommon, ClickAndCollectCommon):
13 def setUp(self):
14 super().setUp()
15 self.InStoreController = InStoreDelivery()
16
17 def test_order_not_created_on_fetching_pickup_location_with_empty_cart(self):
18 count_so_before = self.env['sale.order'].search_count([])
19 url = self._build_url('/website_sale/get_pickup_locations')
20 with patch(
21 'odoo.addons.website_sale_collect.models.sale_order.SaleOrder._get_pickup_locations',
22 return_value={}
23 ):
24 self.make_jsonrpc_request(url, {'product_id': 1})
25 count_so_after = self.env['sale.order'].search_count([])
26 self.assertEqual(count_so_after, count_so_before)