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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Papa Tamsir Kane
erp5
Commits
48a6f8f8
Commit
48a6f8f8
authored
Aug 30, 2017
by
Papa Tamsir Kane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_web_bookmark: rename test class and add test for alarm
parent
16079faa
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
71 additions
and
16 deletions
+71
-16
bt5/erp5_web_bookmark/TestTemplateItem/portal_components/test.erp5.testBookmarkUrl.py
...mplateItem/portal_components/test.erp5.testBookmarkUrl.py
+44
-10
bt5/erp5_web_bookmark/TestTemplateItem/portal_components/test.erp5.testBookmarkUrl.xml
...plateItem/portal_components/test.erp5.testBookmarkUrl.xml
+26
-5
bt5/erp5_web_bookmark/bt/template_test_id_list
bt5/erp5_web_bookmark/bt/template_test_id_list
+1
-1
No files found.
bt5/erp5_web_bookmark/TestTemplateItem/portal_components/test.erp5.testUrl.py
→
bt5/erp5_web_bookmark/TestTemplateItem/portal_components/test.erp5.test
Bookmark
Url.py
View file @
48a6f8f8
...
...
@@ -26,15 +26,17 @@
##############################################################################
from
Products.ERP5Type.tests.SecurityTestCase
import
SecurityTestCase
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
class
Test
Url
(
Security
TestCase
):
class
Test
BookmarkUrl
(
SecurityTestCase
,
ERP5Type
TestCase
):
"""
Test url
_
module
Test url
module
"""
user_id_dict
=
{}
objects_to_delete
=
[]
def
getTitle
(
self
):
return
"testUrl"
return
"test
Bookmark
Url"
def
getBusinessTemplateList
(
self
):
"""
...
...
@@ -70,12 +72,24 @@ class TestUrl(SecurityTestCase):
self
.
url_module
=
self
.
portal
.
getDefaultModule
(
portal_type
=
'Url'
)
self
.
assertTrue
(
self
.
url_module
is
not
None
)
def
_newUrl
(
self
,
reference
,
url_string
,
title
=
''
,
description
=
''
):
def
beforeTearDown
(
self
):
portal
=
self
.
portal
# delete objects creared by the tests
for
path
in
self
.
objects_to_delete
:
created_object
=
portal
.
unrestrictedTraverse
(
path
,
None
)
if
created_object
is
None
:
continue
created_object_id
=
created_object
.
getId
()
created_object_parent
=
created_object
.
getParentValue
()
created_object_parent
.
_delObject
(
created_object_id
)
# Unindex deleted objects
self
.
tic
()
def
_newUrl
(
self
,
coordinate_text
,
title
=
''
,
description
=
''
):
return
self
.
url_module
.
newContent
(
portal_type
=
'Url'
,
reference
=
reference
,
title
=
title
,
url_string
=
url_string
,
coordinate_text
=
coordinate_text
,
description
=
description
,
)
...
...
@@ -88,17 +102,37 @@ class TestUrl(SecurityTestCase):
self
.
assertUserCanAccessDocument
(
self
.
user_id_dict
[
'testuser1'
],
self
.
url_module
)
self
.
assertUserCanViewDocument
(
self
.
user_id_dict
[
'testuser1'
],
self
.
url_module
)
self
.
assertUserCanAddDocument
(
self
.
user_id_dict
[
'testuser1'
],
self
.
url_module
)
self
.
loginByUserName
(
'testuser1'
)
url
=
self
.
_newUrl
(
reference
=
'url1'
,
url_string
=
'
testurl1.com'
)
url
=
self
.
_newUrl
(
title
=
'testurl1'
,
coordinate_text
=
'https://
testurl1.com'
)
self
.
assertUserCanAccessDocument
(
self
.
user_id_dict
[
'testuser1'
],
url
)
self
.
assertUserCanViewDocument
(
self
.
user_id_dict
[
'testuser1'
],
url
)
#
self.assertUserCanAddDocument(self.user_id_dict['testuser1'], url)
self
.
assertUserCanAddDocument
(
self
.
user_id_dict
[
'testuser1'
],
url
)
def
test_03_only_owner_can_access_url
(
self
):
self
.
loginByUserName
(
'testuser1'
)
url
=
self
.
_newUrl
(
reference
=
'url1'
,
url_string
=
'
testurl1.com'
)
url
=
self
.
_newUrl
(
title
=
'testurl1'
,
coordinate_text
=
'https://
testurl1.com'
)
self
.
failIfUserCanAccessDocument
(
self
.
user_id_dict
[
'testuser2'
],
url
)
self
.
failIfUserCanViewDocument
(
self
.
user_id_dict
[
'testuser2'
],
url
)
def
test_04_curation_request_is_created_for_draft_urls
(
self
):
self
.
login
()
url
=
self
.
_newUrl
(
title
=
'testurl1'
,
coordinate_text
=
'https://testurl1.com'
)
self
.
tic
()
self
.
objects_to_delete
.
append
(
url
.
getPath
())
alarm
=
self
.
portal
.
portal_alarms
.
create_curation_request_for_new_url
alarm
.
activeSense
()
self
.
tic
()
curation_request_lines
=
url
.
getAggregateRelatedValueList
(
portal_type
=
'Curation Request Line'
)
self
.
assertEqual
(
len
(
curation_request_lines
),
1
)
curation_request
=
curation_request_lines
[
0
].
getParentValue
()
self
.
objects_to_delete
.
append
(
curation_request
.
getPath
())
for
line
in
curation_request
.
contentValues
(
portal_type
=
'Curation Request Line'
):
aggregated
=
line
.
getAggregateValue
()
if
aggregated
.
getPortalType
()
==
'Curation Record'
:
self
.
objects_to_delete
.
append
(
aggregated
.
getPath
())
break
\ No newline at end of file
bt5/erp5_web_bookmark/TestTemplateItem/portal_components/test.erp5.testUrl.xml
→
bt5/erp5_web_bookmark/TestTemplateItem/portal_components/test.erp5.test
Bookmark
Url.xml
View file @
48a6f8f8
...
...
@@ -6,9 +6,15 @@
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_recorded_property_dict
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
testUrl
</string>
</value>
<value>
<string>
test
Bookmark
Url
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
...
...
@@ -18,7 +24,7 @@
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
test.erp5.testUrl
</string>
</value>
<value>
<string>
test.erp5.test
Bookmark
Url
</string>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
...
...
@@ -49,13 +55,28 @@
<item>
<key>
<string>
workflow_history
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
I
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</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/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
...
...
@@ -68,7 +89,7 @@
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
Q
=
</string>
</persistent>
</value>
</item>
</dictionary>
...
...
@@ -77,7 +98,7 @@
</dictionary>
</pickle>
</record>
<record
id=
"
3"
aka=
"AAAAAAAAAAM
="
>
<record
id=
"
4"
aka=
"AAAAAAAAAAQ
="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.patches.WorkflowTool"
/>
</pickle>
...
...
bt5/erp5_web_bookmark/bt/template_test_id_list
View file @
48a6f8f8
test.erp5.testUrl
\ No newline at end of file
test.erp5.testBookmarkUrl
\ 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