-
-
Notifications
You must be signed in to change notification settings - Fork 334
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ed91616
commit d1b930d
Showing
3 changed files
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
from . import common | ||
from . import test_stock_barcodes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Copyright 2108-2019 Francois Poizat <[email protected]> | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from odoo.tests.common import TransactionCase | ||
|
||
|
||
class TestCommonStockBarcodes(TransactionCase): | ||
@classmethod | ||
def setUpClass(cls): | ||
super().setUpClass() | ||
cls.location_hash = ( | ||
"#id=17&model=wiz.stock.barcodes.read.inventory&view_type=form" | ||
) | ||
|
||
def camera_barcode_scanner(self, location_hash=""): | ||
if location_hash: | ||
wiz_stock_id = location_hash.split("id=")[1].split("&")[0] | ||
wiz_model_name = location_hash.split("model=")[1].split("&")[0] | ||
if not wiz_stock_id or not wiz_model_name: | ||
return False | ||
return True | ||
else: | ||
return False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Copyright 2108-2019 Sergio Teruel <[email protected]> | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
from odoo.tests.common import tagged | ||
|
||
from .common import TestCommonStockBarcodes | ||
|
||
|
||
@tagged("post_install", "-at_install") | ||
class TestStockBarcodes(TestCommonStockBarcodes): | ||
def test_location_hash(self): | ||
valid_hash = self.camera_barcode_scanner(self.location_hash) | ||
self.assertEqual(valid_hash, True) | ||
empty_hash = self.camera_barcode_scanner() | ||
self.assertEqual(empty_hash, False) | ||
with self.assertRaises(IndexError): | ||
invalid_loc_hash = self.location_hash.replace("id=", "idd=") | ||
self.camera_barcode_scanner(invalid_loc_hash) | ||
with self.assertRaises(IndexError): | ||
invalid_loc_hash = self.location_hash.replace("model=", "modell=") | ||
self.camera_barcode_scanner(invalid_loc_hash) |