savoirfairelinux-openerp team mailing list archive
-
savoirfairelinux-openerp team
-
Mailing list archive
-
Message #00897
[Merge] lp:~savoirfairelinux-openerp/partner-contact-management/employee_firstname_improvement into lp:~savoirfairelinux-openerp/partner-contact-management/base_contact_by_functions
elhadji.dem@xxxxxxxxxxxxxxxxxxxx has proposed merging lp:~savoirfairelinux-openerp/partner-contact-management/employee_firstname_improvement into lp:~savoirfairelinux-openerp/partner-contact-management/base_contact_by_functions.
Requested reviews:
Sandy Carter (http://www.savoirfairelinux.com) (sandy-carter)
For more details, see:
https://code.launchpad.net/~savoirfairelinux-openerp/partner-contact-management/employee_firstname_improvement/+merge/204108
Add 'from .' to import hr line in employee_firstname module
--
https://code.launchpad.net/~savoirfairelinux-openerp/partner-contact-management/employee_firstname_improvement/+merge/204108
Your team Savoir-faire Linux' OpenERP is subscribed to branch lp:~savoirfairelinux-openerp/partner-contact-management/base_contact_by_functions.
=== modified file 'employee_firstname/__init__.py'
--- employee_firstname/__init__.py 2013-12-20 22:00:31 +0000
+++ employee_firstname/__init__.py 2014-01-30 21:54:04 +0000
@@ -20,6 +20,6 @@
#
##############################################################################
-import hr
+from . import hr
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added directory 'passport/tests'
=== added file 'passport/tests/__init__.py'
--- passport/tests/__init__.py 1970-01-01 00:00:00 +0000
+++ passport/tests/__init__.py 2014-01-30 21:54:04 +0000
@@ -0,0 +1,27 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# This module copyright (C) 2013 Savoir-faire Linux
+# (<http://www.savoirfairelinux.com>).
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+from . import test_passport
+
+checks = [
+ test_passport,
+]
=== added file 'passport/tests/test_passport.py'
--- passport/tests/test_passport.py 1970-01-01 00:00:00 +0000
+++ passport/tests/test_passport.py 2014-01-30 21:54:04 +0000
@@ -0,0 +1,109 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# This module copyright (C) 2013 Savoir-faire Linux
+# (<http://www.savoirfairelinux.com>).
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+from openerp.tests.common import TransactionCase
+from openerp.osv.orm import browse_record
+from datetime import date
+
+
+class Base_Test_passport(TransactionCase):
+ """
+ Simple test creating a passport
+ This is a base class for passport test cases.
+ Inherit from this and setup values.
+ """
+
+ def setUp(self, vals={}):
+ """
+ Setting up passport.
+ """
+ # Default test values
+ self.vals = {'name': 'This is a test passport name',
+ 'number': 'A200124789',
+ 'country_id': 1,
+ 'expiration_date': date(2013, 11, 14),
+ 'birth_date': date(1980, 11, 21),
+ 'gender': 'male',
+ }
+ super(Base_Test_passport, self).setUp()
+ # Overwrite vals if needed
+ self.vals = dict(self.vals.items() + vals.items())
+ # Create the passport object; we will be testing this, so store in self
+ res_passport = self.registry('res.passport')
+ self.passport_id = res_passport.create(self.cr, self.uid, self.vals, context=None)
+
+ def test_passport(self):
+ """
+ Checking the passport creation.
+ """
+ res_passport = self.registry('res.passport')
+ passport_obj = res_passport.browse(self.cr, self.uid, self.passport_id, context=None)
+ for field in self.vals:
+ val = passport_obj[field]
+ if type(val) == browse_record:
+ self.assertEquals(self.vals[field], val.id,
+ "IDs for %s don't match: (%i != %i)" %
+ (field, self.vals[field], val.id))
+ else:
+ self.assertEquals(str(self.vals[field]), str(val),
+ "Values for %s don't match: (%s != %s)" %
+ (field, str(self.vals[field]), str(val)))
+
+
+class Test_passport_bad(Base_Test_passport):
+ """
+ Simple test creating a passport, test against bad values
+ """
+ def setUp(self):
+ """
+ Setting up passport, then changing the values to test against.
+ """
+ super(Test_passport_bad, self).setUp()
+ # Change vals to something wrong
+ self.vals = {
+ 'name': 'This is the wrong passport name',
+ 'number': 'A111111111',
+ 'country_id': 0,
+ 'expiration_date': date(1999, 11, 14),
+ 'birth_date': date(1999, 11, 21),
+ 'gender': '',
+ }
+
+ def test_passport(self):
+ """
+ Checking the passport creation, assertions should all be false.
+ """
+ res_passport = self.registry('res.passport')
+ passport_obj = res_passport.browse(self.cr, self.uid, self.passport_id, context=None)
+ for field in self.vals:
+ val = passport_obj[field]
+ if type(val) == browse_record:
+ self.assertNotEqual(self.vals[field], val.id,
+ "IDs for %s don't match: (%i != %i)" %
+ (field, self.vals[field], val.id))
+ else:
+ self.assertNotEqual(str(self.vals[field]), str(val),
+ "Values for %s don't match: (%s != %s)" %
+ (field, str(self.vals[field]), str(val)))
+
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
Follow ups