Browse Source

[FIX] passport PEP8

pull/14/head
Lorenzo Battistini 10 years ago
parent
commit
c600209b81
  1. 30
      passport/tests/test_passport.py

30
passport/tests/test_passport.py

@ -1,5 +1,5 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
#
# OpenERP, Open Source Management Solution
# This module copyright (C) 2013 Savoir-faire Linux
@ -18,7 +18,7 @@
# 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.models import BaseModel
@ -26,6 +26,7 @@ from datetime import date
class Base_Test_passport(TransactionCase):
"""
Simple test creating a passport
This is a base class for passport test cases.
@ -49,14 +50,16 @@ class Base_Test_passport(TransactionCase):
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)
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)
passport_obj = res_passport.browse(
self.cr, self.uid, self.passport_id, context=None)
for field in self.vals:
val = passport_obj[field]
if isinstance(val, BaseModel):
@ -70,9 +73,11 @@ class Base_Test_passport(TransactionCase):
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.
@ -93,7 +98,8 @@ class Test_passport_bad(Base_Test_passport):
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)
passport_obj = res_passport.browse(
self.cr, self.uid, self.passport_id, context=None)
for field in self.vals:
val = passport_obj[field]
if isinstance(val, BaseModel):
@ -107,9 +113,11 @@ class Test_passport_bad(Base_Test_passport):
class Test_passport_name_get(TransactionCase):
"""
Test name_get
"""
def setUp(self):
"""
Setting up passport with name, country, either and none.
@ -139,10 +147,14 @@ class Test_passport_name_get(TransactionCase):
Checking the passport creation, assertions should all be false.
"""
res_passport = self.registry('res.passport')
both_obj = res_passport.browse(self.cr, self.uid, self.both, context=None)
name_only = res_passport.browse(self.cr, self.uid, self.name_only, context=None)
country_only = res_passport.browse(self.cr, self.uid, self.country_only, context=None)
neither = res_passport.browse(self.cr, self.uid, self.neither, context=None)
both_obj = res_passport.browse(
self.cr, self.uid, self.both, context=None)
name_only = res_passport.browse(
self.cr, self.uid, self.name_only, context=None)
country_only = res_passport.browse(
self.cr, self.uid, self.country_only, context=None)
neither = res_passport.browse(
self.cr, self.uid, self.neither, context=None)
self.assertEquals(
both_obj.name_get()[0][1],
' | '.join((self.country_name, self.name_on_passport)),

Loading…
Cancel
Save