Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
caosdb-advanced-user-tools
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-advanced-user-tools
Commits
8f55d34c
Commit
8f55d34c
authored
1 year ago
by
florian
Browse files
Options
Downloads
Patches
Plain Diff
TST: Test mixed reference and non-ref properties
parent
335b7350
No related branches found
No related tags found
2 merge requests
!89
ENH: JsonSchemaExporter accepts do_not_create parameter.
,
!81
F schema export references
Pipeline
#42742
failed
1 year ago
Stage: setup
Stage: cert
Stage: style
Stage: unittest
Stage: integrationtest
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
unittests/test_json_schema_exporter.py
+11
-0
11 additions, 0 deletions
unittests/test_json_schema_exporter.py
with
11 additions
and
0 deletions
unittests/test_json_schema_exporter.py
+
11
−
0
View file @
8f55d34c
...
...
@@ -34,6 +34,7 @@ def _mock_execute_query(query_string, unique=False, **kwargs):
all_records
=
db
.
Container
()
all_files
=
db
.
Container
()
other_type_rt
=
db
.
RecordType
(
name
=
"
OtherType
"
)
other_type_rt
.
add_property
(
name
=
"
IntegerProp
"
,
datatype
=
db
.
INTEGER
,
importance
=
db
.
OBLIGATORY
)
other_type_records
=
db
.
Container
().
extend
([
db
.
Record
(
id
=
100
,
name
=
"
otherA
"
).
add_parent
(
other_type_rt
),
db
.
Record
(
id
=
101
,
name
=
"
otherB
"
).
add_parent
(
other_type_rt
),
...
...
@@ -290,6 +291,7 @@ def test_rt_with_references():
rt
=
db
.
RecordType
()
rt
.
add_property
(
name
=
"
RefProp
"
,
datatype
=
"
OtherType
"
)
rt
.
add_property
(
name
=
"
OtherTextProp
"
,
datatype
=
db
.
TEXT
)
schema
=
rtjs
(
rt
)
props
=
schema
[
"
properties
"
]
...
...
@@ -309,6 +311,15 @@ def test_rt_with_references():
assert
"
102
"
in
props
[
"
RefProp
"
][
"
oneOf
"
][
enum_index
][
"
enum
"
]
# the other element of oneOf is the OtherType object
assert
props
[
"
RefProp
"
][
"
oneOf
"
][
1
-
enum_index
][
"
type
"
]
==
"
object
"
other_props
=
props
[
"
RefProp
"
][
"
oneOf
"
][
1
-
enum_index
][
"
properties
"
]
assert
"
IntegerProp
"
in
other_props
assert
other_props
[
"
IntegerProp
"
][
"
type
"
]
==
"
integer
"
assert
"
required
"
in
props
[
"
RefProp
"
][
"
oneOf
"
][
1
-
enum_index
]
assert
len
(
props
[
"
RefProp
"
][
"
oneOf
"
][
1
-
enum_index
][
"
required
"
])
==
1
assert
"
IntegerProp
"
in
props
[
"
RefProp
"
][
"
oneOf
"
][
1
-
enum_index
][
"
required
"
]
# The other prop also works as before
assert
"
OtherTextProp
"
in
props
assert
props
[
"
OtherTextProp
"
][
"
type
"
]
==
"
string
"
rt
=
db
.
RecordType
()
rt
.
add_property
(
name
=
"
RefProp
"
,
datatype
=
db
.
LIST
(
db
.
REFERENCE
))
...
...
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