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
9ab543c8
Commit
9ab543c8
authored
7 months ago
by
Alexander Schlemmer
Browse files
Options
Downloads
Patches
Plain Diff
feat(tests): system test for issue 14 (parent updates)
parent
a035d56d
Branches
Branches containing commit
Tags
Tags containing commit
2 merge requests
!198
REL: Release 0.10.0
,
!190
System test for confirming issue #14 (parent updates)
Pipeline
#56732
failed
7 months ago
Stage: info
Stage: setup
Stage: cert
Stage: style
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
integrationtests/test_issues.py
+79
-0
79 additions, 0 deletions
integrationtests/test_issues.py
with
79 additions
and
0 deletions
integrationtests/test_issues.py
+
79
−
0
View file @
9ab543c8
...
@@ -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,80 @@ def test_indiscale_87(clear_database):
...
@@ -328,3 +330,80 @@ 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
# Another bug: set id of node?
# 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()
#
# f2 = db.File(name="test_parent").retrieve()
# f2.add_parent(rt2)
# r.add_property(name="RT2", value=f2)
# # cont = db.Container([f2, r])
#
# ident = CaosDBIdentifiableAdapter()
# ident.register_identifiable("R1", db.RecordType().add_parent(
# name="R1").add_property(name="R2"))
# crawler = Crawler(identifiableAdapter=ident)
# crawler.synchronize(crawled_data=[f2, r])
# breakpoint()
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