summaryrefslogtreecommitdiff
path: root/addons/project_issue/tests
diff options
context:
space:
mode:
authorvbh-odoo <vbh@odoo.com>2015-08-06 16:29:42 +0530
committerDavid Monjoie <dmo@odoo.com>2016-06-30 14:41:25 +0200
commit42b498dc6f6bfd1d375c854d8b415295fbc84e65 (patch)
treef5593b4a11e0a9d8eb75d2488d638b3b811e84c9 /addons/project_issue/tests
parentccfea6b2f614e55c14d8dd3c2ade78d5b91906ec (diff)
[MIG] project_issue: converted test cases from yml to python
Diffstat (limited to 'addons/project_issue/tests')
-rw-r--r--addons/project_issue/tests/__init__.py6
-rw-r--r--addons/project_issue/tests/common.py21
-rw-r--r--addons/project_issue/tests/issue.eml45
-rw-r--r--addons/project_issue/tests/test_issue_demo.py18
-rw-r--r--addons/project_issue/tests/test_issue_process.py37
-rw-r--r--addons/project_issue/tests/test_subscribe_issue.py19
6 files changed, 146 insertions, 0 deletions
diff --git a/addons/project_issue/tests/__init__.py b/addons/project_issue/tests/__init__.py
new file mode 100644
index 00000000000..423b64bf971
--- /dev/null
+++ b/addons/project_issue/tests/__init__.py
@@ -0,0 +1,6 @@
+# -*- coding: utf-8 -*-
+# Part of Odoo. See LICENSE file for full copyright and licensing details.
+
+import test_subscribe_issue
+import test_issue_process
+import test_issue_demo
diff --git a/addons/project_issue/tests/common.py b/addons/project_issue/tests/common.py
new file mode 100644
index 00000000000..c5a1654188f
--- /dev/null
+++ b/addons/project_issue/tests/common.py
@@ -0,0 +1,21 @@
+# -*- coding: utf-8 -*-
+
+from odoo.tests.common import TransactionCase
+
+
+class TestIssueUsers(TransactionCase):
+ """Tests for unit of res users"""
+
+ def setUp(self):
+ super(TestIssueUsers, self).setUp()
+ self.ProjectIssue = self.env["project.issue"]
+
+ # Created a user as 'Project Manager'
+ # Added group for Project Manager.
+ self.project_manager = self.env["res.users"].create({
+ 'name': 'Project Manager',
+ 'login': 'prim',
+ 'password': 'prim',
+ 'email': 'issuemanager@yourcompany.com',
+ 'groups_id': [(6, 0, [self.ref('project.group_project_manager')])]
+ })
diff --git a/addons/project_issue/tests/issue.eml b/addons/project_issue/tests/issue.eml
new file mode 100644
index 00000000000..32659bbd7da
--- /dev/null
+++ b/addons/project_issue/tests/issue.eml
@@ -0,0 +1,45 @@
+Return-Path: <Robert_Adersen@yahoo.com>
+X-Original-To: abc@mycompany.com
+Delivered-To: abc@mycompany.com
+Received: by mail1.mycompany.com (Postfix, from userid 10002)
+ id 3955EBFACA; Tue, 29 Nov 2011 08:14:47 +0100 (CET)
+X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail1.mycompany.com
+X-Spam-Level:
+X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM,
+ RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1
+Received: from nm39-vm6.bullet.mail.ne1.yahoo.com (nm39-vm6.bullet.mail.ne1.yahoo.com [98.138.229.166])
+ by mail1.mycompany.com (Postfix) with SMTP id 0D074BF53A
+ for <abc@mycompany.com>; Tue, 29 Nov 2011 08:14:44 +0100 (CET)
+Received: from [98.138.90.54] by nm39.bullet.mail.ne1.yahoo.com with NNFMP; 29 Nov 2011 07:13:26 -0000
+Received: from [98.138.84.39] by tm7.bullet.mail.ne1.yahoo.com with NNFMP; 29 Nov 2011 07:13:26 -0000
+Received: from [127.0.0.1] by smtp107.mail.ne1.yahoo.com with NNFMP; 29 Nov 2011 07:13:26 -0000
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.in; s=s1024; t=1322550806; bh=LFefFqrky41IufKZHP8a86obZoBPxyX1aafgWNcrw7U=; h=X-Yahoo-Newman-Id:X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:Received:Message-ID:Date:From:User-Agent:MIME-Version:To:Subject:Content-Type:Content-Transfer-Encoding; b=NB8bd6b4Uk3/3fKhdzbcqFEZGPpKyotLeE0xh8H08rcFEahMFfY5uXgsYZsUFvTLCKfTyQWh/oPTVxHeUTGY/Y5MzAnndghX6S0mzlFtmW2dwLMqdWxQLZwU7EhbyYF9PCHicsmtlUVyo7Ou5ePSviqC0SOyCJJVWwzWlv5W9Zg=
+X-Yahoo-Newman-Id: 152218.10448.bm@smtp107.mail.ne1.yahoo.com
+X-Yahoo-Newman-Property: ymail-3
+X-YMail-OSG: i4zQqJUVM1mab8kxoCTmgMwxw9th.MdiJzmc4Ffbno7QGkl
+ acotmc0pGoiw_GrhwReSA6uNIveeAUi9WA6NniWAElxbUzGIQplTBHjRhdqF
+ d_rLG1Yn71DYxllLCZC8xoRzumVHw.kue0ymrl4D0VO.lEeyXbbYoz.TpAvu
+ ZASBwSV_mESEUu96bb1esfOjI_2MhibMNmt.2egkOG6LS3AcDkVWXJb.VpQe
+ yZieJ5djjUx9uu4HModjROSUWHKm3Qd5ZwvG.3s1JvHNNvPC3Mo6x.DXi_rj
+ d70J2pruXhJ9ZnbNooZiSHkrhaugWV.kquq6475ZxKP6Tu7G8iUgZUkHWCf.
+ aEdBFl2.4RanSkMohEfbNtwpXUQ0eDDOOPatHFB27JSP0jw--
+X-Yahoo-SMTP: oNtzSBqswBAqJIGYOgyGesyleENrhUEtEgBkQ053
+Received: from [192.168.1.30] (Robert_Adersen@180.211.100.2 with plain)
+ by smtp107.mail.ne1.yahoo.com with SMTP; 28 Nov 2011 23:13:25 -0800 PST
+Message-ID: <4ED48611.6070605@yahoo.in>
+Date: Tue, 29 Nov 2011 12:43:21 +0530
+From: Robert Adersen <Robert_Adersen@yahoo.com>
+User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.17) Gecko/20110424 Thunderbird/3.1.10
+MIME-Version: 1.0
+To: abc@mycompany.com
+Subject: Error in the account module
+Content-Type: text/plain; charset=ISO-8859-1; format=flowed
+Content-Transfer-Encoding: 7bit
+
+Hello Sir,
+
+I am using the openerp v6.1 and i have problem in hr module, so try to
+check it and solve my problem.
+
+thanks
+Robert Adersen
diff --git a/addons/project_issue/tests/test_issue_demo.py b/addons/project_issue/tests/test_issue_demo.py
new file mode 100644
index 00000000000..21846a17351
--- /dev/null
+++ b/addons/project_issue/tests/test_issue_demo.py
@@ -0,0 +1,18 @@
+# -*- coding: utf-8 -*-
+
+from odoo.addons.project_issue.tests.common import TestIssueUsers
+
+
+class TestIssueDemo(TestIssueUsers):
+
+ def test_issue_demo(self):
+ # Test the whole create project issue with project manager.
+ self.ProjectIssue.sudo(self.project_manager.id).create({
+ 'name': 'Error in account module',
+ 'task_id': self.ref('project.project_task_17')
+ })
+
+ self.ProjectIssue.sudo(self.project_manager.id).create({
+ 'name': 'Odoo Integration',
+ 'project_id': self.ref('project.project_project_2')
+ })
diff --git a/addons/project_issue/tests/test_issue_process.py b/addons/project_issue/tests/test_issue_process.py
new file mode 100644
index 00000000000..eeedfba39a4
--- /dev/null
+++ b/addons/project_issue/tests/test_issue_process.py
@@ -0,0 +1,37 @@
+# -*- coding: utf-8 -*-
+
+from odoo.addons.project_issue.tests.common import TestIssueUsers
+
+
+class TestIssueProcess(TestIssueUsers):
+
+ def test_issue_process(self):
+ # Sending mail to get more details.
+
+ vals = {'email_from': 'support@mycompany.com',
+ 'email_to': 'Robert_Adersen@yahoo.com',
+ 'subject': 'We need more details regarding your issue in HR module',
+ 'body_html': """
+ <p>
+ Hello Mr. Adersen,
+ </p>
+ <p>
+ We need more details about your issue in the HR module. Could you please
+ send us complete details about the error eg. error message, traceback
+ or what operations you were doing when you the error occured ?
+ </p>
+ <p>
+ Thank You.
+ </p>
+ <pre>
+--
+YourCompany
+info@yourcompany.example.com
++1 555 123 8069
+ </pre>
+ """}
+ crm_bug_id = self.ref('project_issue.crm_case_buginaccountsmodule0')
+ mail = self.env["mail.mail"].with_context(active_model='project.issue',
+ active_id=crm_bug_id,
+ active_ids=[crm_bug_id]).create(vals)
+ mail.send()
diff --git a/addons/project_issue/tests/test_subscribe_issue.py b/addons/project_issue/tests/test_subscribe_issue.py
new file mode 100644
index 00000000000..2577033bbf0
--- /dev/null
+++ b/addons/project_issue/tests/test_subscribe_issue.py
@@ -0,0 +1,19 @@
+# -*- coding: utf-8 -*-
+
+from odoo.addons.project_issue.tests.common import TestIssueUsers
+from odoo.modules import module
+
+
+class TestSubscribeIssue(TestIssueUsers):
+
+ def test_subscribe_issues(self):
+ # In Order to test process of Issue in Odoo, Customer send the issue by email.
+ request_file = open(module.get_module_resource('project_issue', 'tests', 'issue.eml'), 'rb')
+ request_message = request_file.read()
+ self.env["mail.thread"].message_process('project.issue', request_message)
+
+ # After getting the mail, Check details of new issue of that customer.
+ issue = self.ProjectIssue.search([('email_from', '=', 'Robert Adersen <Robert_Adersen@yahoo.com>')], limit=1)
+ self.assertEquals(len(issue), 1, "Issue is not created after getting request")
+ self.assertFalse(issue.partner_id, "Customer should be a new")
+ self.assertEquals(issue.name, "Error in the account module", "Subject does not match")