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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
caosdb
Software
CaosDB Python Integration Tests
Commits
5a8a181b
Verified
Commit
5a8a181b
authored
3 years ago
by
Timm Fitschen
Browse files
Options
Downloads
Patches
Plain Diff
TST: add tests for
caosdb-server#141
parent
424b78bf
No related branches found
No related tags found
No related merge requests found
Pipeline
#24462
failed
3 years ago
Stage: info
Stage: cert
Stage: style
Stage: test
Stage: deploy
Changes
2
Pipelines
131
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
CHANGELOG.md
+1
-0
1 addition, 0 deletions
CHANGELOG.md
tests/test_issues_server.py
+49
-1
49 additions, 1 deletion
tests/test_issues_server.py
with
50 additions
and
1 deletion
CHANGELOG.md
+
1
−
0
View file @
5a8a181b
...
...
@@ -39,6 +39,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
*
Tests for caosdb-server#217
*
Tests for caosdb-pylib#61
*
Test for
[
caosdb-server#136
](
https://gitlab.com/caosdb/caosdb-server/-/issues/136
)
*
Test for
[
caosdb-server#141
](
https://gitlab.com/caosdb/caosdb-server/-/issues/141
)
### Changed (for changes in existing functionality)
...
...
This diff is collapsed.
Click to expand it.
tests/test_issues_server.py
+
49
−
1
View file @
5a8a181b
...
...
@@ -26,15 +26,27 @@ import tempfile
import
time
import
caosdb
as
db
from
caosdb
import
administration
as
admin
import
pytest
from
caosdb.exceptions
import
TransactionError
CURATOR_ROLE
=
"
curator
"
def
setup_module
():
db
.
configure_connection
()
try
:
db
.
execute_query
(
"
FIND ENTITY WITH ID > 99
"
).
delete
()
except
Exception
as
delete_exc
:
print
(
delete_exc
)
try
:
admin
.
_delete_user
(
"
TestUser
"
)
except
Exception
as
delete_exc
:
print
(
delete_exc
)
try
:
admin
.
_delete_role
(
CURATOR_ROLE
)
except
Exception
as
delete_exc
:
print
(
delete_exc
)
def
setup_function
(
function
):
...
...
@@ -44,7 +56,7 @@ def setup_function(function):
def
teardown_function
(
function
):
"""
Deleting entities again.
"""
pass
#
setup_module()
setup_module
()
# ########################### Issue tests start here #####################
...
...
@@ -800,3 +812,39 @@ def test_136():
te
=
err
.
value
assert
te
.
has_error
(
db
.
UnqualifiedPropertiesError
)
assert
"
Cannot parse value to integer
"
in
str
(
te
)
def
test_141
():
"""
Roles with `Grant(*)P` permissions still can
'
t update other people
'
s
entities.
"""
admin
.
_insert_role
(
name
=
CURATOR_ROLE
,
description
=
"
Desc
"
)
perms
=
admin
.
_get_permissions
(
CURATOR_ROLE
)
g
=
admin
.
PermissionRule
(
action
=
"
Grant
"
,
permission
=
"
*
"
,
priority
=
True
)
d
=
admin
.
PermissionRule
(
action
=
"
Deny
"
,
permission
=
"
*
"
,
priority
=
True
)
if
g
in
perms
:
perms
.
remove
(
g
)
if
d
in
perms
:
perms
.
remove
(
d
)
perms
.
add
(
g
)
admin
.
_set_permissions
(
CURATOR_ROLE
,
permission_rules
=
perms
)
perms
=
admin
.
_get_permissions
(
CURATOR_ROLE
)
print
(
perms
)
rt
=
db
.
RecordType
(
name
=
"
TestRT
"
,
description
=
"
Desc1
"
).
insert
()
admin
.
_insert_user
(
name
=
"
TestUser
"
,
password
=
"
Password1!
"
,
status
=
"
ACTIVE
"
)
admin
.
_set_roles
(
username
=
"
TestUser
"
,
roles
=
[
CURATOR_ROLE
])
db
.
configure_connection
(
username
=
"
TestUser
"
,
password_method
=
"
plain
"
,
password
=
"
Password1!
"
)
assert
db
.
Info
().
user_info
.
name
==
"
TestUser
"
assert
db
.
Info
().
user_info
.
roles
==
[
CURATOR_ROLE
]
rt
.
description
=
"
Desc2
"
rt
.
update
()
assert
rt
.
description
==
"
Desc2
"
# switch back to admin user
db
.
configure_connection
()
assert
db
.
execute_query
(
"
FIND TestRT
"
,
unique
=
True
).
description
==
"
Desc2
"
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