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
8f9f28e3
Commit
8f9f28e3
authored
3 years ago
by
florian
Browse files
Options
Downloads
Patches
Plain Diff
ENH: Add xfail test for reference update
parent
4864e16b
No related branches found
No related tags found
2 merge requests
!53
Release 0.1
,
!20
F identifiable test
Pipeline
#23137
passed
3 years ago
Stage: info
Stage: setup
Stage: cert
Stage: style
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
integrationtests/test_data/extroot/realworld_example/dataset_cfoods.yml
+7
-0
7 additions, 0 deletions
...ts/test_data/extroot/realworld_example/dataset_cfoods.yml
integrationtests/test_realworld_example.py
+65
-4
65 additions, 4 deletions
integrationtests/test_realworld_example.py
with
72 additions
and
4 deletions
integrationtests/test_data/extroot/realworld_example/dataset_cfoods.yml
+
7
−
0
View file @
8f9f28e3
...
@@ -318,6 +318,13 @@ Data:
...
@@ -318,6 +318,13 @@ Data:
Dataset
:
Dataset
:
Project
:
$Project
Project
:
$Project
subtree
:
subtree
:
name_element
:
type
:
DictTextElement
match_name
:
"
name"
match_value
:
"
(?P<name>.*)"
records
:
Project
:
name
:
$name
full_name_element
:
full_name_element
:
type
:
DictTextElement
type
:
DictTextElement
match_name
:
"
full_name"
match_name
:
"
full_name"
...
...
This diff is collapsed.
Click to expand it.
integrationtests/test_realworld_example.py
+
65
−
4
View file @
8f9f28e3
...
@@ -129,14 +129,75 @@ def test_dataset(
...
@@ -129,14 +129,75 @@ def test_dataset(
reason
=
"
Reference properties are not updated correctly.
"
reason
=
"
Reference properties are not updated correctly.
"
"
See https://gitlab.indiscale.com/caosdb/src/caosdb-crawler/-/issues/12.
"
"
See https://gitlab.indiscale.com/caosdb/src/caosdb-crawler/-/issues/12.
"
)
)
def
test_event_update
(
usemodel
):
def
test_event_update
(
clear_database
,
usemodel
):
ident
=
CaosDBIdentifiableAdapter
()
identifiable_path
=
os
.
path
.
join
(
DATADIR
,
"
identifiables.yml
"
)
ident
.
load_from_yaml_definition
(
os
.
path
.
join
(
DATADIR
,
"
identifiables.yml
"
))
crawler_definition_path
=
os
.
path
.
join
(
DATADIR
,
"
dataset_cfoods.yml
"
)
crawler_definition_path
=
os
.
path
.
join
(
DATADIR
,
"
dataset_cfoods.yml
"
)
# TODO(fspreck): Use crawler_main
# TODO(fspreck): Use crawler_main
crawler_main
()
crawler_main
(
os
.
path
.
join
(
DATADIR
,
'
data
'
),
crawler_definition_path
,
identifiable_path
,
True
,
os
.
path
.
join
(
DATADIR
,
"
provenance.yml
"
),
False
,
True
,
""
)
old_dataset_rec
=
db
.
execute_query
(
"
FIND RECORD Dataset WHICH HAS AN EVENT WITH location=
'
Bremen, Germany
'"
)
assert
len
(
old_dataset_rec
)
==
1
old_dataset_rec
=
old_dataset_rec
[
0
]
assert
old_dataset_rec
.
get_property
(
"
Event
"
).
datatype
==
db
.
LIST
(
"
Event
"
)
assert
len
(
old_dataset_rec
.
get_property
(
"
Event
"
).
value
)
==
1
old_event_rec
=
db
.
Record
(
id
=
old_dataset_rec
.
get_property
(
"
Event
"
).
value
[
0
]).
retrieve
()
# TODO(fspreck): crawl again manually, edit the event records in the update
# TODO(fspreck): crawl again manually, edit the event records in the update
# list, synchronize, and test whether the events have been updated.
# list, synchronize, and test whether the events have been updated.
ident
=
CaosDBIdentifiableAdapter
()
ident
.
load_from_yaml_definition
(
identifiable_path
)
second_crawler
=
Crawler
(
identifiableAdapter
=
ident
)
crawler_definition
=
second_crawler
.
load_definition
(
crawler_definition_path
)
converter_registry
=
second_crawler
.
load_converters
(
crawler_definition
)
records
=
second_crawler
.
start_crawling
(
Directory
(
"
data
"
,
os
.
path
.
join
(
DATADIR
,
"
data
"
)),
crawler_definition
,
converter_registry
)
for
rec
in
records
:
if
rec
.
parents
[
0
].
name
==
"
Event
"
:
rec
.
get_property
(
"
longitude
"
).
value
=
0.0
rec
.
get_property
(
"
latitude
"
).
value
=
0.0
rec
.
get_property
(
"
location
"
).
value
=
"
Origin
"
elif
rec
.
parents
[
0
].
name
==
"
Dataset
"
:
rec
.
get_property
(
"
Event
"
).
value
[
0
].
get_property
(
"
longitude
"
).
value
=
0.0
rec
.
get_property
(
"
Event
"
).
value
[
0
].
get_property
(
"
latitude
"
).
value
=
0.0
rec
.
get_property
(
"
Event
"
).
value
[
0
].
get_property
(
"
location
"
).
value
=
"
Origin
"
second_crawler
.
synchronize
()
# Dataset is still the same Record, but with an updated event
new_dataset_rec
=
db
.
Record
(
id
=
old_dataset_rec
.
id
).
retrieve
()
assert
new_dataset_rec
.
get_property
(
"
title
"
).
value
==
old_dataset_rec
.
get_property
(
"
title
"
).
value
assert
new_dataset_rec
.
get_property
(
"
Event
"
).
datatype
==
db
.
LIST
(
"
Event
"
)
assert
new_dataset_rec
.
get_property
(
"
Event
"
).
value
is
not
None
assert
len
(
new_dataset_rec
.
get_property
(
"
Event
"
).
value
)
==
1
assert
new_dataset_rec
.
get_property
(
"
Event
"
).
value
[
0
]
!=
old_event_rec
.
id
# The event has new properties
new_event_rec
=
db
.
Record
(
id
=
new_dataset_rec
.
get_property
(
"
Event
"
).
value
[
0
]).
retrieve
()
assert
new_event_rec
.
get_property
(
"
longitude
"
).
value
==
0.0
assert
new_event_rec
.
get_property
(
"
latitude
"
).
value
==
0.0
assert
new_event_rec
.
get_property
(
"
location
"
).
value
==
"
Origin
"
assert
new_event_rec
.
get_property
(
"
start_datetime
"
).
value
==
old_event_rec
.
get_property
(
"
start_datetime
"
).
value
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