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
04bcb680
Commit
04bcb680
authored
2 years ago
by
Henrik tom Wörden
Browse files
Options
Downloads
Patches
Plain Diff
up
parent
4698c94f
Branches
Branches containing commit
Tags
Tags containing commit
2 merge requests
!71
REL: RElease v0.2.0
,
!5
FIX: use identifiable instead of record
Pipeline
#29352
failed
2 years 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
unittests/test_tool.py
+29
-27
29 additions, 27 deletions
unittests/test_tool.py
with
29 additions
and
27 deletions
unittests/test_tool.py
+
29
−
27
View file @
04bcb680
...
@@ -512,8 +512,6 @@ def test_all_references_are_existing_already2(crawler):
...
@@ -512,8 +512,6 @@ def test_all_references_are_existing_already2(crawler):
crawler
.
identifiableAdapter
.
get_registered_identifiable
=
Mock
(
side_effect
=
partial
(
crawler
.
identifiableAdapter
.
get_registered_identifiable
=
Mock
(
side_effect
=
partial
(
basic_ident_lookup
,
idents
=
registered_identifiables
))
basic_ident_lookup
,
idents
=
registered_identifiables
))
# no reference to check
assert
crawler
.
all_references_are_existing_already
(
db
.
Record
().
add_parent
(
"
C
"
))
# one reference with id
# one reference with id
assert
crawler
.
all_references_are_existing_already
(
assert
crawler
.
all_references_are_existing_already
(
db
.
Record
().
add_parent
(
"
C
"
).
add_property
(
'
a
'
,
123
))
db
.
Record
().
add_parent
(
"
C
"
).
add_property
(
'
a
'
,
123
))
...
@@ -540,24 +538,27 @@ def test_all_references_are_existing_already(crawler):
...
@@ -540,24 +538,27 @@ def test_all_references_are_existing_already(crawler):
# Simulate remote server content by using the names to identify records
# Simulate remote server content by using the names to identify records
# There are only two known Records with name A and B
# There are only two known Records with name A and B
crawler
.
identifiableAdapter
.
get_registered_identifiable
=
Mock
(
side_effect
=
partial
(
crawler
.
identifiableAdapter
.
get_registered_identifiable
=
Mock
(
side_effect
=
partial
(
basic_retrieve_by_name_mock_up
,
known
=
{
"
A
"
:
db
.
Record
(
name
=
"
A
"
).
add_parent
(
"
C
"
),
basic_retrieve_by_name_mock_up
,
known
=
{
"
C
"
:
db
.
Record
(
name
=
"
C
"
).
add_parent
(
"
C
"
)
"
B
"
:
db
.
Record
(
name
=
"
B
"
).
add_parent
(
"
C
"
)}))
.
add_property
(
"
d
"
),
"
D
"
:
db
.
Record
(
name
=
"
D
"
).
add_parent
(
"
D
"
)
.
add_property
(
"
d
"
).
add_property
(
"
e
"
),
}))
assert
crawler
.
all_references_are_existing_already
(
assert
crawler
.
all_references_are_existing_already
(
db
.
Record
().
add_property
(
'
a
'
,
123
))
db
.
Record
(
name
=
"
C
"
).
add_parent
(
"
C
"
).
add_property
(
'
d
'
,
123
))
assert
crawler
.
all_references_are_existing_already
(
db
.
Record
()
assert
crawler
.
all_references_are_existing_already
(
db
.
Record
(
name
=
"
C
"
)
.
add_property
(
'
a
'
,
db
.
Record
(
id
=
123
)))
.
add_property
(
'
d
'
,
db
.
Record
(
id
=
123
)))
assert
crawler
.
all_references_are_existing_already
(
db
.
Record
().
add_parent
(
"
D
"
)
assert
crawler
.
all_references_are_existing_already
(
db
.
Record
(
name
=
"
C
"
).
add_parent
(
"
D
"
)
.
add_property
(
'
a
'
,
123
)
.
add_property
(
'
d
'
,
123
)
.
add_property
(
'
b
'
,
db
.
Record
(
id
=
123
)))
.
add_property
(
'
b
'
,
db
.
Record
(
id
=
123
)))
a
=
db
.
Record
(
name
=
"
A
"
).
add_parent
(
"
C
"
).
add_property
(
"
a
"
,
12311
)
a
=
db
.
Record
(
name
=
"
C
"
).
add_parent
(
"
C
"
).
add_property
(
"
d
"
,
12311
)
assert
not
crawler
.
all_references_are_existing_already
(
db
.
Record
().
add_parent
(
"
D
"
)
assert
not
crawler
.
all_references_are_existing_already
(
db
.
Record
(
name
=
"
D
"
).
add_parent
(
"
D
"
)
.
add_property
(
'
a
'
,
123
)
.
add_property
(
'
d
'
,
123
)
.
add_property
(
'
b
'
,
a
))
.
add_property
(
'
e
'
,
a
))
crawler
.
add_identified_record_to_local_cache
(
a
)
crawler
.
add_identified_record_to_local_cache
(
a
)
assert
crawler
.
all_references_are_existing_already
(
db
.
Record
().
add_parent
(
"
D
"
)
assert
crawler
.
all_references_are_existing_already
(
db
.
Record
(
name
=
"
D
"
).
add_parent
(
"
D
"
)
.
add_property
(
'
a
'
,
123
)
.
add_property
(
'
d
'
,
123
)
.
add_property
(
'
b
'
,
a
))
.
add_property
(
'
e
'
,
a
))
# if this ever fails, the mock up may be removed
# if this ever fails, the mock up may be removed
crawler
.
identifiableAdapter
.
get_registered_identifiable
.
assert_called
()
crawler
.
identifiableAdapter
.
get_registered_identifiable
.
assert_called
()
...
@@ -580,18 +581,19 @@ def test_can_be_checked_externally2(crawler):
...
@@ -580,18 +581,19 @@ def test_can_be_checked_externally2(crawler):
.
add_property
(
'
b
'
,
db
.
Record
()))
.
add_property
(
'
b
'
,
db
.
Record
()))
def
test_can_be_checked_externally
(
crawler
):
def
test_can_be_checked_externally
(
crawler
,
ident
):
assert
crawler
.
can_be_checked_externally
(
assert
crawler
.
can_be_checked_externally
(
db
.
Record
().
add_property
(
'
a
'
,
123
))
db
.
Record
().
add_parent
(
"
Person
"
).
add_property
(
'
last_name
'
,
123
).
add_property
(
'
first_name
'
,
123
))
assert
crawler
.
can_be_checked_externally
(
db
.
Record
()
assert
crawler
.
can_be_checked_externally
(
db
.
Record
().
add_parent
(
"
Person
"
)
.
add_property
(
'
a
'
,
db
.
Record
(
id
=
123
)))
.
add_property
(
'
first_name
'
,
123
)
assert
crawler
.
can_be_checked_externally
(
db
.
Record
().
add_parent
(
"
D
"
)
.
add_property
(
'
last_name
'
,
db
.
Record
(
id
=
123
)))
.
add_property
(
'
a
'
,
123
)
assert
crawler
.
can_be_checked_externally
(
db
.
Record
().
add_parent
(
"
Person
"
)
.
add_property
(
'
b
'
,
db
.
Record
(
id
=
123
)))
.
add_property
(
'
first_name
'
,
123
)
.
add_property
(
'
last_name
'
,
db
.
Record
(
id
=
123
)))
assert
not
crawler
.
can_be_checked_externally
(
db
.
Record
().
add_parent
(
"
D
"
)
.
add_property
(
'
a
'
,
123
)
assert
not
crawler
.
can_be_checked_externally
(
db
.
Record
().
add_parent
(
"
Person
"
)
.
add_property
(
'
b
'
,
db
.
Record
()))
.
add_property
(
'
first_name
'
,
123
)
.
add_property
(
'
last_name
'
,
db
.
Record
()))
def
test_replace_entities_with_ids
(
crawler
):
def
test_replace_entities_with_ids
(
crawler
):
...
...
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