Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
CaosDB Crawler
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
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 Crawler
Commits
84cb3251
Commit
84cb3251
authored
7 months ago
by
Florian Spreckelsen
Browse files
Options
Downloads
Plain Diff
Merge branch 'f-parent-updates' into 'dev'
System test for confirming issue
#14
(parent updates) See merge request
!190
parents
a035d56d
299ab3c3
No related branches found
No related tags found
2 merge requests
!198
REL: Release 0.10.0
,
!190
System test for confirming issue #14 (parent updates)
Pipeline
#56893
passed with warnings
7 months ago
Stage: info
Stage: setup
Stage: cert
Stage: style
Stage: test
Changes
1
Pipelines
5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
integrationtests/test_issues.py
+45
-0
45 additions, 0 deletions
integrationtests/test_issues.py
with
45 additions
and
0 deletions
integrationtests/test_issues.py
+
45
−
0
View file @
84cb3251
...
@@ -28,6 +28,8 @@ from linkahead.cached import cache_clear
...
@@ -28,6 +28,8 @@ from linkahead.cached import cache_clear
from
linkahead.utils.register_tests
import
clear_database
,
set_test_key
from
linkahead.utils.register_tests
import
clear_database
,
set_test_key
from
pytest
import
fixture
,
mark
,
raises
from
pytest
import
fixture
,
mark
,
raises
import
tempfile
set_test_key
(
"
10b128cf8a1372f30aa3697466bb55e76974e0c16a599bb44ace88f19c8f61e2
"
)
set_test_key
(
"
10b128cf8a1372f30aa3697466bb55e76974e0c16a599bb44ace88f19c8f61e2
"
)
...
@@ -328,3 +330,46 @@ def test_indiscale_87(clear_database):
...
@@ -328,3 +330,46 @@ def test_indiscale_87(clear_database):
print
(
db
.
apiutils
.
compare_entities
(
rec
,
retrieved
))
print
(
db
.
apiutils
.
compare_entities
(
rec
,
retrieved
))
assert
db
.
apiutils
.
empty_diff
(
rec
,
retrieved
)
assert
db
.
apiutils
.
empty_diff
(
rec
,
retrieved
)
print
(
"
---
"
)
print
(
"
---
"
)
def
test_issue_14
(
clear_database
):
"""
Issue title: Some parent updates are required before inserts
https://gitlab.indiscale.com/caosdb/src/caosdb-crawler/-/issues/14
"""
rt1
=
db
.
RecordType
(
name
=
"
RT1
"
)
rt2
=
db
.
RecordType
(
name
=
"
RT2
"
).
insert
()
rt1
.
add_property
(
rt2
,
importance
=
db
.
OBLIGATORY
)
rt1
.
insert
()
r
=
db
.
Record
()
r
.
add_parent
(
rt1
)
with
tempfile
.
NamedTemporaryFile
()
as
tmpf
:
f
=
db
.
File
(
name
=
"
test_parent
"
,
path
=
"
parent_test/file.txt
"
,
file
=
tmpf
.
name
)
f
.
insert
()
# We create a clean new file object here:
f2
=
db
.
File
(
name
=
"
test_parent
"
,
path
=
"
parent_test/file.txt
"
,
file
=
tmpf
.
name
)
f2
.
add_parent
(
rt2
)
r
.
add_property
(
name
=
"
RT2
"
,
value
=
f2
)
# Current state in the database: File without parents
f_test_base
=
db
.
File
(
name
=
"
test_parent
"
).
retrieve
()
assert
len
(
f_test_base
.
parents
)
==
0
assert
len
(
db
.
execute_query
(
"
FIND Record
"
))
==
0
ident
=
CaosDBIdentifiableAdapter
()
ident
.
register_identifiable
(
"
RT1
"
,
db
.
RecordType
().
add_parent
(
name
=
"
RT1
"
).
add_property
(
name
=
"
RT2
"
))
crawler
=
Crawler
(
identifiableAdapter
=
ident
)
crawler
.
synchronize
(
crawled_data
=
[
f2
,
r
])
f_test
=
db
.
File
(
name
=
"
test_parent
"
).
retrieve
()
assert
len
(
f_test
.
parents
)
==
1
assert
f_test
.
parents
[
0
].
name
==
"
RT2
"
records
=
db
.
execute_query
(
"
FIND Record
"
)
assert
len
(
records
)
==
1
assert
records
[
0
].
get_property
(
"
RT2
"
).
value
==
f_test
.
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