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
d61d5bea
Commit
d61d5bea
authored
Jan 29, 2015
by
Tristan Cavelier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move erp5_access_token unit test to portal_components
parent
d01b1107
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
299 additions
and
53 deletions
+299
-53
bt5/erp5_access_token/TestTemplateItem/portal_components/test.erp5.testERP5AccessTokenAlarm.py
...m/portal_components/test.erp5.testERP5AccessTokenAlarm.py
+3
-3
bt5/erp5_access_token/TestTemplateItem/portal_components/test.erp5.testERP5AccessTokenAlarm.xml
.../portal_components/test.erp5.testERP5AccessTokenAlarm.xml
+123
-0
bt5/erp5_access_token/TestTemplateItem/portal_components/test.erp5.testERP5AccessTokenSkins.py
...m/portal_components/test.erp5.testERP5AccessTokenSkins.py
+47
-48
bt5/erp5_access_token/TestTemplateItem/portal_components/test.erp5.testERP5AccessTokenSkins.xml
.../portal_components/test.erp5.testERP5AccessTokenSkins.xml
+123
-0
bt5/erp5_access_token/bt/template_test_id_list
bt5/erp5_access_token/bt/template_test_id_list
+2
-2
bt5/erp5_access_token/bt/test_dependency_list
bt5/erp5_access_token/bt/test_dependency_list
+1
-0
No files found.
bt5/erp5_access_token/TestTemplateItem/testERP5AccessTokenAlarm.py
→
bt5/erp5_access_token/TestTemplateItem/
portal_components/test.erp5.
testERP5AccessTokenAlarm.py
View file @
d61d5bea
...
...
@@ -22,7 +22,7 @@ class TestERP5AccessTokenAlarm(ERP5TypeTestCase):
}]
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
access_token
,
'validated'
)
self
.
tic
()
self
.
portal
.
portal_alarms
.
\
erp5_garbage_collect_one_time_restricted_access_token
.
activeSense
()
self
.
tic
()
...
...
@@ -38,7 +38,7 @@ class TestERP5AccessTokenAlarm(ERP5TypeTestCase):
)
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
access_token
,
'validated'
)
self
.
tic
()
self
.
portal
.
portal_alarms
.
\
erp5_garbage_collect_one_time_restricted_access_token
.
activeSense
()
self
.
tic
()
...
...
@@ -58,7 +58,7 @@ class TestERP5AccessTokenAlarm(ERP5TypeTestCase):
'action'
:
'foo_action'
}]
self
.
tic
()
self
.
portal
.
portal_alarms
.
\
erp5_garbage_collect_one_time_restricted_access_token
.
activeSense
()
self
.
tic
()
...
...
bt5/erp5_access_token/TestTemplateItem/portal_components/test.erp5.testERP5AccessTokenAlarm.xml
0 → 100644
View file @
d61d5bea
<?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>
_recorded_property_dict
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
testERP5AccessTokenAlarm
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
test.erp5.testERP5AccessTokenAlarm
</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"
>
AAAAAAAAAAM=
</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>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAQ=
</string>
</persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"4"
aka=
"AAAAAAAAAAQ="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.patches.WorkflowTool"
/>
</pickle>
<pickle>
<tuple>
<none/>
<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>
</tuple>
</pickle>
</record>
</ZopeData>
bt5/erp5_access_token/TestTemplateItem/testERP5AccessTokenSkins.py
→
bt5/erp5_access_token/TestTemplateItem/
portal_components/test.erp5.
testERP5AccessTokenSkins.py
View file @
d61d5bea
...
...
@@ -4,17 +4,17 @@ from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
import
transaction
class
TestERP5AccessTokenSkins
(
ERP5TypeTestCase
):
test_token_extraction_id
=
'test_erp5_access_token_extraction'
def
getBusinessTemplateList
(
self
):
return
(
'erp5_base'
,
'erp5_access_token'
)
def
generateNewId
(
self
):
return
str
(
self
.
portal
.
portal_ids
.
generateNewId
(
id_group
=
(
'erp5_access_token_test_id'
)))
def
afterSetUp
(
self
):
"""
This is ran before anything, used to set the environment
...
...
@@ -24,7 +24,7 @@ class TestERP5AccessTokenSkins(ERP5TypeTestCase):
self
.
_setupAccessTokenExtraction
()
transaction
.
commit
()
self
.
tic
()
def
_setupAccessTokenExtraction
(
self
):
pas
=
self
.
portal
.
acl_users
access_extraction_list
=
[
q
for
q
in
pas
.
objectValues
()
\
...
...
@@ -39,7 +39,7 @@ class TestERP5AccessTokenSkins(ERP5TypeTestCase):
elif
len
(
access_extraction_list
)
>
1
:
raise
ValueError
transaction
.
commit
()
def
_createPerson
(
self
,
new_id
):
"""Creates a person in person module, and returns the object, after
indexing is done. """
...
...
@@ -49,11 +49,11 @@ class TestERP5AccessTokenSkins(ERP5TypeTestCase):
person
.
newContent
(
portal_type
=
'Assignment'
).
open
()
transaction
.
commit
()
return
person
def
_getTokenCredential
(
self
,
request
):
plugin
=
getattr
(
self
.
portal
.
acl_users
,
self
.
test_token_extraction_id
)
return
plugin
.
extractCredentials
(
request
)
def
_createRestrictedAccessToken
(
self
,
new_id
,
person
,
method
,
url_string
):
access_token
=
self
.
portal
.
access_token_module
.
newContent
(
portal_type
=
"Restricted Access Token"
,
...
...
@@ -63,7 +63,7 @@ class TestERP5AccessTokenSkins(ERP5TypeTestCase):
if
person
:
access_token
.
edit
(
agent_value
=
person
)
return
access_token
def
_createOneTimeRestrictedAccessToken
(
self
,
new_id
,
person
,
method
,
url_string
):
access_token
=
self
.
portal
.
access_token_module
.
newContent
(
portal_type
=
"One Time Restricted Access Token"
,
...
...
@@ -73,7 +73,7 @@ class TestERP5AccessTokenSkins(ERP5TypeTestCase):
if
person
:
access_token
.
edit
(
agent_value
=
person
)
return
access_token
def
test_working_token
(
self
):
person
=
self
.
person
=
self
.
_createPerson
(
self
.
new_id
)
access_url
=
"http://exemple.com/foo"
...
...
@@ -84,15 +84,15 @@ class TestERP5AccessTokenSkins(ERP5TypeTestCase):
access_url
)
access_token
.
validate
()
self
.
tic
()
self
.
portal
.
REQUEST
.
form
[
"access_token"
]
=
access_token
.
getId
()
self
.
portal
.
REQUEST
[
"REQUEST_METHOD"
]
=
access_method
self
.
portal
.
REQUEST
[
"ACTUAL_URL"
]
=
access_url
self
.
portal
.
REQUEST
.
form
[
"access_token_secret"
]
=
access_token
.
getReference
()
result
=
self
.
_getTokenCredential
(
self
.
portal
.
REQUEST
)
self
.
assertEqual
(
result
.
get
(
'external_login'
),
person
.
getReference
())
def
test_bad_token
(
self
):
person
=
self
.
person
=
self
.
_createPerson
(
self
.
new_id
)
access_url
=
"http://exemple.com/foo"
...
...
@@ -103,15 +103,15 @@ class TestERP5AccessTokenSkins(ERP5TypeTestCase):
access_url
)
access_token
.
validate
()
self
.
tic
()
self
.
portal
.
REQUEST
.
form
[
"access_token"
]
=
"XYSYDT-YDTYSD"
self
.
portal
.
REQUEST
[
"REQUEST_METHOD"
]
=
access_method
self
.
portal
.
REQUEST
[
"ACTUAL_URL"
]
=
access_url
self
.
portal
.
REQUEST
.
form
[
"access_token_secret"
]
=
access_token
.
getReference
()
result
=
self
.
_getTokenCredential
(
self
.
portal
.
REQUEST
)
self
.
assertEqual
(
result
,
{})
def
test_RestrictedAccessToken_getExternalLogin
(
self
):
person
=
self
.
person
=
self
.
_createPerson
(
self
.
new_id
)
access_url
=
"http://exemple.com/foo"
...
...
@@ -122,16 +122,16 @@ class TestERP5AccessTokenSkins(ERP5TypeTestCase):
access_url
)
access_token
.
validate
()
self
.
tic
()
self
.
portal
.
REQUEST
[
"REQUEST_METHOD"
]
=
access_method
self
.
portal
.
REQUEST
[
"ACTUAL_URL"
]
=
access_url
self
.
portal
.
REQUEST
.
form
[
"access_token_secret"
]
=
access_token
.
getReference
()
result
=
access_token
.
RestrictedAccessToken_getExternalLogin
()
self
.
assertEqual
(
result
,
person
.
getReference
())
self
.
assertEqual
(
access_token
.
getValidationState
(),
'validated'
)
def
test_RestrictedAccessToken_getExternalLogin_access_token_secret
(
self
):
person
=
self
.
person
=
self
.
_createPerson
(
self
.
new_id
)
access_url
=
"http://exemple.com/foo"
...
...
@@ -142,23 +142,23 @@ class TestERP5AccessTokenSkins(ERP5TypeTestCase):
access_url
)
access_token
.
validate
()
self
.
tic
()
self
.
portal
.
REQUEST
[
"REQUEST_METHOD"
]
=
access_method
self
.
portal
.
REQUEST
[
"ACTUAL_URL"
]
=
access_url
result
=
access_token
.
RestrictedAccessToken_getExternalLogin
()
self
.
assertEqual
(
result
,
None
)
self
.
portal
.
REQUEST
.
form
[
"access_token_secret"
]
=
"XYXYXYXY"
self
.
assertEqual
(
result
,
None
)
self
.
portal
.
REQUEST
.
form
[
"access_token_secret"
]
=
access_token
.
getReference
()
result
=
access_token
.
RestrictedAccessToken_getExternalLogin
()
self
.
assertEqual
(
result
,
person
.
getReference
())
self
.
assertEqual
(
access_token
.
getValidationState
(),
'validated'
)
def
test_RestrictedAccessToken_getExternalLogin_no_agent
(
self
):
access_url
=
"http://exemple.com/foo"
access_method
=
"GET"
...
...
@@ -168,14 +168,14 @@ class TestERP5AccessTokenSkins(ERP5TypeTestCase):
access_url
)
access_token
.
validate
()
self
.
tic
()
self
.
portal
.
REQUEST
[
"REQUEST_METHOD"
]
=
access_method
self
.
portal
.
REQUEST
[
"ACTUAL_URL"
]
=
access_url
self
.
portal
.
REQUEST
.
form
[
"access_token_secret"
]
=
access_token
.
getReference
()
result
=
access_token
.
RestrictedAccessToken_getExternalLogin
()
self
.
assertEqual
(
result
,
None
)
def
test_RestrictedAccessToken_getExternalLogin_wrong_values
(
self
):
person
=
self
.
person
=
self
.
_createPerson
(
self
.
new_id
)
access_url
=
"http://exemple.com/foo"
...
...
@@ -187,29 +187,29 @@ class TestERP5AccessTokenSkins(ERP5TypeTestCase):
self
.
tic
()
result
=
access_token
.
RestrictedAccessToken_getExternalLogin
()
self
.
assertEqual
(
result
,
None
)
access_token
.
validate
()
self
.
tic
()
self
.
portal
.
REQUEST
[
"REQUEST_METHOD"
]
=
"POST"
self
.
portal
.
REQUEST
[
"ACTUAL_URL"
]
=
access_url
self
.
portal
.
REQUEST
.
form
[
"access_token_secret"
]
=
access_token
.
getReference
()
result
=
access_token
.
RestrictedAccessToken_getExternalLogin
()
self
.
assertEqual
(
result
,
None
)
self
.
portal
.
REQUEST
[
"ACTUAL_URL"
]
=
"http://exemple.com/foo.bar"
result
=
access_token
.
RestrictedAccessToken_getExternalLogin
()
self
.
assertEqual
(
result
,
None
)
access_token
.
invalidate
()
self
.
tic
()
result
=
access_token
.
RestrictedAccessToken_getExternalLogin
()
self
.
assertEqual
(
result
,
None
)
def
test_OneTimeRestrictedAccessToken_getExternalLogin
(
self
):
person
=
self
.
person
=
self
.
_createPerson
(
self
.
new_id
)
access_url
=
"http://exemple.com/foo"
...
...
@@ -220,15 +220,15 @@ class TestERP5AccessTokenSkins(ERP5TypeTestCase):
access_url
)
access_token
.
validate
()
self
.
tic
()
self
.
portal
.
REQUEST
[
"REQUEST_METHOD"
]
=
access_method
self
.
portal
.
REQUEST
[
"ACTUAL_URL"
]
=
access_url
result
=
access_token
.
OneTimeRestrictedAccessToken_getExternalLogin
()
self
.
assertEqual
(
result
,
person
.
getReference
())
self
.
assertEqual
(
access_token
.
getValidationState
(),
'invalidated'
)
def
test_OneTimeRestrictedAccessToken_getExternalLogin_wrong_values
(
self
):
person
=
self
.
person
=
self
.
_createPerson
(
self
.
new_id
)
access_url
=
"http://exemple.com/foo"
...
...
@@ -240,18 +240,17 @@ class TestERP5AccessTokenSkins(ERP5TypeTestCase):
self
.
tic
()
result
=
access_token
.
OneTimeRestrictedAccessToken_getExternalLogin
()
self
.
assertEqual
(
result
,
None
)
access_token
.
validate
()
self
.
tic
()
self
.
portal
.
REQUEST
[
"REQUEST_METHOD"
]
=
"GET"
self
.
portal
.
REQUEST
[
"ACTUAL_URL"
]
=
access_url
result
=
access_token
.
OneTimeRestrictedAccessToken_getExternalLogin
()
self
.
assertEqual
(
result
,
None
)
self
.
portal
.
REQUEST
[
"ACTUAL_URL"
]
=
"http://exemple.com/foo.bar"
result
=
access_token
.
OneTimeRestrictedAccessToken_getExternalLogin
()
self
.
assertEqual
(
result
,
None
)
bt5/erp5_access_token/TestTemplateItem/portal_components/test.erp5.testERP5AccessTokenSkins.xml
0 → 100644
View file @
d61d5bea
<?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>
_recorded_property_dict
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
testERP5AccessTokenSkins
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
test.erp5.testERP5AccessTokenSkins
</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"
>
AAAAAAAAAAM=
</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>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAQ=
</string>
</persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"4"
aka=
"AAAAAAAAAAQ="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.patches.WorkflowTool"
/>
</pickle>
<pickle>
<tuple>
<none/>
<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>
</tuple>
</pickle>
</record>
</ZopeData>
bt5/erp5_access_token/bt/template_test_id_list
View file @
d61d5bea
testERP5AccessTokenAlarm
testERP5AccessTokenSkins
\ No newline at end of file
test.erp5.testERP5AccessTokenAlarm
test.erp5.testERP5AccessTokenSkins
\ No newline at end of file
bt5/erp5_access_token/bt/test_dependency_list
0 → 100644
View file @
d61d5bea
erp5_full_text_mroonga_catalog
\ 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