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
2b178e0d
Commit
2b178e0d
authored
10 months ago
by
Henrik tom Wörden
Browse files
Options
Downloads
Patches
Plain Diff
TST: add tests for get_entity...
parent
15b2e3f1
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!78
TST: add tests for get_entity...
Pipeline
#51114
failed
10 months ago
Stage: info
Stage: setup
Stage: cert
Stage: style
Stage: test
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/test_query.py
+23
-0
23 additions, 0 deletions
tests/test_query.py
with
23 additions
and
0 deletions
tests/test_query.py
+
23
−
0
View file @
2b178e0d
...
...
@@ -32,6 +32,7 @@ import random
import
caosdb
as
db
from
caosdb.connection.connection
import
get_connection
from
linkahead.utils
import
get_entity_by_name
,
get_entity_by_id
,
get_entity_by_path
from
caosdb.exceptions
import
EmptyUniqueQueryError
,
TransactionError
from
lxml
import
etree
from
pytest
import
mark
,
raises
...
...
@@ -1470,3 +1471,25 @@ def test_find_id():
assert
db
.
execute_query
(
"
FIND TestRT3 WITH TestRT1
"
,
unique
=
True
).
id
==
rt3
.
id
assert
db
.
execute_query
(
f
"
FIND
{
rt2
.
id
}
WITH TestRT1
"
,
unique
=
True
).
id
==
rt3
.
id
assert
db
.
execute_query
(
f
"
FIND
{
rt3
.
id
}
WITH TestRT1
"
,
unique
=
True
).
id
==
rt3
.
id
def
test_get_entity
():
person
=
db
.
RecordType
(
"
TestPerson
"
).
insert
()
db
.
Property
(
"
TestFirstName
"
,
datatype
=
db
.
TEXT
).
insert
()
con
=
db
.
Property
(
"
TestConductor
"
,
datatype
=
db
.
REFERENCE
).
insert
()
db
.
RecordType
(
"
TestConductor
"
).
insert
(
unique
=
False
)
# create testfile
f
=
open
(
"
test.dat
"
,
"
w
"
)
f
.
write
(
"
hello world
\n
"
)
f
.
close
()
'''
prepare file record
'''
f
=
db
.
File
(
name
=
"
TestFile
"
,
path
=
'
testfiles/testfile
'
,
file
=
"
test.dat
"
)
f
.
insert
()
assert
get_entity_by_id
(
person
.
id
).
id
==
person
.
id
assert
get_entity_by_name
(
person
.
name
).
id
==
person
.
id
assert
get_entity_by_id
(
person
.
id
,
role
=
"
RecordType
"
).
id
==
person
.
id
assert
get_entity_by_name
(
"
TestConductor
"
,
role
=
"
Property
"
).
id
==
con
.
id
assert
get_entity_by_path
(
f
.
path
).
id
==
f
.
id
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