changeset 074b8f774486 in modules/stock_inventory_location:default
details:
https://hg.tryton.org/modules/stock_inventory_location?cmd=changeset;node=074b8f774486
description:
Add test scenario
review319881002
diffstat:
setup.py | 4 ++-
tests/scenario_stock_inventories.rst | 40 ++++++++++++++++++++++++++++++++++
tests/test_stock_inventory_location.py | 7 +++++
3 files changed, 50 insertions(+), 1 deletions(-)
diffs (94 lines):
diff -r 845cc72d2bd8 -r 074b8f774486 setup.py
--- a/setup.py Wed Sep 09 23:28:00 2020 +0200
+++ b/setup.py Wed Sep 09 23:28:22 2020 +0200
@@ -57,6 +57,7 @@
requires.append(get_require_version('trytond_%s' % dep))
requires.append(get_require_version('trytond'))
+tests_require = [get_require_version('proteus')]
dependency_links = []
if minor_version % 2:
dependency_links.append('https://trydevpi.tryton.org/')
@@ -85,7 +86,7 @@
),
package_data={
'trytond.modules.stock_inventory_location': (info.get('xml', [])
- + ['tryton.cfg', 'view/*.xml', 'locale/*.po']),
+ + ['tryton.cfg', 'view/*.xml', 'locale/*.po', 'tests/*.rst']),
},
classifiers=[
'Development Status :: 5 - Production/Stable',
@@ -137,4 +138,5 @@
""",
test_suite='tests',
test_loader='trytond.test_loader:Loader',
+ tests_require=tests_require,
)
diff -r 845cc72d2bd8 -r 074b8f774486 tests/scenario_stock_inventories.rst
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/scenario_stock_inventories.rst Wed Sep 09 23:28:22 2020 +0200
@@ -0,0 +1,40 @@
+==========================
+Stock Inventories Scenario
+==========================
+
+Imports::
+
+ >>> import datetime as dt
+ >>> from proteus import Model, Wizard
+ >>> from trytond.tests.tools import activate_modules
+ >>> from trytond.modules.company.tests.tools import create_company, \
+ ... get_company
+ >>> today = dt.date.today()
+
+Activate modules::
+
+ >>> config = activate_modules('stock_inventory_location')
+
+Create company::
+
+ >>> _ = create_company()
+
+Get stock locations::
+
+ >>> Location = Model.get('stock.location')
+ >>> supplier_loc, = Location.find([('code', '=', 'SUP')])
+ >>> storage_loc, = Location.find([('code', '=', 'STO')])
+ >>> storage_loc2, = storage_loc.duplicate()
+
+Create inventories::
+
+ >>> create = Wizard('stock.inventory.create')
+ >>> create.form.date = today
+ >>> create.form.locations.extend(Location.find([('code', '=', 'STO')]))
+ >>> create.execute('create_')
+
+ >>> inventories, = create.actions
+ >>> len(inventories)
+ 2
+ >>> {i.location for i in inventories} == {storage_loc, storage_loc2}
+ True
diff -r 845cc72d2bd8 -r 074b8f774486 tests/test_stock_inventory_location.py
--- a/tests/test_stock_inventory_location.py Wed Sep 09 23:28:00 2020 +0200
+++ b/tests/test_stock_inventory_location.py Wed Sep 09 23:28:22 2020 +0200
@@ -1,8 +1,10 @@
# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
+import doctest
import unittest
import trytond.tests.test_tryton
from trytond.tests.test_tryton import ModuleTestCase
+from trytond.tests.test_tryton import doctest_teardown, doctest_checker
class StockInventoryLocationTestCase(ModuleTestCase):
@@ -14,4 +16,9 @@
suite = trytond.tests.test_tryton.suite()
suite.addTests(unittest.TestLoader().loadTestsFromTestCase(
StockInventoryLocationTestCase))
+ suite.addTests(doctest.DocFileSuite(
+ 'scenario_stock_inventories.rst',
+ tearDown=doctest_teardown, encoding='utf-8',
+ checker=doctest_checker,
+ optionflags=doctest.REPORT_ONLY_FIRST_FAILURE))
return suite