Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Xiaowu Zhang
erp5
Commits
0e2ab30c
Commit
0e2ab30c
authored
Oct 02, 2020
by
Xiaowu Zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_forge: add create task from bug relate test
parent
546b7bcc
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
71 additions
and
4 deletions
+71
-4
bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_forge/Bug_newTask.py
...e/SkinTemplateItem/portal_skins/erp5_forge/Bug_newTask.py
+4
-0
bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_forge/Bug_newTask.xml
.../SkinTemplateItem/portal_skins/erp5_forge/Bug_newTask.xml
+1
-1
bt5/erp5_forge/TestTemplateItem/portal_components/test.erp5.testBug.py
...e/TestTemplateItem/portal_components/test.erp5.testBug.py
+42
-0
bt5/erp5_forge/TestTemplateItem/portal_components/test.erp5.testBug.xml
.../TestTemplateItem/portal_components/test.erp5.testBug.xml
+24
-3
No files found.
bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_forge/Bug_newTask.py
View file @
0e2ab30c
...
@@ -2,6 +2,8 @@ task = context.getFollowUpRelatedValue(portal_type='Task')
...
@@ -2,6 +2,8 @@ task = context.getFollowUpRelatedValue(portal_type='Task')
if
task
:
if
task
:
task_report
=
task
.
getCausalityRelatedValue
(
portal_type
=
'Task Report'
)
task_report
=
task
.
getCausalityRelatedValue
(
portal_type
=
'Task Report'
)
if
task_report
is
None
or
task_report
.
getSimulationState
()
not
in
(
'delivered'
):
if
task_report
is
None
or
task_report
.
getSimulationState
()
not
in
(
'delivered'
):
if
batch
:
return
task
message
=
context
.
Base_translateString
(
"A task is already created for this bug"
)
message
=
context
.
Base_translateString
(
"A task is already created for this bug"
)
return
task
.
Base_redirect
(
'view'
,
keep_items
=
{
'portal_status_message'
:
message
})
return
task
.
Base_redirect
(
'view'
,
keep_items
=
{
'portal_status_message'
:
message
})
...
@@ -18,5 +20,7 @@ task = context.task_module.newContent(
...
@@ -18,5 +20,7 @@ task = context.task_module.newContent(
source_project
=
context
.
getSourceProject
(),
#project
source_project
=
context
.
getSourceProject
(),
#project
follow_up_value
=
context
follow_up_value
=
context
)
)
if
batch
:
return
task
message
=
context
.
Base_translateString
(
"A new task is created for this bug"
)
message
=
context
.
Base_translateString
(
"A new task is created for this bug"
)
return
task
.
Base_redirect
(
'view'
,
keep_items
=
{
'portal_status_message'
:
message
})
return
task
.
Base_redirect
(
'view'
,
keep_items
=
{
'portal_status_message'
:
message
})
bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_forge/Bug_newTask.xml
View file @
0e2ab30c
...
@@ -50,7 +50,7 @@
...
@@ -50,7 +50,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
start_date, stop_date, **kw
</string>
</value>
<value>
<string>
start_date, stop_date,
batch=0,
**kw
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
id
</string>
</key>
<key>
<string>
id
</string>
</key>
...
...
bt5/erp5_forge/TestTemplateItem/portal_components/test.erp5.testBug.py
View file @
0e2ab30c
...
@@ -611,6 +611,48 @@ class TestBug(ERP5TypeTestCase):
...
@@ -611,6 +611,48 @@ class TestBug(ERP5TypeTestCase):
self
.
commit
()
self
.
commit
()
self
.
assertGreater
(
bug
.
getModificationDate
(),
bug_modification_date
)
self
.
assertGreater
(
bug
.
getModificationDate
(),
bug_modification_date
)
def
test_createTaskFromBug
(
self
):
self
.
loginByUserName
(
'mame'
)
bug_portal_type
=
'Bug'
module
=
self
.
portal
.
getDefaultModule
(
portal_type
=
bug_portal_type
)
bug
=
module
.
newContent
(
portal_type
=
bug_portal_type
)
bug_line
=
bug
.
newContent
(
portal_type
=
'Bug Line'
)
bug_line
.
Base_createCloneDocument
(
batch_mode
=
1
)
self
.
workflow_tool
.
doActionFor
(
bug
,
'confirm_action'
,
send_event
=
1
)
self
.
assertEqual
(
bug
.
getSimulationState
(),
'confirmed'
)
self
.
tic
()
task
=
bug
.
Bug_newTask
(
start_date
=
DateTime
(),
stop_date
=
DateTime
(),
batch
=
1
)
self
.
assertTrue
(
task
is
not
None
)
self
.
assertEqual
(
task
.
getFollowUpValue
(),
bug
)
self
.
tic
()
# can't create another one if previous is not finished
self
.
assertEqual
(
task
,
bug
.
Bug_newTask
(
start_date
=
DateTime
(),
stop_date
=
DateTime
(),
batch
=
1
))
# XXXX add manually related task report
task_report
=
self
.
portal
.
task_report_module
.
newContent
(
portal_type
=
'Task Report'
)
task_report
.
edit
(
causality_value
=
task
)
self
.
tic
()
task_report
.
confirm
()
task_report
.
start
()
task_report
.
stop
()
self
.
workflow_tool
.
doActionFor
(
task_report
,
'deliver_action'
,
close_bug
=
0
)
self
.
tic
()
self
.
assertEqual
(
bug
.
getSimulationState
(),
'confirmed'
)
another_task
=
bug
.
Bug_newTask
(
start_date
=
DateTime
(),
stop_date
=
DateTime
(),
batch
=
1
)
self
.
assertTrue
(
another_task
is
not
None
)
self
.
assertTrue
(
another_task
!=
task
)
task_report
=
self
.
portal
.
task_report_module
.
newContent
(
portal_type
=
'Task Report'
)
task_report
.
edit
(
causality_value
=
task
)
self
.
tic
()
task_report
.
confirm
()
task_report
.
start
()
task_report
.
stop
()
self
.
workflow_tool
.
doActionFor
(
task_report
,
'deliver_action'
,
close_bug
=
1
)
self
.
tic
()
self
.
assertEqual
(
bug
.
getSimulationState
(),
'stopped'
)
def
test_suite
():
def
test_suite
():
suite
=
unittest
.
TestSuite
()
suite
=
unittest
.
TestSuite
()
...
...
bt5/erp5_forge/TestTemplateItem/portal_components/test.erp5.testBug.xml
View file @
0e2ab30c
...
@@ -6,6 +6,12 @@
...
@@ -6,6 +6,12 @@
</pickle>
</pickle>
<pickle>
<pickle>
<dictionary>
<dictionary>
<item>
<key>
<string>
_recorded_property_dict
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<item>
<key>
<string>
default_reference
</string>
</key>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
testBug
</string>
</value>
<value>
<string>
testBug
</string>
</value>
...
@@ -53,13 +59,28 @@
...
@@ -53,13 +59,28 @@
<item>
<item>
<key>
<string>
workflow_history
</string>
</key>
<key>
<string>
workflow_history
</string>
</key>
<value>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
I
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
</value>
</value>
</item>
</item>
</dictionary>
</dictionary>
</pickle>
</pickle>
</record>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
</pickle>
...
@@ -72,7 +93,7 @@
...
@@ -72,7 +93,7 @@
<item>
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
Q
=
</string>
</persistent>
</value>
</value>
</item>
</item>
</dictionary>
</dictionary>
...
@@ -81,7 +102,7 @@
...
@@ -81,7 +102,7 @@
</dictionary>
</dictionary>
</pickle>
</pickle>
</record>
</record>
<record
id=
"
3"
aka=
"AAAAAAAAAAM
="
>
<record
id=
"
4"
aka=
"AAAAAAAAAAQ
="
>
<pickle>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.Workflow"
/>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.Workflow"
/>
</pickle>
</pickle>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment