summaryrefslogtreecommitdiff
path: root/addons/procurement/tests
diff options
context:
space:
mode:
authorThibault Delavallée <tde@openerp.com>2016-05-02 16:48:11 +0200
committerThibault Delavallée <tde@openerp.com>2016-07-04 16:22:36 +0200
commit71aee8e1663a384f838b35f2320ee3fb44b46665 (patch)
tree3c577461bdb8b7a135a6fa5a1a25c76481d72aaf /addons/procurement/tests
parente924881f7c1a6e9e9e3cf6bb3ae946bf477abfcb (diff)
[TESTS] procurement: yml yo new API unit tests
Diffstat (limited to 'addons/procurement/tests')
-rw-r--r--addons/procurement/tests/__init__.py3
-rw-r--r--addons/procurement/tests/common.py27
-rw-r--r--addons/procurement/tests/test_procurement.py19
3 files changed, 49 insertions, 0 deletions
diff --git a/addons/procurement/tests/__init__.py b/addons/procurement/tests/__init__.py
new file mode 100644
index 00000000000..0c6d1e1cb09
--- /dev/null
+++ b/addons/procurement/tests/__init__.py
@@ -0,0 +1,3 @@
+# -*- coding: utf-8 -*-
+
+import test_procurement
diff --git a/addons/procurement/tests/common.py b/addons/procurement/tests/common.py
new file mode 100644
index 00000000000..8dda880b038
--- /dev/null
+++ b/addons/procurement/tests/common.py
@@ -0,0 +1,27 @@
+# -*- coding: utf-8 -*-
+
+from odoo.addons.product.tests import common
+
+
+class TestStockCommon(common.TestProductCommon):
+
+ def _create_procurement(self, user, **values):
+ Procurement = self.env['procurement.order'].sudo(user)
+ procurement = Procurement.new(values)
+ procurement.onchange_product_id()
+ return Procurement.create(procurement._convert_to_write(procurement._cache))
+
+ @classmethod
+ def setUpClass(cls):
+ super(TestStockCommon, cls).setUpClass()
+
+ user_group_employee = cls.env.ref('base.group_user')
+
+ # User Data: lambda user
+ Users = cls.env['res.users'].with_context({'no_reset_password': True, 'mail_create_nosubscribe': True})
+ cls.user_employee = Users.create({
+ 'name': 'Fabricette Manivelle',
+ 'login': 'fabricette',
+ 'email': 'f.f@example.com',
+ 'notify_email': 'none',
+ 'groups_id': [(6, 0, [user_group_employee.id])]})
diff --git a/addons/procurement/tests/test_procurement.py b/addons/procurement/tests/test_procurement.py
new file mode 100644
index 00000000000..6df2c6eb5e0
--- /dev/null
+++ b/addons/procurement/tests/test_procurement.py
@@ -0,0 +1,19 @@
+# -*- coding: utf-8 -*-
+# Part of Odoo. See LICENSE file for full copyright and licensing details.
+
+# Author: Leonardo Pistone
+# Copyright 2015 Camptocamp SA
+
+from odoo.addons.procurement.tests.common import TestStockCommon
+
+
+class TestBase(TestStockCommon):
+
+ def test_base(self):
+ procurement = self._create_procurement(
+ self.user_employee,
+ product_id=self.product_1.id,
+ name='Procurement Test',
+ product_qty=15.0)
+ # I check that procurement order is in exception, as at first there isn't any suitable rule
+ self.assertEqual(procurement.state, 'exception')