From 0722f2f96d10b97fd9c5e90023fd719484b3beee Mon Sep 17 00:00:00 2001 From: Fabien Bourgeois Date: Wed, 3 Aug 2016 16:41:41 +0200 Subject: [PATCH] [ADD]GOLEM Member Minor unit tests --- golem_member_minor/tests/__init__.py | 18 +++++++++ golem_member_minor/tests/test_golem_member.py | 37 +++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 golem_member_minor/tests/__init__.py create mode 100644 golem_member_minor/tests/test_golem_member.py diff --git a/golem_member_minor/tests/__init__.py b/golem_member_minor/tests/__init__.py new file mode 100644 index 0000000..0f44c19 --- /dev/null +++ b/golem_member_minor/tests/__init__.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- + +# Copyright 2016 Fabien Bourgeois +# +# 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 . + +from . import test_golem_member diff --git a/golem_member_minor/tests/test_golem_member.py b/golem_member_minor/tests/test_golem_member.py new file mode 100644 index 0000000..21d09a1 --- /dev/null +++ b/golem_member_minor/tests/test_golem_member.py @@ -0,0 +1,37 @@ +# -*- coding: utf-8 -*- + +# Copyright 2016 Fabien Bourgeois +# +# 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 . + +from openerp.tests.common import TransactionCase + + +class GolemMemberMinorTestCase(TransactionCase): + + def setUp(self): + super(GolemMemberMinorTestCase, self).setUp() + season_mdl = self.env['golem.season'].sudo() + self.season_current = season_mdl.create({'name': u'Current'}) + self.member_model = self.env['golem.member'].sudo() + + def test_member_minor(self): + """ Test minor computing """ + m = self.member_model.create({'lastname': u'Doe', 'firstname': u'Joe'}) + self.assertFalse(m.is_minor) + m = self.member_model.create({'lastname': u'Doe', 'firstname': u'Bob', + 'birthdate_date': '1990-01-01'}) + self.assertFalse(m.is_minor) + m.write({'birthdate_date': '2015-01-01'}) + self.assertTrue(m.is_minor)