From c49ca094b2305ec1067baad876da7da4e8a20419 Mon Sep 17 00:00:00 2001 From: philloooo Date: Tue, 11 Dec 2018 13:34:45 -0600 Subject: [PATCH] fix(collection): add test for collection link --- dev-requirements.txt | 2 +- dictionaryutils/schemas/metaschema.yaml | 4 +++- tests/test_required_links.py | 10 ++++++++++ 3 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 tests/test_required_links.py diff --git a/dev-requirements.txt b/dev-requirements.txt index bcded16..58a52cb 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -4,4 +4,4 @@ rstr==2.2.6 -e git+https://git@github.com/NCI-GDC/cdisutils.git@8a8e599fdab5ade9bd8c586132d974a102e5d72d#egg=cdisutils -e git+https://git@github.com/NCI-GDC/psqlgraph.git@7b5de7d56aa3159a9526940eb273579ddbf084ca#egg=psqlgraph -e git+https://git@github.com/uc-cdis/data-simulator.git@c0bfbe7bdc2c3c15c0778b1be0254a76fd025d3f#egg=datasimulator --e git+https://git@github.com/uc-cdis/gdcdatamodel.git@1.3.0#egg=gdcdatamodel +-e git+https://git@github.com/uc-cdis/gdcdatamodel.git@1.3.6#egg=gdcdatamodel diff --git a/dictionaryutils/schemas/metaschema.yaml b/dictionaryutils/schemas/metaschema.yaml index e6fbdaa..d14bd40 100644 --- a/dictionaryutils/schemas/metaschema.yaml +++ b/dictionaryutils/schemas/metaschema.yaml @@ -66,7 +66,9 @@ definitions: subgroup: type: array items: - $ref: "#/definitions/link" + oneOf: + - $ref: "#/definitions/link" + - $ref: "#/definitions/link_subgroup" validator_def: title: "Define a validator to be used on a property" diff --git a/tests/test_required_links.py b/tests/test_required_links.py new file mode 100644 index 0000000..7628745 --- /dev/null +++ b/tests/test_required_links.py @@ -0,0 +1,10 @@ +from dictionaryutils import dictionary + +def test_require_core_metadata_collections(): + for schema in dictionary.schema.values(): + if schema["category"].endswith("_file"): + assert ( + "core_metadata_collections" in schema["properties"], + "core_metadata_collections is required for data node {}" + .format(schema["id"]) + )