Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
CaosDB Python Integration Tests
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
caosdb
Software
CaosDB Python Integration Tests
Commits
42c6e430
Commit
42c6e430
authored
4 years ago
by
Timm Fitschen
Browse files
Options
Downloads
Patches
Plain Diff
Update tests for refactored sss bin dirs
parent
71faec13
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
README.md
+7
-7
7 additions, 7 deletions
README.md
tests/test_issues_server.py
+2
-1
2 additions, 1 deletion
tests/test_issues_server.py
tests/test_server_side_scripting.py
+25
-6
25 additions, 6 deletions
tests/test_server_side_scripting.py
with
34 additions
and
14 deletions
README.md
+
7
−
7
View file @
42c6e430
...
...
@@ -7,13 +7,13 @@ CaosDB project.
# Getting started #
To run tests, start up a CaosDB server (documentation for this can be found
elsewhere). Then modify
`pycaosdb.ini.template`
accordingly and save it as
`pycaosdb.ini`
. Then you can run the tests with
`pytest`
or
`pytest-3`
(depending on your system)
.
If you want to run just a single test, you can also select a single test file:
`pytest-3 tests/test_issues.py`
-
To run tests, start up a CaosDB server
with
(documentation for this can be found
elsewhere).
-
The CaosDB server must have debugging enabled.
-
Certificates must be valid and be listed in
`pycaosdb.ini`
.
-
Modify
`pycaosdb.ini.template`
accordingly and save it as
`pycaosdb.ini`
.
-
Run the tests with
`pytest`
or
`pytest-3`
(depending on your system).
-
If you want to run just a single test, you can also select a single test file:
`pytest-3 tests/test_issues.py`
# Further Reading
...
...
This diff is collapsed.
Click to expand it.
tests/test_issues_server.py
+
2
−
1
View file @
42c6e430
...
...
@@ -147,7 +147,8 @@ def test_issue_99():
"""
Checksum updating failed with versioning enabled.
"""
# Using files in extroot, because this allows us to update the file content from the outside.
# Using files in extroot, because this allows us to update the file
# content from the outside.
local_dir
=
os
.
path
.
join
(
db
.
get_config
().
get
(
"
IntegrationTests
"
,
"
test_files.test_insert_files_in_dir.local
"
),
"
test_issue_99
"
)
...
...
This diff is collapsed.
Click to expand it.
tests/test_server_side_scripting.py
+
25
−
6
View file @
42c6e430
...
...
@@ -63,7 +63,7 @@ def setup():
def
teardown
():
admin
.
set_server_property
(
"
SERVER_SIDE_SCRIPTING_BIN_DIR
"
,
admin
.
set_server_property
(
"
SERVER_SIDE_SCRIPTING_BIN_DIR
S
"
,
_ORIGINAL_SERVER_SCRIPTING_BIN_DIR
)
clean_database
()
...
...
@@ -71,7 +71,7 @@ def teardown():
def
setup_module
():
global
_ORIGINAL_SERVER_SCRIPTING_BIN_DIR
_ORIGINAL_SERVER_SCRIPTING_BIN_DIR
=
admin
.
get_server_property
(
"
SERVER_SIDE_SCRIPTING_BIN_DIR
"
)
"
SERVER_SIDE_SCRIPTING_BIN_DIR
S
"
)
clean_database
()
from
os
import
makedirs
...
...
@@ -113,7 +113,7 @@ def test_call_script_non_existing():
def
test_call_script_not_executable
():
admin
.
set_server_property
(
"
SERVER_SIDE_SCRIPTING_BIN_DIR
"
,
admin
.
set_server_property
(
"
SERVER_SIDE_SCRIPTING_BIN_DIR
S
"
,
_SERVER_SIDE_SCRIPTING_BIN_DIR_SERVER
)
form
=
dict
()
form
[
"
call
"
]
=
"
not_executable
"
...
...
@@ -123,7 +123,7 @@ def test_call_script_not_executable():
def
test_call_ok
():
admin
.
set_server_property
(
"
SERVER_SIDE_SCRIPTING_BIN_DIR
"
,
admin
.
set_server_property
(
"
SERVER_SIDE_SCRIPTING_BIN_DIR
S
"
,
_SERVER_SIDE_SCRIPTING_BIN_DIR_SERVER
)
form
=
dict
()
form
[
"
call
"
]
=
"
ok
"
...
...
@@ -136,7 +136,7 @@ def test_call_ok():
def
test_call_err
():
admin
.
set_server_property
(
"
SERVER_SIDE_SCRIPTING_BIN_DIR
"
,
admin
.
set_server_property
(
"
SERVER_SIDE_SCRIPTING_BIN_DIR
S
"
,
_SERVER_SIDE_SCRIPTING_BIN_DIR_SERVER
)
form
=
dict
()
form
[
"
call
"
]
=
"
err
"
...
...
@@ -352,7 +352,7 @@ def test_anonymous_script_calling_not_permitted():
def
test_anonymous_script_calling_success
():
admin
.
set_server_property
(
"
SERVER_SIDE_SCRIPTING_BIN_DIR
"
,
admin
.
set_server_property
(
"
SERVER_SIDE_SCRIPTING_BIN_DIR
S
"
,
_SERVER_SIDE_SCRIPTING_BIN_DIR_SERVER
)
form
=
dict
()
form
[
"
call
"
]
=
"
ok_anonymous
"
...
...
@@ -379,3 +379,22 @@ def test_anonymous_script_calling_success():
assert
xml
.
xpath
(
"
/Response/script/stdout
"
)[
0
].
text
==
"
ok_anonymous
"
assert
xml
.
xpath
(
"
/Response/script/stderr
"
)[
0
].
text
is
None
assert
xml
.
xpath
(
"
/Response/script/@code
"
)[
0
]
==
"
0
"
def
test_evil_path
():
subdir
=
os
.
path
.
join
(
_SERVER_SIDE_SCRIPTING_BIN_DIR_LOCAL
,
"
subdir
"
)
if
not
os
.
path
.
exists
(
subdir
):
os
.
makedirs
(
subdir
)
_REMOVE_FILES_AFTERWARDS
.
append
(
subdir
)
admin
.
set_server_property
(
"
SERVER_SIDE_SCRIPTING_BIN_DIRS
"
,
os
.
path
.
join
(
_SERVER_SIDE_SCRIPTING_BIN_DIR_SERVER
,
"
subdir
"
))
# ok exists one level up from "subdir"
assert
os
.
path
.
exists
(
os
.
path
.
join
(
_SERVER_SIDE_SCRIPTING_BIN_DIR_LOCAL
,
"
ok
"
))
with
raises
(
EntityDoesNotExistError
):
r
=
run_server_side_script
(
"
../ok
"
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment