Browse Source

Add bad input test case.

pull/120/head
Jairo Llopis 10 years ago
parent
commit
1d96530fcd
  1. 21
      partner_contact_birthdate/tests/test_birthdate.py

21
partner_contact_birthdate/tests/test_birthdate.py

@ -21,18 +21,33 @@ from openerp.tests.common import TransactionCase
from datetime import date from datetime import date
class BirthdateCase(TransactionCase):
class GoodCase(TransactionCase):
def setUp(self): def setUp(self):
super(BirthdateCase, self).setUp()
super(GoodCase, self).setUp()
self.partner = self.env["res.partner"].create({"name": str(self)}) self.partner = self.env["res.partner"].create({"name": str(self)})
self.birthdate = date.today() self.birthdate = date.today()
def tearDown(self): def tearDown(self):
self.assertEqual(self.partner.birthdate, self.partner.birthdate_date) self.assertEqual(self.partner.birthdate, self.partner.birthdate_date)
super(BirthdateCase, self).tearDown()
super(GoodCase, self).tearDown()
def test_new_to_old(self): def test_new_to_old(self):
self.partner.birthdate_date = self.birthdate self.partner.birthdate_date = self.birthdate
def test_old_to_new(self): def test_old_to_new(self):
self.partner.birthdate = fields.Date.to_string(self.birthdate) self.partner.birthdate = fields.Date.to_string(self.birthdate)
class BadCase(TransactionCase):
def setUp(self):
super(BadCase, self).setUp()
self.partner = self.env["res.partner"].create({"name": str(self)})
self.birthdate = date.today()
def tearDown(self):
self.assertNotEqual(self.partner.birthdate,
self.partner.birthdate_date)
super(BadCase, self).tearDown()
def test_old_to_new(self):
self.partner.birthdate = "Not a date"
Loading…
Cancel
Save