Jagdish Panchal (Open ERP) has proposed merging 
lp:~openerp-dev/openobject-addons/trunk-clean_yml_project_issue-jap into 
lp:openobject-addons.

Requested reviews:
  OpenERP Core Team (openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-clean_yml_project_issue-jap/+merge/84219

project_issue: clean the test cases
-----------------------------------
                                                                                
      
  *> modified project_issue.py  
  *> added cancel_issue.yml
  *> added draft2open2close.yml
  *> added issue_demo.yml
  *> added subscribe_issue.yml
  *> added issue.eml
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-clean_yml_project_issue-jap/+merge/84219
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/trunk-clean_yml_project_issue-jap.
=== modified file 'project_issue/__openerp__.py'
--- project_issue/__openerp__.py	2011-10-11 20:05:49 +0000
+++ project_issue/__openerp__.py	2011-12-02 07:29:29 +0000
@@ -54,8 +54,12 @@
      ],
     'demo_xml': ['project_issue_demo.xml'],
     'test': [
-      'test/convert_issue_to_task.yml',
-      'test/test_project_issue_states.yml'
+      #'test/convert_issue_to_task.yml',
+      #'test/test_project_issue_states.yml'
+      'test/subscribe_issue.yml',
+      'test/draft2open2close.yml',
+      'test/cancel_issue.yml',
+      'test/issue_demo.yml'
     ],
     'installable': True,
     'active': False,

=== modified file 'project_issue/project_issue.py'
--- project_issue/project_issue.py	2011-11-29 12:35:13 +0000
+++ project_issue/project_issue.py	2011-12-02 07:29:29 +0000
@@ -294,7 +294,7 @@
         data_obj = self.pool.get('ir.model.data')
         task_obj = self.pool.get('project.task')
 
-
+        
         if context is None:
             context = {}
 
@@ -306,7 +306,7 @@
             id2 = data_obj.browse(cr, uid, id2, context=context).res_id
         if id3:
             id3 = data_obj.browse(cr, uid, id3, context=context).res_id
-
+        
         for bug in case_obj.browse(cr, uid, ids, context=context):
             new_task_id = task_obj.create(cr, uid, {
                 'name': bug.name,
@@ -314,7 +314,7 @@
                 'description':bug.description,
                 'date': bug.date,
                 'project_id': bug.project_id.id,
-                'priority': bug.priority,
+                'priority': tools.ustr(int(bug.priority) - 1),
                 'user_id': bug.user_id.id,
                 'planned_hours': 0.0,
             })
@@ -324,7 +324,6 @@
                 'state':'pending'
             }
             case_obj.write(cr, uid, [bug.id], vals)
