From 1d96530fcdb57ac4314356de6675768793044715 Mon Sep 17 00:00:00 2001 From: Jairo Llopis Date: Wed, 20 May 2015 12:11:12 +0200 Subject: [PATCH] Add bad input test case. --- .../tests/test_birthdate.py | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/partner_contact_birthdate/tests/test_birthdate.py b/partner_contact_birthdate/tests/test_birthdate.py index 1fb871f80..1782d3a40 100644 --- a/partner_contact_birthdate/tests/test_birthdate.py +++ b/partner_contact_birthdate/tests/test_birthdate.py @@ -21,18 +21,33 @@ from openerp.tests.common import TransactionCase from datetime import date -class BirthdateCase(TransactionCase): +class GoodCase(TransactionCase): def setUp(self): - super(BirthdateCase, self).setUp() + super(GoodCase, self).setUp() self.partner = self.env["res.partner"].create({"name": str(self)}) self.birthdate = date.today() def tearDown(self): self.assertEqual(self.partner.birthdate, self.partner.birthdate_date) - super(BirthdateCase, self).tearDown() + super(GoodCase, self).tearDown() def test_new_to_old(self): self.partner.birthdate_date = self.birthdate def test_old_to_new(self): 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"