Commit 88fe4225 authored by Jérome Perrin's avatar Jérome Perrin

test for getQuantityPrecision was missing

fix some indentations


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@10276 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent e705498f
...@@ -745,12 +745,24 @@ class TestResource(ERP5TypeTestCase): ...@@ -745,12 +745,24 @@ class TestResource(ERP5TypeTestCase):
tab=1) tab=1)
self.assertEquals(base_price, self.assertEquals(base_price,
product.getPrice()) product.getPrice())
def testQuantityPrecision(self):
"""test how to define quantity precision on resources.
"""
resource = self.portal.getDefaultModule(self.product_portal_type)\
.newContent(portal_type=self.product_portal_type)
# default is 1
self.assertEquals(1, resource.getBaseUnitQuantity())
self.assertEquals(0, resource.getQuantityPrecision())
# quantity precision is calculated using base quantity unit
resource.setBaseUnitQuantity(0.001)
self.assertEquals(3, resource.getQuantityPrecision())
if __name__ == '__main__': if __name__ == '__main__':
framework() framework()
else: else:
import unittest import unittest
def test_suite(): def test_suite():
suite = unittest.TestSuite() suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestResource)) suite.addTest(unittest.makeSuite(TestResource))
return suite return suite
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment