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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alexander Emmerich
erp5
Commits
bb3876fa
Commit
bb3876fa
authored
Aug 28, 2020
by
Arnaud Fontaine
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ZODB Components: erp5_crm: Migrate Unit Tests.
parent
26ffebd5
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
314 additions
and
78 deletions
+314
-78
bt5/erp5_crm/TestTemplateItem/portal_components/test.erp5.testCRM.py
...m/TestTemplateItem/portal_components/test.erp5.testCRM.py
+13
-16
bt5/erp5_crm/TestTemplateItem/portal_components/test.erp5.testCRM.xml
.../TestTemplateItem/portal_components/test.erp5.testCRM.xml
+110
-0
bt5/erp5_crm/TestTemplateItem/portal_components/test.erp5.testCrmReports.py
...emplateItem/portal_components/test.erp5.testCrmReports.py
+75
-61
bt5/erp5_crm/TestTemplateItem/portal_components/test.erp5.testCrmReports.xml
...mplateItem/portal_components/test.erp5.testCrmReports.xml
+110
-0
bt5/erp5_crm/bt/template_test_id_list
bt5/erp5_crm/bt/template_test_id_list
+2
-0
bt5/erp5_crm/bt/test_dependency_list
bt5/erp5_crm/bt/test_dependency_list
+4
-1
No files found.
product/ERP5/tests/
testCRM.py
→
bt5/erp5_crm/TestTemplateItem/portal_components/test.erp5.
testCRM.py
View file @
bb3876fa
...
...
@@ -43,8 +43,11 @@ from email.mime.text import MIMEText
from
email
import
encoders
,
message_from_string
from
DateTime
import
DateTime
import
Products.ERP5.tests
def
makeFilePath
(
name
):
return
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'test_data'
,
'crm_emails'
,
name
)
return
os
.
path
.
join
(
os
.
path
.
dirname
(
Products
.
ERP5
.
tests
.
__file__
),
'test_data'
,
'crm_emails'
,
name
)
def
makeFileUpload
(
name
):
path
=
makeFilePath
(
name
)
...
...
@@ -108,7 +111,6 @@ class TestCRM(BaseTestCRM):
def
test_Event_CreateRelatedEvent
(
self
):
# test workflow to create a related event from responded event
event_module
=
self
.
portal
.
event_module
portal_workflow
=
self
.
portal
.
portal_workflow
ticket
=
self
.
portal
.
campaign_module
.
newContent
(
portal_type
=
'Campaign'
,)
for
ptype
in
[
x
for
x
in
self
.
portal
.
getPortalEventTypeList
()
if
x
!=
'Acknowledgement'
]:
...
...
@@ -152,7 +154,6 @@ class TestCRM(BaseTestCRM):
def
test_Ticket_CreateRelatedEvent
(
self
):
# test action to create a related event from a ticket
event_module_url
=
self
.
portal
.
event_module
.
absolute_url
()
ticket
=
self
.
portal
.
meeting_module
.
newContent
(
portal_type
=
'Meeting'
)
for
ptype
in
[
x
for
x
in
self
.
portal
.
getPortalEventTypeList
()
if
x
!=
'Acknowledgement'
]:
...
...
@@ -416,7 +417,6 @@ class TestCRM(BaseTestCRM):
"""
portal_type
=
"Support Request"
title
=
"Title of the Support Request"
content
=
"This is the content of the Support Request"
module
=
self
.
portal
.
support_request_module
support_request
=
module
.
newContent
(
portal_type
=
portal_type
,
title
=
title
,)
...
...
@@ -550,7 +550,7 @@ class TestCRM(BaseTestCRM):
self
.
assertEqual
(
event_list
,
[])
event_list
=
campaign
.
getFollowUpRelatedValueList
(
portal_type
=
'Mail Message'
)
self
.
assertNotEquals
(
event_list
,
[])
destination_list
=
map
(
lambda
x
:
x
.
getDestinationValue
(),
event_list
)
destination_list
=
[
x
.
getDestinationValue
()
for
x
in
event_list
]
self
.
assertEqual
(
destination_list
,
[
first_user
])
mail_message
=
event_list
[
0
]
self
.
assertEqual
(
sender
.
getRelativeUrl
(),
mail_message
.
getSource
())
...
...
@@ -571,10 +571,10 @@ class TestCRM(BaseTestCRM):
self
.
assertEqual
([],
event_list
)
event_list
=
campaign
.
getFollowUpRelatedValueList
(
portal_type
=
'Visit'
)
self
.
assertNotEquals
([],
event_list
)
destination_uid_list
=
map
(
lambda
x
:
x
.
getDestinationUid
(),
event_list
)
destination_uid_list
=
[
x
.
getDestinationUid
()
for
x
in
event_list
]
self
.
assertEqual
([
organisation
.
getUid
()],
destination_uid_list
)
resource_value_list
=
map
(
lambda
x
:
x
.
getResourceValue
(),
event_list
)
resource_value_list
=
[
x
.
getResourceValue
()
for
x
in
event_list
]
self
.
assertEqual
([
service
],
resource_value_list
)
def
test_OutcomePath
(
self
):
...
...
@@ -648,8 +648,7 @@ class TestCRMMailIngestion(BaseTestCRM):
def
_readTestData
(
self
,
filename
):
"""read test data from data directory."""
return
file
(
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'test_data'
,
'crm_emails'
,
filename
)).
read
()
return
file
(
makeFilePath
(
filename
)).
read
()
def
_ingestMail
(
self
,
filename
=
None
,
data
=
None
):
"""ingest an email from the mail in data dir named `filename`"""
...
...
@@ -685,8 +684,6 @@ class TestCRMMailIngestion(BaseTestCRM):
(
'"He<" <he@erp5.org>'
,
[
'person_module/he'
]),
)
portal
=
self
.
portal
Base_getEntityListFromFromHeader
=
portal
.
Base_getEntityListFromFromHeader
pc
=
self
.
portal
.
portal_catalog
for
header
,
expected_paths
in
expected_values
:
paths
=
[
entity
.
getRelativeUrl
()
for
entity
in
portal
.
Base_getEntityListFromFromHeader
(
header
)]
...
...
@@ -771,7 +768,7 @@ class TestCRMMailIngestion(BaseTestCRM):
def
test_getPropertyDictFromContent_and_defined_arrow
(
self
):
# If source/destination are set on event, then getPropertyDictFromContent
# should not lookup one based on email address.
person
=
self
.
portal
.
person_module
.
newContent
(
self
.
portal
.
person_module
.
newContent
(
portal_type
=
'Person'
,
default_email_coordinate_text
=
'destination@example.com'
,)
organisation
=
self
.
portal
.
organisation_module
.
newContent
(
...
...
@@ -970,10 +967,10 @@ class TestCRMMailIngestion(BaseTestCRM):
portal_type
=
'Mail Message'
event
=
self
.
portal
.
getDefaultModule
(
portal_type
).
newContent
(
portal_type
=
portal_type
)
# build message content with flwd attachment
plain_text_message
=
'You can read this'
html_filename
=
'broken_html.html'
file_path
=
'%s/test_data/%s'
%
(
__file__
.
rstrip
(
'c'
).
replace
(
__name__
+
'.py'
,
''
),
html_filename
,)
file_path
=
'%s/test_data/%s'
%
(
os
.
path
.
dirname
(
Products
.
ERP5
.
tests
.
__file__
),
html_filename
)
html_message
=
open
(
file_path
,
'r'
).
read
()
message
=
MIMEMultipart
(
'alternative'
)
message
.
attach
(
MIMEText
(
'text plain content'
,
_charset
=
'utf-8'
))
...
...
@@ -1998,7 +1995,7 @@ class TestCRMMailSend(BaseTestCRM):
mail_message
.
send
(
extra_header_dict
=
{
"X-test-header"
:
"test"
})
self
.
tic
()
(
from_url
,
to_url
,
last_message
,),
=
self
.
portal
.
MailHost
.
_message_list
(
_
,
_
,
last_message
,),
=
self
.
portal
.
MailHost
.
_message_list
message
=
message_from_string
(
last_message
)
self
.
assertEqual
(
"test"
,
message
.
get
(
"X-test-header"
))
...
...
bt5/erp5_crm/TestTemplateItem/portal_components/test.erp5.testCRM.xml
0 → 100644
View file @
bb3876fa
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Test Component"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
testCRM
</string>
</value>
</item>
<item>
<key>
<string>
default_source_reference
</string>
</key>
<value>
<string>
Products.ERP5.tests.testCRM
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
test.erp5.testCRM
</string>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Test Component
</string>
</value>
</item>
<item>
<key>
<string>
sid
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
text_content_error_message
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
text_content_warning_message
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
version
</string>
</key>
<value>
<string>
erp5
</string>
</value>
</item>
<item>
<key>
<string>
workflow_history
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAM=
</string>
</persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.Workflow"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_log
</string>
</key>
<value>
<list>
<dictionary>
<item>
<key>
<string>
action
</string>
</key>
<value>
<string>
validate
</string>
</value>
</item>
<item>
<key>
<string>
validation_state
</string>
</key>
<value>
<string>
validated
</string>
</value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
product/ERP5/tests/
testCrmReports.py
→
bt5/erp5_crm/TestTemplateItem/portal_components/test.erp5.
testCrmReports.py
View file @
bb3876fa
This diff is collapsed.
Click to expand it.
bt5/erp5_crm/TestTemplateItem/portal_components/test.erp5.testCrmReports.xml
0 → 100644
View file @
bb3876fa
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Test Component"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
testCrmReports
</string>
</value>
</item>
<item>
<key>
<string>
default_source_reference
</string>
</key>
<value>
<string>
Products.ERP5.tests.testCrmReports
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
test.erp5.testCrmReports
</string>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Test Component
</string>
</value>
</item>
<item>
<key>
<string>
sid
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
text_content_error_message
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
text_content_warning_message
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
version
</string>
</key>
<value>
<string>
erp5
</string>
</value>
</item>
<item>
<key>
<string>
workflow_history
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAM=
</string>
</persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.Workflow"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_log
</string>
</key>
<value>
<list>
<dictionary>
<item>
<key>
<string>
action
</string>
</key>
<value>
<string>
validate
</string>
</value>
</item>
<item>
<key>
<string>
validation_state
</string>
</key>
<value>
<string>
validated
</string>
</value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_crm/bt/template_test_id_list
View file @
bb3876fa
test.erp5.testCRM
test.erp5.testCRMNotificationTool
test.erp5.testCRMSupportRequest
test.erp5.testCrmReports
test.erp5.testERP5WebWithCRM
\ No newline at end of file
bt5/erp5_crm/bt/test_dependency_list
View file @
bb3876fa
erp5_full_text_mroonga_catalog
erp5_core_test
erp5_web
\ No newline at end of file
erp5_web
erp5_core_proxy_field_legacy
erp5_pdm
erp5_dms
\ No newline at end of file
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