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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
caosdb
Software
CaosDB Crawler
Commits
0d45980b
Commit
0d45980b
authored
Nov 21, 2022
by
Henrik tom Wörden
Browse files
Options
Downloads
Patches
Plain Diff
TST: reactivate xfail test
parent
f5038ef2
Branches
Branches containing commit
Tags
Tags containing commit
2 merge requests
!91
Release 0.3
,
!67
MAINT: introduce an identifiable class
Pipeline
#30769
failed
Nov 21, 2022
Stage: info
Stage: setup
Stage: cert
Stage: style
Stage: test
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
unittests/test_tool.py
+25
-21
25 additions, 21 deletions
unittests/test_tool.py
with
25 additions
and
21 deletions
unittests/test_tool.py
+
25
−
21
View file @
0d45980b
...
...
@@ -476,7 +476,6 @@ def test_split_into_inserts_and_updates_with_copy_attr(crawler_mocked_identifiab
crawler
.
identifiableAdapter
.
retrieve_identified_record_for_identifiable
.
assert_called
()
@pytest.mark.xfail
()
def
test_has_missing_object_in_references
(
crawler
):
# Simulate remote server content by using the names to identify records
# There are only two known Records with name A and B
...
...
@@ -488,34 +487,31 @@ def test_has_missing_object_in_references(crawler):
}))
# one reference with id -> check
assert
not
crawler
.
_has_missing_object_in_references
(
db
.
Record
(
name
=
"
C
"
)
.
add_parent
(
"
RTC
"
).
add_
propert
y
(
'
d
'
,
123
))
assert
not
crawler
.
_has_missing_object_in_references
(
Identifiable
(
name
=
"
C
"
,
record_type
=
"
RTC
"
,
propert
ies
=
{
'
d
'
:
123
}
))
# one ref with Entity with id -> check
assert
not
crawler
.
_has_missing_object_in_references
(
db
.
Record
(
name
=
"
C
"
)
.
add_parent
(
"
RTC
"
)
.
add_property
(
'
d
'
,
db
.
Record
(
id
=
123
)
.
add_parent
(
"
C
"
)))
assert
not
crawler
.
_has_missing_object_in_references
(
Identifiable
(
name
=
"
C
"
,
record_type
=
"
RTC
"
,
properties
=
{
'
d
'
:
db
.
Record
(
id
=
123
)
.
add_parent
(
"
C
"
)}))
# one ref with id one with Entity with id (mixed) -> check
assert
not
crawler
.
_has_missing_object_in_references
(
db
.
Record
(
name
=
"
C
"
).
add_parent
(
"
RTD
"
)
.
add_property
(
'
d
'
,
123
)
.
add_property
(
'
b
'
,
db
.
Record
(
id
=
123
)
.
add_parent
(
"
RTC
"
)))
assert
not
crawler
.
_has_missing_object_in_references
(
Identifiable
(
name
=
"
C
"
,
record_type
=
"
RTD
"
,
properties
=
{
'
d
'
:
123
,
'
b
'
:
db
.
Record
(
id
=
123
).
add_parent
(
"
RTC
"
)}))
# entity to be referenced in the following
a
=
db
.
Record
(
name
=
"
C
"
).
add_parent
(
"
C
"
).
add_property
(
"
d
"
,
12311
)
# one ref with id one with Entity without id (but not identifying) -> fail
assert
not
crawler
.
_has_missing_object_in_references
(
db
.
Record
(
name
=
"
C
"
).
add_parent
(
"
RTC
"
)
.
add_property
(
'
d
'
,
123
)
.
add_property
(
'
e
'
,
a
))
assert
not
crawler
.
_has_missing_object_in_references
(
Identifiable
(
name
=
"
C
"
,
record_type
=
"
RTC
"
,
properties
=
{
'
d
'
:
123
,
'
e
'
:
a
}))
# one ref with id one with Entity without id (mixed) -> fail
assert
not
crawler
.
_has_missing_object_in_references
(
db
.
Record
(
name
=
"
D
"
).
add_parent
(
"
RTD
"
)
.
add_
propert
y
(
'
d
'
,
123
)
.
add_property
(
'
e
'
,
a
))
assert
not
crawler
.
_has_missing_object_in_references
(
Identifiable
(
name
=
"
D
"
,
record_type
=
"
RTD
"
,
propert
ies
=
{
'
d
'
:
123
,
'
e
'
:
a
})
)
crawler
.
add_to_remote_missing_cache
(
a
)
# one ref with id one with Entity without id but in cache -> check
assert
crawler
.
_has_missing_object_in_references
(
db
.
Record
(
name
=
"
D
"
).
add_parent
(
"
RTD
"
)
.
add_
propert
y
(
'
d
'
,
123
)
.
add_property
(
'
e
'
,
a
))
assert
crawler
.
_has_missing_object_in_references
(
Identifiable
(
name
=
"
D
"
,
record_type
=
"
RTD
"
,
propert
ies
=
{
'
d
'
:
123
,
'
e
'
:
a
})
)
# if this ever fails, the mock up may be removed
crawler
.
identifiableAdapter
.
get_registered_identifiable
.
assert_called
()
...
...
@@ -528,7 +524,8 @@ def test_references_entities_without_ids(crawler, ident):
# id and rec with id
assert
not
crawler
.
_has_reference_value_without_id
(
db
.
Record
().
add_parent
(
"
Person
"
)
.
add_property
(
'
first_name
'
,
123
)
.
add_property
(
'
last_name
'
,
db
.
Record
(
id
=
123
)))
.
add_property
(
'
last_name
'
,
db
.
Record
(
id
=
123
)))
# id and rec with id and one unneeded prop
assert
crawler
.
_has_reference_value_without_id
(
db
.
Record
().
add_parent
(
"
Person
"
)
.
add_property
(
'
first_name
'
,
123
)
...
...
@@ -584,6 +581,9 @@ def reset_mocks(mocks):
def
change_identifiable_prop
(
ident
):
"""
This function is supposed to change a non identifiing property.
"""
for
ent
in
ident
.
_records
:
if
len
(
ent
.
parents
)
==
0
or
ent
.
parents
[
0
].
name
!=
"
Measurement
"
:
continue
...
...
@@ -593,10 +593,14 @@ def change_identifiable_prop(ident):
# change one element; This removes a responsible which is not part of the identifiable
prop
.
value
=
"
2022-01-04
"
return
# If it does not work, this test is not implemented properly
raise
RuntimeError
(
"
Did not find the property that should be changed.
"
)
def
change_non_identifiable_prop
(
ident
):
"""
This function is supposed to change a non identifiing property.
"""
for
ent
in
ident
.
_records
:
if
len
(
ent
.
parents
)
==
0
or
ent
.
parents
[
0
].
name
!=
"
Measurement
"
:
continue
...
...
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