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
Matevz Golob
erp5
Commits
9b5b531b
Commit
9b5b531b
authored
Jun 27, 2017
by
Tomáš Peterka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[erp5_hal_json_style] Add comments with usage of test annotations
parent
c0af70fd
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
0 deletions
+17
-0
bt5/erp5_hal_json_style/TestTemplateItem/portal_components/test.erp5.testHalJsonStyle.py
...plateItem/portal_components/test.erp5.testHalJsonStyle.py
+17
-0
No files found.
bt5/erp5_hal_json_style/TestTemplateItem/portal_components/test.erp5.testHalJsonStyle.py
View file @
9b5b531b
...
...
@@ -14,6 +14,10 @@ import json
import
urllib
def
changeSkin
(
skin_name
):
"""Change skin for following commands and attribute resolution.
Caution: In case of more annotations, this one has to be at the bottom (last)!
"""
def
decorator
(
func
):
def
wrapped
(
self
,
*
args
,
**
kwargs
):
default_skin
=
self
.
portal
.
portal_skins
.
default_skin
...
...
@@ -29,6 +33,18 @@ def changeSkin(skin_name):
return
decorator
def
simulate
(
script_id
,
params_string
,
code_string
):
"""Create temporary script in portal_skins/custom.
In case of unexpectedly interrupted test you need to clean that folder manually!
Examples of usage:
@simulate('Base_getRequestHeader', '*args, **kwargs', 'return "application/hal+json"')
Will make ERP5Document_getHateoas believe that any request accepts given MIME response.
@simulate('Base_getRequestUrl', '*args, **kwargs', 'return "http://example.org/bar"')
TBD.
"""
def
upperWrap
(
f
):
@
wraps
(
f
)
def
decorated
(
self
,
*
args
,
**
kw
):
...
...
@@ -48,6 +64,7 @@ def simulate(script_id, params_string, code_string):
return
upperWrap
def
createIndexedDocument
():
"""Create a Foo document inside Foo module and pass it as "document" argument into wrapped function."""
def
decorator
(
func
):
def
wrapped
(
self
,
*
args
,
**
kwargs
):
kwargs
.
update
(
document
=
self
.
_makeDocument
())
...
...
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