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
Hide 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 @@
...
@@ -26,15 +26,17 @@
##############################################################################
##############################################################################
from
Products.ERP5Type.tests.SecurityTestCase
import
SecurityTestCase
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
=
{}
user_id_dict
=
{}
objects_to_delete
=
[]
def
getTitle
(
self
):
def
getTitle
(
self
):
return
"testUrl"
return
"test
Bookmark
Url"
def
getBusinessTemplateList
(
self
):
def
getBusinessTemplateList
(
self
):
"""
"""
...
@@ -70,12 +72,24 @@ class TestUrl(SecurityTestCase):
...
@@ -70,12 +72,24 @@ class TestUrl(SecurityTestCase):
self
.
url_module
=
self
.
portal
.
getDefaultModule
(
portal_type
=
'Url'
)
self
.
url_module
=
self
.
portal
.
getDefaultModule
(
portal_type
=
'Url'
)
self
.
assertTrue
(
self
.
url_module
is
not
None
)
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
(
return
self
.
url_module
.
newContent
(
portal_type
=
'Url'
,
portal_type
=
'Url'
,
reference
=
reference
,
title
=
title
,
title
=
title
,
url_string
=
url_string
,
coordinate_text
=
coordinate_text
,
description
=
description
,
description
=
description
,
)
)
...
@@ -88,17 +102,37 @@ class TestUrl(SecurityTestCase):
...
@@ -88,17 +102,37 @@ class TestUrl(SecurityTestCase):
self
.
assertUserCanAccessDocument
(
self
.
user_id_dict
[
'testuser1'
],
self
.
url_module
)
self
.
assertUserCanAccessDocument
(
self
.
user_id_dict
[
'testuser1'
],
self
.
url_module
)
self
.
assertUserCanViewDocument
(
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
.
assertUserCanAddDocument
(
self
.
user_id_dict
[
'testuser1'
],
self
.
url_module
)
self
.
loginByUserName
(
'testuser1'
)
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
.
assertUserCanAccessDocument
(
self
.
user_id_dict
[
'testuser1'
],
url
)
self
.
assertUserCanViewDocument
(
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
):
def
test_03_only_owner_can_access_url
(
self
):
self
.
loginByUserName
(
'testuser1'
)
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
.
failIfUserCanAccessDocument
(
self
.
user_id_dict
[
'testuser2'
],
url
)
self
.
failIfUserCanViewDocument
(
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 @@
...
@@ -6,9 +6,15 @@
</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>
testUrl
</string>
</value>
<value>
<string>
test
Bookmark
Url
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
description
</string>
</key>
<key>
<string>
description
</string>
</key>
...
@@ -18,7 +24,7 @@
...
@@ -18,7 +24,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
id
</string>
</key>
<key>
<string>
id
</string>
</key>
<value>
<string>
test.erp5.testUrl
</string>
</value>
<value>
<string>
test.erp5.test
Bookmark
Url
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
portal_type
</string>
</key>
<key>
<string>
portal_type
</string>
</key>
...
@@ -49,13 +55,28 @@
...
@@ -49,13 +55,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>
...
@@ -68,7 +89,7 @@
...
@@ -68,7 +89,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>
...
@@ -77,7 +98,7 @@
...
@@ -77,7 +98,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.patches.WorkflowTool"
/>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.patches.WorkflowTool"
/>
</pickle>
</pickle>
...
...
bt5/erp5_web_bookmark/bt/template_test_id_list
View file @
48a6f8f8
test.erp5.testUrl
test.erp5.testBookmarkUrl
\ No newline at end of file
\ 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