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
69b7bd25
Commit
69b7bd25
authored
4 years ago
by
florian
Browse files
Options
Downloads
Patches
Plain Diff
WIP: Update test_tickets_300
parent
0ab9db18
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/test_tickets_300.py
+20
-9
20 additions, 9 deletions
tests/test_tickets_300.py
with
20 additions
and
9 deletions
tests/test_tickets_300.py
+
20
−
9
View file @
69b7bd25
...
...
@@ -5,6 +5,8 @@
#
# Copyright (C) 2018 Research Group Biomedical Physics,
# Max-Planck-Institute for Dynamics and Self-Organization Göttingen
# Copyright (C) 2020 Indiscale GmbH <info@indiscale.com>
# Copyright (C) 2020 Florian Spreckelsen <f.spreckelsen@indiscale.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
...
...
@@ -25,12 +27,12 @@
from
__future__
import
unicode_literals
,
print_function
import
caosdb
as
db
from
nose.tools
import
with_setup
,
assert_raises
as
raiz
,
assert_equal
as
eq
from
pytest
import
raises
def
_delete_test_entities
():
try
:
db
.
execute_query
(
"
FIND
Entity WITH id >= 100
"
).
delete
()
db
.
execute_query
(
"
FIND
Test*
"
).
delete
()
except
Exception
as
e
:
print
(
e
)
...
...
@@ -43,14 +45,23 @@ def teardown_module():
_delete_test_entities
()
@with_setup
(
_delete_test_entities
,
_delete_test_entities
)
def
setup
():
setup_module
()
def
teardown
():
teardown_module
()
def
test_ticket_350_insert_with_invalid_ref
():
c
=
db
.
Container
()
e
=
db
.
Entity
(
name
=
"
SomeName
"
)
rt1
=
db
.
RecordType
(
name
=
"
RT1
"
)
rt2
=
db
.
RecordType
(
name
=
"
RT2
"
).
add_property
(
name
=
"
RT1
"
,
value
=
"
SomeName
"
)
e
=
db
.
Entity
(
name
=
"
TestEnt
"
)
rt1
=
db
.
RecordType
(
name
=
"
TestRT1
"
)
rt2
=
db
.
RecordType
(
name
=
"
TestRT2
"
).
add_property
(
name
=
"
TestRT1
"
,
value
=
"
TestEnt
"
)
c
.
extend
([
e
,
rt1
,
rt2
])
with
rai
z
(
db
.
TransactionError
)
as
cm
:
with
rai
ses
(
db
.
TransactionError
)
as
cm
:
c
.
insert
()
eq
(
cm
.
exception
.
errors
[
0
].
msg
,
"
There is no such role
'
Entity
'
.
"
)
eq
(
cm
.
exception
.
errors
[
1
].
msg
,
"
Entity has unqualified properties.
"
)
assert
any
(
[
x
.
msg
==
"
There is no such role
'
Entity
'
.
"
for
x
in
cm
.
value
.
get_errors
()])
assert
cm
.
value
.
has_error
(
db
.
UnqualifiedPropertiesError
)
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