From 0256091fd12f5dd13a3ef5ef3ae72c2e4be32bc9 Mon Sep 17 00:00:00 2001 From: lreficent Date: Fri, 24 Nov 2017 16:15:17 -0500 Subject: [PATCH] [9.0][IMP] quality_control_team: add tests --- quality_control_team/README.rst | 6 ++-- quality_control_team/tests/__init__.py | 4 +++ .../tests/test_quality_control_team.py | 36 +++++++++++++++++++ .../views/qc_team_dashboard.xml | 19 +--------- 4 files changed, 44 insertions(+), 21 deletions(-) create mode 100644 quality_control_team/tests/__init__.py create mode 100644 quality_control_team/tests/test_quality_control_team.py diff --git a/quality_control_team/README.rst b/quality_control_team/README.rst index 887063bff..f1ba5c663 100644 --- a/quality_control_team/README.rst +++ b/quality_control_team/README.rst @@ -1,5 +1,5 @@ -.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg - :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: https://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 ==================== @@ -38,7 +38,7 @@ Credits Images ------ -* Odoo Community Association: `Icon `_. +* Odoo Community Association: `Icon `_. Contributors ------------ diff --git a/quality_control_team/tests/__init__.py b/quality_control_team/tests/__init__.py new file mode 100644 index 000000000..dd9c09d06 --- /dev/null +++ b/quality_control_team/tests/__init__.py @@ -0,0 +1,4 @@ +# -*- coding: utf-8 -*- +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from . import test_quality_control_team diff --git a/quality_control_team/tests/test_quality_control_team.py b/quality_control_team/tests/test_quality_control_team.py new file mode 100644 index 000000000..3d7a4da9d --- /dev/null +++ b/quality_control_team/tests/test_quality_control_team.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- +# Copyright 2017 Eficent Business and IT Consulting Services S.L. +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from openerp.tests.common import TransactionCase + + +class TestQualityControlTeam(TransactionCase): + + def setUp(self): + super(TestQualityControlTeam, self).setUp() + self.qc_team_obj = self.env['qc.team'] + self.main_qc_team = self.env.ref('quality_control_team.qc_team_main') + self.other_company = self.env['res.company'].create({ + 'name': 'other company', + }) + self.user_test = self.env['res.users'].create({ + 'name': 'Test User', + 'login': 'testuser', + 'company_id': self.other_company.id, + 'company_ids': [(4, self.other_company.id)], + }) + + def test_default_qc_team(self): + """Test that the QC team is defaulted correctly.""" + team = self.qc_team_obj._get_default_qc_team_id( + user_id=self.user_test.id) + self.assertEqual(team, self.main_qc_team) + test_team = self.qc_team_obj.create({ + 'name': 'Test Team', + 'user_id': self.user_test.id, + 'company_id': self.other_company.id, + }) + team = self.qc_team_obj._get_default_qc_team_id( + user_id=self.user_test.id) + self.assertEqual(team, test_team) diff --git a/quality_control_team/views/qc_team_dashboard.xml b/quality_control_team/views/qc_team_dashboard.xml index 6c2b26492..b1721984a 100644 --- a/quality_control_team/views/qc_team_dashboard.xml +++ b/quality_control_team/views/qc_team_dashboard.xml @@ -31,24 +31,7 @@
-
- - - - - - - - - - - - - - - -
- +