Skip to content

Commit

Permalink
[ADD] - Add test case
Browse files Browse the repository at this point in the history
  • Loading branch information
Kimkhoi3010 committed Jan 24, 2025
1 parent 68d9f21 commit fdc2c42
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
1 change: 1 addition & 0 deletions stock_dock/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import test_stock_dock
25 changes: 25 additions & 0 deletions stock_dock/tests/test_stock_dock.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
from odoo.tests.common import TransactionCase


class TestStockDock(TransactionCase):
def test_default_warehouse_id(self):
# Retrieve the default warehouse using the reference defined in the data.
default_warehouse = self.env.ref("stock.warehouse0", raise_if_not_found=False)

# Assert that the default warehouse exists.
self.assertTrue(default_warehouse, "Default warehouse not found.")

# Create a new stock.dock record without specifying a warehouse_id.
dock = self.env["stock.dock"].create(
{
"name": "Test Dock",
}
)

# Assert that the warehouse_id of the newly created dock
# is set to the default warehouse.
self.assertEqual(
dock.warehouse_id,
default_warehouse,
"Default warehouse is not set correctly.",
)

0 comments on commit fdc2c42

Please sign in to comment.