Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
officejs-appstore
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
Romain Courteaud
officejs-appstore
Commits
16fb06c9
Commit
16fb06c9
authored
May 30, 2017
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[officejs_test] Check opening and acception the Software Publication
parent
e5b483f3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
162 additions
and
11 deletions
+162
-11
bt5/officejs_test/TestTemplateItem/portal_components/test.erp5.testOfficeJSScenario.py
...eItem/portal_components/test.erp5.testOfficeJSScenario.py
+158
-7
bt5/officejs_test/TestTemplateItem/portal_components/test.erp5.testOfficeJSScenario.xml
...Item/portal_components/test.erp5.testOfficeJSScenario.xml
+4
-4
No files found.
bt5/officejs_test/TestTemplateItem/portal_components/test.erp5.testOfficeJSScenario.py
View file @
16fb06c9
...
...
@@ -26,12 +26,10 @@ class TestOfficeJSScenario(SecurityTestCase):
def
createNewUser
(
self
,
first_name
=
"John_test"
,
last_name
=
"Smith_test"
,
reference
=
"TEST_OFFICEJS_"
,
email
=
"john.smith@test.com"
):
email
=
"john.smith@example.com"
):
"""
Add new member using script for the website sign-in
"""
reference
+=
"%s"
%
time
.
time
()
user
=
self
.
portal
.
person_module
.
newContent
(
portal_type
=
"Person"
,
first_name
=
first_name
,
...
...
@@ -44,17 +42,37 @@ class TestOfficeJSScenario(SecurityTestCase):
assignment
.
open
()
return
user
def
createNewAdmin
(
self
,
first_name
=
"Brandon_test"
,
last_name
=
"Cougar_test"
,
email
=
"brandon.cougar@example.com"
):
"""
Add new member using script for the website sign-in
"""
user
=
self
.
portal
.
person_module
.
newContent
(
portal_type
=
"Person"
,
first_name
=
first_name
,
last_name
=
last_name
,
default_email_coordinate_text
=
email
,
career_role_list
=
[
"administration"
]
)
user
.
validate
()
assignment
=
user
.
newContent
(
portal_type
=
"Assignment"
,
group
=
"my_group"
)
assignment
.
open
()
return
user
def
test_01_user_can_contribute
(
self
):
timestamp
=
"%s"
%
time
.
time
()
###################################
### Manager: Create user
person
=
self
.
createNewUser
()
person_user
=
self
.
createNewUser
()
person_admin
=
self
.
createNewAdmin
()
self
.
tic
()
###################################
### User: submit application
self
.
logout
()
self
.
login
(
person
.
getUserId
())
self
.
login
(
person
_user
.
getUserId
())
import_file
=
LocalStringIO
(
'your.zip'
)
...
...
@@ -99,7 +117,7 @@ class TestOfficeJSScenario(SecurityTestCase):
page_content
=
response
.
read
()
self
.
assertTrue
(
'document.location.replace("
%s/")'
%
web_section
.
getId
()
in
page_content
,
'document.location.replace("
development/")'
in
page_content
,
page_content
)
self
.
assertTrue
(
...
...
@@ -139,7 +157,7 @@ class TestOfficeJSScenario(SecurityTestCase):
page_content
=
response
.
read
()
self
.
assertEquals
(
"""CACHE MANIFEST
#
%s"""
%
web_section
.
getId
()
,
#
development"""
,
page_content
)
self
.
assertEquals
(
response
.
status
,
200
)
...
...
@@ -184,3 +202,136 @@ class TestOfficeJSScenario(SecurityTestCase):
None
)
self
.
assertEquals
(
response
.
getheader
(
'Vary'
),
None
)
###################################
### User: open the publication to be accepted
self
.
logout
()
self
.
login
(
person_user
.
getUserId
())
software_publication
=
self
.
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
'Software Publication'
,
reference
=
'SP-%s'
%
web_section
.
getId
()
)
software_publication
.
open
()
self
.
tic
()
###################################
### Anonymous: access the redirect application
self
.
logout
()
api_scheme
,
api_netloc
,
api_path
,
api_query
,
\
api_fragment
=
urlparse
.
urlsplit
(
self
.
portal
.
absolute_url
())
connection
=
httplib
.
HTTPConnection
(
api_netloc
)
connection
.
request
(
method
=
'GET'
,
url
=
'%s/'
%
web_section
.
getParentValue
().
absolute_url
()
)
response
=
connection
.
getresponse
()
page_content
=
response
.
read
()
self
.
assertTrue
(
'document.location.replace("development/")'
in
page_content
,
page_content
)
self
.
assertTrue
(
'manifest="WebSection_renderOfficeJSRedirectAppCache"'
in
page_content
,
page_content
)
self
.
assertEquals
(
response
.
status
,
200
)
self
.
assertEquals
(
response
.
getheader
(
'Cache-Control'
),
'max-age=0, public, must-revalidate'
)
self
.
assertEquals
(
response
.
getheader
(
'Content-Type'
),
'text/html; charset=utf-8'
)
self
.
assertEquals
(
response
.
getheader
(
'Content-Security-Policy'
),
"default-src 'self'; script-src 'unsafe-inline';"
)
self
.
assertEquals
(
response
.
getheader
(
'X-Frame-Options'
),
'SAMEORIGIN'
)
self
.
assertEquals
(
response
.
getheader
(
'Vary'
),
'Accept-Language,Cookie,Authorization,Accept-Encoding'
)
###################################
### Site admin: accept the software publication
self
.
logout
()
self
.
login
(
person_admin
.
getUserId
())
software_publication
.
accept
()
self
.
tic
()
###################################
### Anonymous: access the redirect application
self
.
logout
()
connection
.
request
(
method
=
'GET'
,
url
=
'%s/'
%
web_section
.
getParentValue
().
absolute_url
()
)
response
=
connection
.
getresponse
()
page_content
=
response
.
read
()
self
.
assertTrue
(
'document.location.replace("%s/")'
%
web_section
.
getId
()
in
page_content
,
page_content
)
self
.
assertTrue
(
'manifest="WebSection_renderOfficeJSRedirectAppCache"'
in
page_content
,
page_content
)
self
.
assertEquals
(
response
.
status
,
200
)
self
.
assertEquals
(
response
.
getheader
(
'Cache-Control'
),
'max-age=0, public, must-revalidate'
)
self
.
assertEquals
(
response
.
getheader
(
'Content-Type'
),
'text/html; charset=utf-8'
)
self
.
assertEquals
(
response
.
getheader
(
'Content-Security-Policy'
),
"default-src 'self'; script-src 'unsafe-inline';"
)
self
.
assertEquals
(
response
.
getheader
(
'X-Frame-Options'
),
'SAMEORIGIN'
)
self
.
assertEquals
(
response
.
getheader
(
'Vary'
),
'Accept-Language,Cookie,Authorization,Accept-Encoding'
)
###################################
### Anonymous: access the redirect application appcache
connection
.
request
(
method
=
'GET'
,
url
=
'%s/WebSection_renderOfficeJSRedirectAppCache'
%
web_section
.
getParentValue
().
absolute_url
()
)
response
=
connection
.
getresponse
()
page_content
=
response
.
read
()
self
.
assertEquals
(
"""CACHE MANIFEST
# %s"""
%
web_section
.
getId
(),
page_content
)
self
.
assertEquals
(
response
.
status
,
200
)
self
.
assertEquals
(
response
.
getheader
(
'Content-Type'
),
'text/cache-manifest; charset=utf-8'
)
self
.
assertEquals
(
response
.
getheader
(
'Cache-Control'
),
'max-age=0, public, must-revalidate'
)
self
.
assertEquals
(
response
.
getheader
(
'Vary'
),
None
)
bt5/officejs_test/TestTemplateItem/portal_components/test.erp5.testOfficeJSScenario.xml
View file @
16fb06c9
...
...
@@ -46,10 +46,10 @@
<key>
<string>
text_content_warning_message
</string>
</key>
<value>
<tuple>
<string>
W:
89
, 28: Unused variable \'api_path\' (unused-variable)
</string>
<string>
W:
89
, 38: Unused variable \'api_query\' (unused-variable)
</string>
<string>
W:
89
, 4: Unused variable \'api_scheme\' (unused-variable)
</string>
<string>
W:
90
, 6: Unused variable \'api_fragment\' (unused-variable)
</string>
<string>
W:
107
, 28: Unused variable \'api_path\' (unused-variable)
</string>
<string>
W:
107
, 38: Unused variable \'api_query\' (unused-variable)
</string>
<string>
W:
107
, 4: Unused variable \'api_scheme\' (unused-variable)
</string>
<string>
W:
108
, 6: Unused variable \'api_fragment\' (unused-variable)
</string>
</tuple>
</value>
</item>
...
...
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