Skip to content

Commit

Permalink
[IMP] Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
edescalona committed Dec 25, 2024
1 parent 0aa2bac commit a266783
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
15 changes: 15 additions & 0 deletions stock_barcodes/tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def setUpClass(cls):
cls.StockProductionLot = cls.env["stock.lot"]
cls.StockPicking = cls.env["stock.picking"]
cls.StockQuant = cls.env["stock.quant"]
cls.StockBarcodeAction = cls.env["stock.barcodes.action"]

cls.company = cls.env.company

Expand Down Expand Up @@ -104,6 +105,20 @@ def setUpClass(cls):
{"option_group_id": cls.option_group.id, "step": 1}
)

# Barcode actions
cls.barcode_action_valid = cls.StockBarcodeAction.create(
{
"name": "Barcode action valid",
"action_window_id": cls.env.ref("stock.stock_picking_type_action").id,
}
)

cls.barcode_action_invalid = cls.StockBarcodeAction.create(
{
"name": "Barcode action valid",
}
)

@classmethod
def _create_barcode_option_group(cls):
return cls.env["stock.barcodes.option.group"].create(
Expand Down
11 changes: 11 additions & 0 deletions stock_barcodes/tests/test_stock_barcodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,14 @@ def test_wiz_clean_lot(self):
self.action_barcode_scanned(self.wiz_scan, "8411822222568")
self.wiz_scan.action_clean_lot()
self.assertFalse(self.wiz_scan.lot_id)

def test_barcode_action(self):
self.assertTrue(self.barcode_action_valid.action_window_id)
self.assertEqual(bool(self.barcode_action_invalid.action_window_id), False)

def test_action_back(self):
result = self.wiz_scan.action_back()
self.assertIn("name", result)
self.assertIn("type", result)
self.assertIn("res_model", result)
self.assertEqual(result["type"], "ir.actions.act_window")

0 comments on commit a266783

Please sign in to comment.