-
         return  {
             'name': _('Tasks'),
             'view_type': 'form',

=== added file 'project_issue/test/cancel_issue.yml'
--- project_issue/test/cancel_issue.yml	1970-01-01 00:00:00 +0000
+++ project_issue/test/cancel_issue.yml	2011-12-02 07:29:29 +0000
@@ -0,0 +1,60 @@
+-
+  In order to test process of issue tracking in OpenERP, I cancel the unqualified Issue.
+-
+  !python {model: project.issue}: |
+    self.case_cancel(cr, uid, [ref("crm_case_buginaccountsmodule0")])
+-
+  I check the issue is in cancel state.
+-
+  !assert {model: project.issue, id: crm_case_buginaccountsmodule0, severity: error, string: Issue is in cancel state}:
+    - state == 'cancel' 
+-
+  I re-open the Issue.
+-
+  !python {model: project.issue}: |
+    self.case_open(cr, uid, [ref("crm_case_buginaccountsmodule0")])
+-
+  I check the state of issue after open it. 
+-
+  !assert {model: project.issue, id: crm_case_buginaccountsmodule0, severity: error, string: Issue is in open state}:
+    - state == 'open' 
+-
+  I put the issue in pending state.
+-
+  !python {model: project.issue}: |
+    self.case_pending(cr, uid, [ref("crm_case_buginaccountsmodule0")])
+- 
+  I check the state of issue after put it in pending state.
+-  
+  !assert {model: project.issue, id: crm_case_buginaccountsmodule0, severity: error, string: Issue should be in pending state}:
+    - state == 'pending'
+-
+  I cancel the issue is in pending state.
+-
+  !python {model: project.issue}: |
+    self.case_cancel(cr, uid, [ref("crm_case_buginaccountsmodule0")])
+-
+  I check the issue is in cancel state.
+-
+  !assert {model: project.issue, id: crm_case_buginaccountsmodule0, severity: error, string: Issue is in cancel state}:
+    - state == 'cancel'
+-
+  I close Issue.
+-
+  !python {model: project.issue}: |
+    self.case_close(cr, uid, [ref("crm_case_buginaccountsmodule0")])
+-  
+  I check state of Issue after close.
+- 
+  !assert {model: project.issue, id: crm_case_buginaccountsmodule0, severity: error, string: Issue is in done state}:
+    - state == 'done'
+-
+  I cancel the issue is in done state.
+-
+  !python {model: project.issue}: |
+    self.case_cancel(cr, uid, [ref("crm_case_buginaccountsmodule0")])
+-
+  I check the issue is in cancel state.
+-
+  !assert {model: project.issue, id: crm_case_buginaccountsmodule0, severity: error, string: Issue is in cancel state}:
+    - state == 'cancel'
\ No newline at end of file

=== added file 'project_issue/test/draft2open2close.yml'
--- project_issue/test/draft2open2close.yml	1970-01-01 00:00:00 +0000
+++ project_issue/test/draft2open2close.yml	2011-12-02 07:29:29 +0000
@@ -0,0 +1,57 @@
+-
+  In order to test process of issue tracking in OpenERP, I Open the Issue.
+-
+  !python {model: project.issue}: |
+    self.case_open(cr, uid, [ref("crm_case_buginaccountsmodule0")])
+- 
+  I check state of Issue after opened it.
+- 
+  !assert {model: project.issue, id: crm_case_buginaccountsmodule0, severity: error, string: Issue should be in open state}:
+    - state == 'open'       
+- 
+  Now I put Issue in pending due to need more information.
+- 
+  !python {model: project.issue}: |
+    self.case_pending(cr, uid, [ref("crm_case_buginaccountsmodule0")])
+- 
+  I check state after put in pending.
+-  
+  !assert {model: project.issue, id: crm_case_buginaccountsmodule0, severity: error, string: Issue should be in pending state}:
+    - state == 'pending'
+-
+  I send mail to get more details.
+-
+  !python {model: mail.compose.message }: |
+    ctx = context.copy()
+    ctx.update({'active_model': 'project.issue', 'active_id': ref("crm_case_buginaccountsmodule0"), 'active_ids': [ref("crm_case_buginaccountsmodule0")]})
+    vals = self.default_get(cr, uid , [], context=ctx)
+    try:
+        new_id = self.create(cr, uid, {'email_to': '[email protected]', 'subject': 'Regarding error in account module we nees more details'})
+        self.send_mail(cr, uid, [new_id], context=ctx)
+    except Exception, e:
+        pass  
+-
+  After getting sufficient details, I re-open Issue from pending state.
+-
+  !python {model: project.issue}: |
+    self.case_open(cr, uid, [ref("crm_case_buginaccountsmodule0")])
+-
+  I check state of Issue after re-opened.
+-
+  !assert {model: project.issue, id: crm_case_buginaccountsmodule0, severity: error, string: Issue should be in open state}:
+    - state == 'open'   
+-
+  I create Task for Issue.
+-
+  !python {model: project.issue}: |
+    self.convert_issue_task(cr, uid, [ref("crm_case_buginaccountsmodule0")])
+-
+  I close Issue after resolving it
+-
+  !python {model: project.issue}: |
+    self.case_close(cr, uid, [ref("crm_case_buginaccountsmodule0")])
+-  
+  I Check state of Issue after closed.
+- 
+  !assert {model: project.issue, id: crm_case_buginaccountsmodule0, severity: error, string: Issue should be in done state}:
+    - state == 'done'
\ No newline at end of file

=== added file 'project_issue/test/issue.eml'
--- project_issue/test/issue.eml	1970-01-01 00:00:00 +0000
+++ project_issue/test/issue.eml	2011-12-02 07:29:29 +0000
@@ -0,0 +1,45 @@
+Return-Path: <[email protected]>
+X-Original-To: [email protected]
+Delivered-To: [email protected]
+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 <[email protected]>; 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: [email protected]
+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] ([email protected] with plain)
+        by smtp107.mail.ne1.yahoo.com with SMTP; 28 Nov 2011 23:13:25 -0800 PST
+Message-ID: <[email protected]>
+Date: Tue, 29 Nov 2011 12:43:21 +0530
+From: Robert Adersen <[email protected]>
+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: [email protected]
+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

=== added file 'project_issue/test/issue_demo.yml'
--- project_issue/test/issue_demo.yml	1970-01-01 00:00:00 +0000
+++ project_issue/test/issue_demo.yml	2011-12-02 07:29:29 +0000
@@ -0,0 +1,8 @@
+-
+  !record {model: project.issue, id: project_task_1, view: False}:
+   task_id: 'project.project_task_17'
+   name: 'Error in account module'
+-
+  !record {model: project.issue, id: project01, view: False}:
+   project_id: 'project.project_project_9'
+   name: 'OpenERP Integration'

=== added file 'project_issue/test/subscribe_issue.yml'
--- project_issue/test/subscribe_issue.yml	1970-01-01 00:00:00 +0000
+++ project_issue/test/subscribe_issue.yml	2011-12-02 07:29:29 +0000
@@ -0,0 +1,17 @@
+-
+  In Order to test process of  Issue in OpenERP, Custmer send the issue by email.
+-
+  !python {model: mail.thread}: |
+    import addons
+    request_file = open(addons.get_module_resource('project_issue','test', 'issue.eml'),'rb')
+    request_message = request_file.read()
+    self.message_process(cr, uid, 'project.issue', request_message)
+-
+  After getting the mail, I check details of new issue of that customer.
+- 
+  !python {model: project.issue}: |
+    issue_ids = self.search(cr, uid, [('email_from', '=', 'Robert Adersen <[email protected]>')])
+    assert issue_ids and len(issue_ids), "issue is not created after getting request"
+    issue = self.browse(cr, uid, issue_ids[0], context=context)
+    assert not issue.partner_id, "Customer should be a new"
+    assert issue.name == "Error in the account module", "Subject does not match"
\ No newline at end of file

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to