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
Sebastien Robin
erp5
Commits
bc6581c2
Commit
bc6581c2
authored
Nov 08, 2016
by
Sebastien Robin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
testnode: disallow frontend access to all folders, avoiding publishing private repositories
parent
7ea66035
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
0 deletions
+24
-0
erp5/tests/testERP5TestNode.py
erp5/tests/testERP5TestNode.py
+6
-0
erp5/util/testnode/NodeTestSuite.py
erp5/util/testnode/NodeTestSuite.py
+18
-0
No files found.
erp5/tests/testERP5TestNode.py
View file @
bc6581c2
...
@@ -204,6 +204,12 @@ class ERP5TestNode(TestCase):
...
@@ -204,6 +204,12 @@ class ERP5TestNode(TestCase):
node_test_suite
.
working_directory
)
node_test_suite
.
working_directory
)
self
.
assertEquals
(
"%s/foo/test_suite"
%
self
.
working_directory
,
self
.
assertEquals
(
"%s/foo/test_suite"
%
self
.
working_directory
,
node_test_suite
.
test_suite_directory
)
node_test_suite
.
test_suite_directory
)
access_path
=
"%s/foo/.htaccess"
%
self
.
working_directory
with
open
(
access_path
,
'r'
)
as
access_file
:
self
.
assertEqual
(
"""Require all denied"""
,
access_file
.
read
())
node_test_suite
.
edit
(
cluster_configuration
=
{
'test-url'
:
'https://something.com'
})
self
.
assertEqual
(
False
,
os
.
path
.
exists
(
access_path
))
def
test_03_NodeTestSuiteCheckDataAfterEdit
(
self
):
def
test_03_NodeTestSuiteCheckDataAfterEdit
(
self
):
"""
"""
...
...
erp5/util/testnode/NodeTestSuite.py
View file @
bc6581c2
...
@@ -70,12 +70,30 @@ class NodeTestSuite(SlapOSInstance):
...
@@ -70,12 +70,30 @@ class NodeTestSuite(SlapOSInstance):
def
edit
(
self
,
**
kw
):
def
edit
(
self
,
**
kw
):
super
(
NodeTestSuite
,
self
).
edit
(
**
kw
)
super
(
NodeTestSuite
,
self
).
edit
(
**
kw
)
def
_disallowFrontendIfNeeded
(
self
):
"""
Some test suite need to expose some code through a frontend to launch remote
tests on remote web browsers. For now, it is not clearly defined how to give
access to just needed parts of the code. Until this is reworked, disallow
access by default, and enable access only on test suite using remote web
browsers.
"""
access_path
=
os
.
path
.
join
(
self
.
working_directory
,
'.htaccess'
)
# the way to identify a test suite launching remote browsers will change
# in the future, when we will have Browser Test Suite on master side
if
getattr
(
self
,
'cluster_configuration'
,
{}).
get
(
'test-url'
)
is
None
:
with
open
(
access_path
,
'w'
)
as
access_file
:
access_file
.
write
(
"""Require all denied"""
)
elif
os
.
path
.
exists
(
access_path
):
os
.
unlink
(
access_path
)
def
_checkData
(
self
):
def
_checkData
(
self
):
if
getattr
(
self
,
"working_directory"
,
None
)
is
not
None
:
if
getattr
(
self
,
"working_directory"
,
None
)
is
not
None
:
if
not
(
self
.
working_directory
.
endswith
(
os
.
path
.
sep
+
self
.
reference
)):
if
not
(
self
.
working_directory
.
endswith
(
os
.
path
.
sep
+
self
.
reference
)):
self
.
working_directory
=
os
.
path
.
join
(
self
.
working_directory
,
self
.
working_directory
=
os
.
path
.
join
(
self
.
working_directory
,
self
.
reference
)
self
.
reference
)
SlapOSControler
.
createFolder
(
self
.
working_directory
)
SlapOSControler
.
createFolder
(
self
.
working_directory
)
self
.
_disallowFrontendIfNeeded
()
self
.
test_suite_directory
=
os
.
path
.
join
(
self
.
test_suite_directory
=
os
.
path
.
join
(
self
.
working_directory
,
"test_suite"
)
self
.
working_directory
,
"test_suite"
)
self
.
custom_profile_path
=
os
.
path
.
join
(
self
.
working_directory
,
self
.
custom_profile_path
=
os
.
path
.
join
(
self
.
working_directory
,
...
...
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