From 3326b7885c45d7c875b73c316c4941e9c09b8e7b Mon Sep 17 00:00:00 2001 From: Pete Gadomski Date: Fri, 13 Oct 2023 13:13:02 -0400 Subject: [PATCH] refactor(tests): modernize version extension tests - https://github.com/stac-utils/pystac/issues/993 - https://github.com/stac-utils/pystac/issues/948 --- ...VersionExtensionTest.test_add_version.yaml | 131 ---- ...ctionVersionExtensionTest.test_latest.yaml | 131 ---- ...ersionExtensionTest.test_validate_all.yaml | 131 ---- ...ExtensionTest.test_version_deprecated.yaml | 131 ---- ...nsionTest.test_add_deprecated_version.yaml | 131 ---- ...nTest.test_add_not_deprecated_version.yaml | 131 ---- ...VersionExtensionTest.test_add_version.yaml | 131 ---- ...emVersionExtensionTest.test_all_links.yaml | 131 ---- ...rsionExtensionTest.test_fail_validate.yaml | 131 ---- .../ItemVersionExtensionTest.test_latest.yaml | 131 ---- ...VersionExtensionTest.test_predecessor.yaml | 131 ---- ...emVersionExtensionTest.test_successor.yaml | 131 ---- ...ensionTest.test_version_in_properties.yaml | 131 ---- ....yaml => test_add_deprecated_version.yaml} | 14 +- ...l => test_add_not_deprecated_version.yaml} | 14 +- ...t_successor.yaml => test_add_version.yaml} | 14 +- ...fail_validate.yaml => test_all_links.yaml} | 14 +- ....yaml => test_collection_add_version.yaml} | 14 +- .../test_collection_validate_all.yaml | 131 ++++ .../test_version/test_fail_validate.yaml | 131 ++++ .../cassettes/test_version/test_latest.yaml | 131 ++++ .../test_version/test_predecessor.yaml | 131 ++++ .../test_version/test_successor.yaml | 131 ++++ .../test_version_in_properties.yaml | 131 ++++ tests/extensions/test_version.py | 733 +++++++----------- 25 files changed, 1093 insertions(+), 2199 deletions(-) delete mode 100644 tests/extensions/cassettes/test_version/CollectionVersionExtensionTest.test_add_version.yaml delete mode 100644 tests/extensions/cassettes/test_version/CollectionVersionExtensionTest.test_latest.yaml delete mode 100644 tests/extensions/cassettes/test_version/CollectionVersionExtensionTest.test_validate_all.yaml delete mode 100644 tests/extensions/cassettes/test_version/CollectionVersionExtensionTest.test_version_deprecated.yaml delete mode 100644 tests/extensions/cassettes/test_version/ItemVersionExtensionTest.test_add_deprecated_version.yaml delete mode 100644 tests/extensions/cassettes/test_version/ItemVersionExtensionTest.test_add_not_deprecated_version.yaml delete mode 100644 tests/extensions/cassettes/test_version/ItemVersionExtensionTest.test_add_version.yaml delete mode 100644 tests/extensions/cassettes/test_version/ItemVersionExtensionTest.test_all_links.yaml delete mode 100644 tests/extensions/cassettes/test_version/ItemVersionExtensionTest.test_fail_validate.yaml delete mode 100644 tests/extensions/cassettes/test_version/ItemVersionExtensionTest.test_latest.yaml delete mode 100644 tests/extensions/cassettes/test_version/ItemVersionExtensionTest.test_predecessor.yaml delete mode 100644 tests/extensions/cassettes/test_version/ItemVersionExtensionTest.test_successor.yaml delete mode 100644 tests/extensions/cassettes/test_version/ItemVersionExtensionTest.test_version_in_properties.yaml rename tests/extensions/cassettes/test_version/{CollectionVersionExtensionTest.test_predecessor.yaml => test_add_deprecated_version.yaml} (96%) rename tests/extensions/cassettes/test_version/{CollectionVersionExtensionTest.test_add_not_deprecated_version.yaml => test_add_not_deprecated_version.yaml} (96%) rename tests/extensions/cassettes/test_version/{CollectionVersionExtensionTest.test_successor.yaml => test_add_version.yaml} (96%) rename tests/extensions/cassettes/test_version/{CollectionVersionExtensionTest.test_fail_validate.yaml => test_all_links.yaml} (96%) rename tests/extensions/cassettes/test_version/{CollectionVersionExtensionTest.test_add_deprecated_version.yaml => test_collection_add_version.yaml} (96%) create mode 100644 tests/extensions/cassettes/test_version/test_collection_validate_all.yaml create mode 100644 tests/extensions/cassettes/test_version/test_fail_validate.yaml create mode 100644 tests/extensions/cassettes/test_version/test_latest.yaml create mode 100644 tests/extensions/cassettes/test_version/test_predecessor.yaml create mode 100644 tests/extensions/cassettes/test_version/test_successor.yaml create mode 100644 tests/extensions/cassettes/test_version/test_version_in_properties.yaml diff --git a/tests/extensions/cassettes/test_version/CollectionVersionExtensionTest.test_add_version.yaml b/tests/extensions/cassettes/test_version/CollectionVersionExtensionTest.test_add_version.yaml deleted file mode 100644 index b34cffd5a..000000000 --- a/tests/extensions/cassettes/test_version/CollectionVersionExtensionTest.test_add_version.yaml +++ /dev/null @@ -1,131 +0,0 @@ -interactions: -- request: - body: null - headers: - Connection: - - close - Host: - - stac-extensions.github.io - User-Agent: - - Python-urllib/3.11 - method: GET - uri: https://stac-extensions.github.io/version/v1.0.0/schema.json - response: - body: - string: "{\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"$id\": - \"https://stac-extensions.github.io/version/v1.0.0/schema.json#\",\n \"title\": - \"Versioning Indicators Extension\",\n \"description\": \"STAC Versioning - Indicators Extension for STAC Items and STAC Collections.\",\n \"oneOf\": - [\n {\n \"$comment\": \"This is the schema for STAC Items. Remove - this object if this extension only applies to Collections.\",\n \"allOf\": - [\n {\n \"$ref\": \"#/definitions/stac_extensions\"\n },\n - \ {\n \"type\": \"object\",\n \"required\": [\n \"type\",\n - \ \"properties\",\n \"assets\"\n ],\n \"properties\": - {\n \"type\": {\n \"const\": \"Feature\"\n },\n - \ \"properties\": {\n \"allOf\": [\n {\n - \ \"$comment\": \"Require fields here for item properties.\",\n - \ \"required\": [\n \"version\"\n ]\n - \ },\n {\n \"$ref\": \"#/definitions/fields\"\n - \ }\n ]\n },\n \"assets\": - {\n \"$comment\": \"This validates the fields in Item Assets, - but does not require them.\",\n \"type\": \"object\",\n \"additionalProperties\": - {\n \"$ref\": \"#/definitions/fields\"\n }\n }\n - \ }\n }\n ]\n },\n {\n \"$comment\": \"This - is the schema for STAC Collections.\",\n \"type\": \"object\",\n \"allOf\": - [\n {\n \"required\": [\n \"type\"\n ],\n - \ \"properties\": {\n \"type\": {\n \"const\": - \"Collection\"\n }\n }\n },\n {\n \"$ref\": - \"#/definitions/stac_extensions\"\n }\n ],\n \"anyOf\": [\n - \ {\n \"$comment\": \"This is the schema for the top-level - fields in a Collection. Remove this if this extension does not define top-level - fields for Collections.\",\n \"allOf\": [\n {\n \"$comment\": - \"Require fields here for Collections (top-level).\",\n \"required\": - [\n \"version\"\n ]\n },\n {\n - \ \"$ref\": \"#/definitions/fields\"\n }\n ]\n - \ },\n {\n \"$comment\": \"This validates the fields - in Collection Assets, but does not require them.\",\n \"required\": - [\n \"assets\"\n ],\n \"properties\": {\n \"assets\": - {\n \"type\": \"object\",\n \"not\": {\n \"additionalProperties\": - {\n \"not\": {\n \"allOf\": [\n {\n - \ \"$ref\": \"#/definitions/require_any_field\"\n },\n - \ {\n \"$ref\": \"#/definitions/fields\"\n - \ }\n ]\n }\n }\n - \ }\n }\n }\n },\n {\n \"$comment\": - \"This is the schema for the fields in Item Asset Definitions. It doesn't - require any fields.\",\n \"required\": [\n \"item_assets\"\n - \ ],\n \"properties\": {\n \"item_assets\": {\n - \ \"type\": \"object\",\n \"not\": {\n \"additionalProperties\": - {\n \"not\": {\n \"allOf\": [\n {\n - \ \"$ref\": \"#/definitions/require_any_field\"\n },\n - \ {\n \"$ref\": \"#/definitions/fields\"\n - \ }\n ]\n }\n }\n - \ }\n }\n }\n },\n {\n \"$comment\": - \"This is the schema for the fields in Summaries. By default, only checks - the existance of the properties, but not the schema of the summaries.\",\n - \ \"required\": [\n \"summaries\"\n ],\n \"properties\": - {\n \"summaries\": {\n \"$ref\": \"#/definitions/require_any_field\"\n - \ }\n }\n }\n ]\n }\n ],\n \"definitions\": - {\n \"stac_extensions\": {\n \"type\": \"object\",\n \"required\": - [\n \"stac_extensions\"\n ],\n \"properties\": {\n \"stac_extensions\": - {\n \"type\": \"array\",\n \"contains\": {\n \"const\": - \"https://stac-extensions.github.io/version/v1.0.0/schema.json\"\n }\n - \ }\n }\n },\n \"require_any_field\": {\n \"$comment\": - \"Please list all fields here so that we can force the existance of one of - them in other parts of the schemas.\",\n \"anyOf\": [\n {\"required\": - [\"version\"]},\n {\"required\": [\"deprecated\"]}\n ]\n },\n - \ \"fields\": {\n \"type\": \"object\",\n \"properties\": {\n - \ \"version\": {\n \"type\": \"string\",\n \"title\": - \"Version\"\n },\n \"deprecated\": {\n \"type\": \"boolean\",\n - \ \"title\": \"Deprecated\",\n \"default\": false\n }\n - \ }\n }\n }\n}\n" - headers: - Accept-Ranges: - - bytes - Access-Control-Allow-Origin: - - '*' - Age: - - '517' - Cache-Control: - - max-age=600 - Connection: - - close - Content-Length: - - '5009' - Content-Type: - - application/json; charset=utf-8 - Date: - - Wed, 27 Sep 2023 21:20:50 GMT - ETag: - - '"645249bd-1391"' - Last-Modified: - - Wed, 03 May 2023 11:47:09 GMT - Server: - - GitHub.com - Strict-Transport-Security: - - max-age=31556952 - Vary: - - Accept-Encoding - Via: - - 1.1 varnish - X-Cache: - - HIT - X-Cache-Hits: - - '2' - X-Fastly-Request-ID: - - d51a0034913bcb87930977d18078ba0ed2552e2a - X-GitHub-Request-Id: - - 96AE:1981:28905C:3865AF:65149AAC - X-Served-By: - - cache-lga21944-LGA - X-Timer: - - S1695849651.859898,VS0,VE1 - expires: - - Wed, 27 Sep 2023 21:22:13 GMT - permissions-policy: - - interest-cohort=() - x-proxy-cache: - - MISS - status: - code: 200 - message: OK -version: 1 diff --git a/tests/extensions/cassettes/test_version/CollectionVersionExtensionTest.test_latest.yaml b/tests/extensions/cassettes/test_version/CollectionVersionExtensionTest.test_latest.yaml deleted file mode 100644 index b7f65b084..000000000 --- a/tests/extensions/cassettes/test_version/CollectionVersionExtensionTest.test_latest.yaml +++ /dev/null @@ -1,131 +0,0 @@ -interactions: -- request: - body: null - headers: - Connection: - - close - Host: - - stac-extensions.github.io - User-Agent: - - Python-urllib/3.11 - method: GET - uri: https://stac-extensions.github.io/version/v1.0.0/schema.json - response: - body: - string: "{\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"$id\": - \"https://stac-extensions.github.io/version/v1.0.0/schema.json#\",\n \"title\": - \"Versioning Indicators Extension\",\n \"description\": \"STAC Versioning - Indicators Extension for STAC Items and STAC Collections.\",\n \"oneOf\": - [\n {\n \"$comment\": \"This is the schema for STAC Items. Remove - this object if this extension only applies to Collections.\",\n \"allOf\": - [\n {\n \"$ref\": \"#/definitions/stac_extensions\"\n },\n - \ {\n \"type\": \"object\",\n \"required\": [\n \"type\",\n - \ \"properties\",\n \"assets\"\n ],\n \"properties\": - {\n \"type\": {\n \"const\": \"Feature\"\n },\n - \ \"properties\": {\n \"allOf\": [\n {\n - \ \"$comment\": \"Require fields here for item properties.\",\n - \ \"required\": [\n \"version\"\n ]\n - \ },\n {\n \"$ref\": \"#/definitions/fields\"\n - \ }\n ]\n },\n \"assets\": - {\n \"$comment\": \"This validates the fields in Item Assets, - but does not require them.\",\n \"type\": \"object\",\n \"additionalProperties\": - {\n \"$ref\": \"#/definitions/fields\"\n }\n }\n - \ }\n }\n ]\n },\n {\n \"$comment\": \"This - is the schema for STAC Collections.\",\n \"type\": \"object\",\n \"allOf\": - [\n {\n \"required\": [\n \"type\"\n ],\n - \ \"properties\": {\n \"type\": {\n \"const\": - \"Collection\"\n }\n }\n },\n {\n \"$ref\": - \"#/definitions/stac_extensions\"\n }\n ],\n \"anyOf\": [\n - \ {\n \"$comment\": \"This is the schema for the top-level - fields in a Collection. Remove this if this extension does not define top-level - fields for Collections.\",\n \"allOf\": [\n {\n \"$comment\": - \"Require fields here for Collections (top-level).\",\n \"required\": - [\n \"version\"\n ]\n },\n {\n - \ \"$ref\": \"#/definitions/fields\"\n }\n ]\n - \ },\n {\n \"$comment\": \"This validates the fields - in Collection Assets, but does not require them.\",\n \"required\": - [\n \"assets\"\n ],\n \"properties\": {\n \"assets\": - {\n \"type\": \"object\",\n \"not\": {\n \"additionalProperties\": - {\n \"not\": {\n \"allOf\": [\n {\n - \ \"$ref\": \"#/definitions/require_any_field\"\n },\n - \ {\n \"$ref\": \"#/definitions/fields\"\n - \ }\n ]\n }\n }\n - \ }\n }\n }\n },\n {\n \"$comment\": - \"This is the schema for the fields in Item Asset Definitions. It doesn't - require any fields.\",\n \"required\": [\n \"item_assets\"\n - \ ],\n \"properties\": {\n \"item_assets\": {\n - \ \"type\": \"object\",\n \"not\": {\n \"additionalProperties\": - {\n \"not\": {\n \"allOf\": [\n {\n - \ \"$ref\": \"#/definitions/require_any_field\"\n },\n - \ {\n \"$ref\": \"#/definitions/fields\"\n - \ }\n ]\n }\n }\n - \ }\n }\n }\n },\n {\n \"$comment\": - \"This is the schema for the fields in Summaries. By default, only checks - the existance of the properties, but not the schema of the summaries.\",\n - \ \"required\": [\n \"summaries\"\n ],\n \"properties\": - {\n \"summaries\": {\n \"$ref\": \"#/definitions/require_any_field\"\n - \ }\n }\n }\n ]\n }\n ],\n \"definitions\": - {\n \"stac_extensions\": {\n \"type\": \"object\",\n \"required\": - [\n \"stac_extensions\"\n ],\n \"properties\": {\n \"stac_extensions\": - {\n \"type\": \"array\",\n \"contains\": {\n \"const\": - \"https://stac-extensions.github.io/version/v1.0.0/schema.json\"\n }\n - \ }\n }\n },\n \"require_any_field\": {\n \"$comment\": - \"Please list all fields here so that we can force the existance of one of - them in other parts of the schemas.\",\n \"anyOf\": [\n {\"required\": - [\"version\"]},\n {\"required\": [\"deprecated\"]}\n ]\n },\n - \ \"fields\": {\n \"type\": \"object\",\n \"properties\": {\n - \ \"version\": {\n \"type\": \"string\",\n \"title\": - \"Version\"\n },\n \"deprecated\": {\n \"type\": \"boolean\",\n - \ \"title\": \"Deprecated\",\n \"default\": false\n }\n - \ }\n }\n }\n}\n" - headers: - Accept-Ranges: - - bytes - Access-Control-Allow-Origin: - - '*' - Age: - - '518' - Cache-Control: - - max-age=600 - Connection: - - close - Content-Length: - - '5009' - Content-Type: - - application/json; charset=utf-8 - Date: - - Wed, 27 Sep 2023 21:20:51 GMT - ETag: - - '"645249bd-1391"' - Last-Modified: - - Wed, 03 May 2023 11:47:09 GMT - Server: - - GitHub.com - Strict-Transport-Security: - - max-age=31556952 - Vary: - - Accept-Encoding - Via: - - 1.1 varnish - X-Cache: - - HIT - X-Cache-Hits: - - '2' - X-Fastly-Request-ID: - - c68fdd17099afeb9fa2a41aaad460ada72e07f58 - X-GitHub-Request-Id: - - 96AE:1981:28905C:3865AF:65149AAC - X-Served-By: - - cache-lga21953-LGA - X-Timer: - - S1695849651.160246,VS0,VE1 - expires: - - Wed, 27 Sep 2023 21:22:13 GMT - permissions-policy: - - interest-cohort=() - x-proxy-cache: - - MISS - status: - code: 200 - message: OK -version: 1 diff --git a/tests/extensions/cassettes/test_version/CollectionVersionExtensionTest.test_validate_all.yaml b/tests/extensions/cassettes/test_version/CollectionVersionExtensionTest.test_validate_all.yaml deleted file mode 100644 index d2b4e44a7..000000000 --- a/tests/extensions/cassettes/test_version/CollectionVersionExtensionTest.test_validate_all.yaml +++ /dev/null @@ -1,131 +0,0 @@ -interactions: -- request: - body: null - headers: - Connection: - - close - Host: - - stac-extensions.github.io - User-Agent: - - Python-urllib/3.11 - method: GET - uri: https://stac-extensions.github.io/version/v1.0.0/schema.json - response: - body: - string: "{\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"$id\": - \"https://stac-extensions.github.io/version/v1.0.0/schema.json#\",\n \"title\": - \"Versioning Indicators Extension\",\n \"description\": \"STAC Versioning - Indicators Extension for STAC Items and STAC Collections.\",\n \"oneOf\": - [\n {\n \"$comment\": \"This is the schema for STAC Items. Remove - this object if this extension only applies to Collections.\",\n \"allOf\": - [\n {\n \"$ref\": \"#/definitions/stac_extensions\"\n },\n - \ {\n \"type\": \"object\",\n \"required\": [\n \"type\",\n - \ \"properties\",\n \"assets\"\n ],\n \"properties\": - {\n \"type\": {\n \"const\": \"Feature\"\n },\n - \ \"properties\": {\n \"allOf\": [\n {\n - \ \"$comment\": \"Require fields here for item properties.\",\n - \ \"required\": [\n \"version\"\n ]\n - \ },\n {\n \"$ref\": \"#/definitions/fields\"\n - \ }\n ]\n },\n \"assets\": - {\n \"$comment\": \"This validates the fields in Item Assets, - but does not require them.\",\n \"type\": \"object\",\n \"additionalProperties\": - {\n \"$ref\": \"#/definitions/fields\"\n }\n }\n - \ }\n }\n ]\n },\n {\n \"$comment\": \"This - is the schema for STAC Collections.\",\n \"type\": \"object\",\n \"allOf\": - [\n {\n \"required\": [\n \"type\"\n ],\n - \ \"properties\": {\n \"type\": {\n \"const\": - \"Collection\"\n }\n }\n },\n {\n \"$ref\": - \"#/definitions/stac_extensions\"\n }\n ],\n \"anyOf\": [\n - \ {\n \"$comment\": \"This is the schema for the top-level - fields in a Collection. Remove this if this extension does not define top-level - fields for Collections.\",\n \"allOf\": [\n {\n \"$comment\": - \"Require fields here for Collections (top-level).\",\n \"required\": - [\n \"version\"\n ]\n },\n {\n - \ \"$ref\": \"#/definitions/fields\"\n }\n ]\n - \ },\n {\n \"$comment\": \"This validates the fields - in Collection Assets, but does not require them.\",\n \"required\": - [\n \"assets\"\n ],\n \"properties\": {\n \"assets\": - {\n \"type\": \"object\",\n \"not\": {\n \"additionalProperties\": - {\n \"not\": {\n \"allOf\": [\n {\n - \ \"$ref\": \"#/definitions/require_any_field\"\n },\n - \ {\n \"$ref\": \"#/definitions/fields\"\n - \ }\n ]\n }\n }\n - \ }\n }\n }\n },\n {\n \"$comment\": - \"This is the schema for the fields in Item Asset Definitions. It doesn't - require any fields.\",\n \"required\": [\n \"item_assets\"\n - \ ],\n \"properties\": {\n \"item_assets\": {\n - \ \"type\": \"object\",\n \"not\": {\n \"additionalProperties\": - {\n \"not\": {\n \"allOf\": [\n {\n - \ \"$ref\": \"#/definitions/require_any_field\"\n },\n - \ {\n \"$ref\": \"#/definitions/fields\"\n - \ }\n ]\n }\n }\n - \ }\n }\n }\n },\n {\n \"$comment\": - \"This is the schema for the fields in Summaries. By default, only checks - the existance of the properties, but not the schema of the summaries.\",\n - \ \"required\": [\n \"summaries\"\n ],\n \"properties\": - {\n \"summaries\": {\n \"$ref\": \"#/definitions/require_any_field\"\n - \ }\n }\n }\n ]\n }\n ],\n \"definitions\": - {\n \"stac_extensions\": {\n \"type\": \"object\",\n \"required\": - [\n \"stac_extensions\"\n ],\n \"properties\": {\n \"stac_extensions\": - {\n \"type\": \"array\",\n \"contains\": {\n \"const\": - \"https://stac-extensions.github.io/version/v1.0.0/schema.json\"\n }\n - \ }\n }\n },\n \"require_any_field\": {\n \"$comment\": - \"Please list all fields here so that we can force the existance of one of - them in other parts of the schemas.\",\n \"anyOf\": [\n {\"required\": - [\"version\"]},\n {\"required\": [\"deprecated\"]}\n ]\n },\n - \ \"fields\": {\n \"type\": \"object\",\n \"properties\": {\n - \ \"version\": {\n \"type\": \"string\",\n \"title\": - \"Version\"\n },\n \"deprecated\": {\n \"type\": \"boolean\",\n - \ \"title\": \"Deprecated\",\n \"default\": false\n }\n - \ }\n }\n }\n}\n" - headers: - Accept-Ranges: - - bytes - Access-Control-Allow-Origin: - - '*' - Age: - - '518' - Cache-Control: - - max-age=600 - Connection: - - close - Content-Length: - - '5009' - Content-Type: - - application/json; charset=utf-8 - Date: - - Wed, 27 Sep 2023 21:20:51 GMT - ETag: - - '"645249bd-1391"' - Last-Modified: - - Wed, 03 May 2023 11:47:09 GMT - Server: - - GitHub.com - Strict-Transport-Security: - - max-age=31556952 - Vary: - - Accept-Encoding - Via: - - 1.1 varnish - X-Cache: - - HIT - X-Cache-Hits: - - '1' - X-Fastly-Request-ID: - - bab94633646923df71cc7974a517a2f291754c77 - X-GitHub-Request-Id: - - 96AE:1981:28905C:3865AF:65149AAC - X-Served-By: - - cache-lga21973-LGA - X-Timer: - - S1695849652.572206,VS0,VE2 - expires: - - Wed, 27 Sep 2023 21:22:13 GMT - permissions-policy: - - interest-cohort=() - x-proxy-cache: - - MISS - status: - code: 200 - message: OK -version: 1 diff --git a/tests/extensions/cassettes/test_version/CollectionVersionExtensionTest.test_version_deprecated.yaml b/tests/extensions/cassettes/test_version/CollectionVersionExtensionTest.test_version_deprecated.yaml deleted file mode 100644 index 042b9562a..000000000 --- a/tests/extensions/cassettes/test_version/CollectionVersionExtensionTest.test_version_deprecated.yaml +++ /dev/null @@ -1,131 +0,0 @@ -interactions: -- request: - body: null - headers: - Connection: - - close - Host: - - stac-extensions.github.io - User-Agent: - - Python-urllib/3.11 - method: GET - uri: https://stac-extensions.github.io/version/v1.0.0/schema.json - response: - body: - string: "{\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"$id\": - \"https://stac-extensions.github.io/version/v1.0.0/schema.json#\",\n \"title\": - \"Versioning Indicators Extension\",\n \"description\": \"STAC Versioning - Indicators Extension for STAC Items and STAC Collections.\",\n \"oneOf\": - [\n {\n \"$comment\": \"This is the schema for STAC Items. Remove - this object if this extension only applies to Collections.\",\n \"allOf\": - [\n {\n \"$ref\": \"#/definitions/stac_extensions\"\n },\n - \ {\n \"type\": \"object\",\n \"required\": [\n \"type\",\n - \ \"properties\",\n \"assets\"\n ],\n \"properties\": - {\n \"type\": {\n \"const\": \"Feature\"\n },\n - \ \"properties\": {\n \"allOf\": [\n {\n - \ \"$comment\": \"Require fields here for item properties.\",\n - \ \"required\": [\n \"version\"\n ]\n - \ },\n {\n \"$ref\": \"#/definitions/fields\"\n - \ }\n ]\n },\n \"assets\": - {\n \"$comment\": \"This validates the fields in Item Assets, - but does not require them.\",\n \"type\": \"object\",\n \"additionalProperties\": - {\n \"$ref\": \"#/definitions/fields\"\n }\n }\n - \ }\n }\n ]\n },\n {\n \"$comment\": \"This - is the schema for STAC Collections.\",\n \"type\": \"object\",\n \"allOf\": - [\n {\n \"required\": [\n \"type\"\n ],\n - \ \"properties\": {\n \"type\": {\n \"const\": - \"Collection\"\n }\n }\n },\n {\n \"$ref\": - \"#/definitions/stac_extensions\"\n }\n ],\n \"anyOf\": [\n - \ {\n \"$comment\": \"This is the schema for the top-level - fields in a Collection. Remove this if this extension does not define top-level - fields for Collections.\",\n \"allOf\": [\n {\n \"$comment\": - \"Require fields here for Collections (top-level).\",\n \"required\": - [\n \"version\"\n ]\n },\n {\n - \ \"$ref\": \"#/definitions/fields\"\n }\n ]\n - \ },\n {\n \"$comment\": \"This validates the fields - in Collection Assets, but does not require them.\",\n \"required\": - [\n \"assets\"\n ],\n \"properties\": {\n \"assets\": - {\n \"type\": \"object\",\n \"not\": {\n \"additionalProperties\": - {\n \"not\": {\n \"allOf\": [\n {\n - \ \"$ref\": \"#/definitions/require_any_field\"\n },\n - \ {\n \"$ref\": \"#/definitions/fields\"\n - \ }\n ]\n }\n }\n - \ }\n }\n }\n },\n {\n \"$comment\": - \"This is the schema for the fields in Item Asset Definitions. It doesn't - require any fields.\",\n \"required\": [\n \"item_assets\"\n - \ ],\n \"properties\": {\n \"item_assets\": {\n - \ \"type\": \"object\",\n \"not\": {\n \"additionalProperties\": - {\n \"not\": {\n \"allOf\": [\n {\n - \ \"$ref\": \"#/definitions/require_any_field\"\n },\n - \ {\n \"$ref\": \"#/definitions/fields\"\n - \ }\n ]\n }\n }\n - \ }\n }\n }\n },\n {\n \"$comment\": - \"This is the schema for the fields in Summaries. By default, only checks - the existance of the properties, but not the schema of the summaries.\",\n - \ \"required\": [\n \"summaries\"\n ],\n \"properties\": - {\n \"summaries\": {\n \"$ref\": \"#/definitions/require_any_field\"\n - \ }\n }\n }\n ]\n }\n ],\n \"definitions\": - {\n \"stac_extensions\": {\n \"type\": \"object\",\n \"required\": - [\n \"stac_extensions\"\n ],\n \"properties\": {\n \"stac_extensions\": - {\n \"type\": \"array\",\n \"contains\": {\n \"const\": - \"https://stac-extensions.github.io/version/v1.0.0/schema.json\"\n }\n - \ }\n }\n },\n \"require_any_field\": {\n \"$comment\": - \"Please list all fields here so that we can force the existance of one of - them in other parts of the schemas.\",\n \"anyOf\": [\n {\"required\": - [\"version\"]},\n {\"required\": [\"deprecated\"]}\n ]\n },\n - \ \"fields\": {\n \"type\": \"object\",\n \"properties\": {\n - \ \"version\": {\n \"type\": \"string\",\n \"title\": - \"Version\"\n },\n \"deprecated\": {\n \"type\": \"boolean\",\n - \ \"title\": \"Deprecated\",\n \"default\": false\n }\n - \ }\n }\n }\n}\n" - headers: - Accept-Ranges: - - bytes - Access-Control-Allow-Origin: - - '*' - Age: - - '518' - Cache-Control: - - max-age=600 - Connection: - - close - Content-Length: - - '5009' - Content-Type: - - application/json; charset=utf-8 - Date: - - Wed, 27 Sep 2023 21:20:51 GMT - ETag: - - '"645249bd-1391"' - Last-Modified: - - Wed, 03 May 2023 11:47:09 GMT - Server: - - GitHub.com - Strict-Transport-Security: - - max-age=31556952 - Vary: - - Accept-Encoding - Via: - - 1.1 varnish - X-Cache: - - HIT - X-Cache-Hits: - - '1' - X-Fastly-Request-ID: - - b9a3c67614808f15330b3f58d48c3cccd713e625 - X-GitHub-Request-Id: - - 96AE:1981:28905C:3865AF:65149AAC - X-Served-By: - - cache-lga21954-LGA - X-Timer: - - S1695849652.706984,VS0,VE2 - expires: - - Wed, 27 Sep 2023 21:22:13 GMT - permissions-policy: - - interest-cohort=() - x-proxy-cache: - - MISS - status: - code: 200 - message: OK -version: 1 diff --git a/tests/extensions/cassettes/test_version/ItemVersionExtensionTest.test_add_deprecated_version.yaml b/tests/extensions/cassettes/test_version/ItemVersionExtensionTest.test_add_deprecated_version.yaml deleted file mode 100644 index 81c865b80..000000000 --- a/tests/extensions/cassettes/test_version/ItemVersionExtensionTest.test_add_deprecated_version.yaml +++ /dev/null @@ -1,131 +0,0 @@ -interactions: -- request: - body: null - headers: - Connection: - - close - Host: - - stac-extensions.github.io - User-Agent: - - Python-urllib/3.11 - method: GET - uri: https://stac-extensions.github.io/version/v1.0.0/schema.json - response: - body: - string: "{\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"$id\": - \"https://stac-extensions.github.io/version/v1.0.0/schema.json#\",\n \"title\": - \"Versioning Indicators Extension\",\n \"description\": \"STAC Versioning - Indicators Extension for STAC Items and STAC Collections.\",\n \"oneOf\": - [\n {\n \"$comment\": \"This is the schema for STAC Items. Remove - this object if this extension only applies to Collections.\",\n \"allOf\": - [\n {\n \"$ref\": \"#/definitions/stac_extensions\"\n },\n - \ {\n \"type\": \"object\",\n \"required\": [\n \"type\",\n - \ \"properties\",\n \"assets\"\n ],\n \"properties\": - {\n \"type\": {\n \"const\": \"Feature\"\n },\n - \ \"properties\": {\n \"allOf\": [\n {\n - \ \"$comment\": \"Require fields here for item properties.\",\n - \ \"required\": [\n \"version\"\n ]\n - \ },\n {\n \"$ref\": \"#/definitions/fields\"\n - \ }\n ]\n },\n \"assets\": - {\n \"$comment\": \"This validates the fields in Item Assets, - but does not require them.\",\n \"type\": \"object\",\n \"additionalProperties\": - {\n \"$ref\": \"#/definitions/fields\"\n }\n }\n - \ }\n }\n ]\n },\n {\n \"$comment\": \"This - is the schema for STAC Collections.\",\n \"type\": \"object\",\n \"allOf\": - [\n {\n \"required\": [\n \"type\"\n ],\n - \ \"properties\": {\n \"type\": {\n \"const\": - \"Collection\"\n }\n }\n },\n {\n \"$ref\": - \"#/definitions/stac_extensions\"\n }\n ],\n \"anyOf\": [\n - \ {\n \"$comment\": \"This is the schema for the top-level - fields in a Collection. Remove this if this extension does not define top-level - fields for Collections.\",\n \"allOf\": [\n {\n \"$comment\": - \"Require fields here for Collections (top-level).\",\n \"required\": - [\n \"version\"\n ]\n },\n {\n - \ \"$ref\": \"#/definitions/fields\"\n }\n ]\n - \ },\n {\n \"$comment\": \"This validates the fields - in Collection Assets, but does not require them.\",\n \"required\": - [\n \"assets\"\n ],\n \"properties\": {\n \"assets\": - {\n \"type\": \"object\",\n \"not\": {\n \"additionalProperties\": - {\n \"not\": {\n \"allOf\": [\n {\n - \ \"$ref\": \"#/definitions/require_any_field\"\n },\n - \ {\n \"$ref\": \"#/definitions/fields\"\n - \ }\n ]\n }\n }\n - \ }\n }\n }\n },\n {\n \"$comment\": - \"This is the schema for the fields in Item Asset Definitions. It doesn't - require any fields.\",\n \"required\": [\n \"item_assets\"\n - \ ],\n \"properties\": {\n \"item_assets\": {\n - \ \"type\": \"object\",\n \"not\": {\n \"additionalProperties\": - {\n \"not\": {\n \"allOf\": [\n {\n - \ \"$ref\": \"#/definitions/require_any_field\"\n },\n - \ {\n \"$ref\": \"#/definitions/fields\"\n - \ }\n ]\n }\n }\n - \ }\n }\n }\n },\n {\n \"$comment\": - \"This is the schema for the fields in Summaries. By default, only checks - the existance of the properties, but not the schema of the summaries.\",\n - \ \"required\": [\n \"summaries\"\n ],\n \"properties\": - {\n \"summaries\": {\n \"$ref\": \"#/definitions/require_any_field\"\n - \ }\n }\n }\n ]\n }\n ],\n \"definitions\": - {\n \"stac_extensions\": {\n \"type\": \"object\",\n \"required\": - [\n \"stac_extensions\"\n ],\n \"properties\": {\n \"stac_extensions\": - {\n \"type\": \"array\",\n \"contains\": {\n \"const\": - \"https://stac-extensions.github.io/version/v1.0.0/schema.json\"\n }\n - \ }\n }\n },\n \"require_any_field\": {\n \"$comment\": - \"Please list all fields here so that we can force the existance of one of - them in other parts of the schemas.\",\n \"anyOf\": [\n {\"required\": - [\"version\"]},\n {\"required\": [\"deprecated\"]}\n ]\n },\n - \ \"fields\": {\n \"type\": \"object\",\n \"properties\": {\n - \ \"version\": {\n \"type\": \"string\",\n \"title\": - \"Version\"\n },\n \"deprecated\": {\n \"type\": \"boolean\",\n - \ \"title\": \"Deprecated\",\n \"default\": false\n }\n - \ }\n }\n }\n}\n" - headers: - Accept-Ranges: - - bytes - Access-Control-Allow-Origin: - - '*' - Age: - - '516' - Cache-Control: - - max-age=600 - Connection: - - close - Content-Length: - - '5009' - Content-Type: - - application/json; charset=utf-8 - Date: - - Wed, 27 Sep 2023 21:20:49 GMT - ETag: - - '"645249bd-1391"' - Last-Modified: - - Wed, 03 May 2023 11:47:09 GMT - Server: - - GitHub.com - Strict-Transport-Security: - - max-age=31556952 - Vary: - - Accept-Encoding - Via: - - 1.1 varnish - X-Cache: - - HIT - X-Cache-Hits: - - '1' - X-Fastly-Request-ID: - - 8d49cb7e72d6110e2197d72dfcccd36016b39459 - X-GitHub-Request-Id: - - 96AE:1981:28905C:3865AF:65149AAC - X-Served-By: - - cache-lga21971-LGA - X-Timer: - - S1695849649.351212,VS0,VE1 - expires: - - Wed, 27 Sep 2023 21:22:13 GMT - permissions-policy: - - interest-cohort=() - x-proxy-cache: - - MISS - status: - code: 200 - message: OK -version: 1 diff --git a/tests/extensions/cassettes/test_version/ItemVersionExtensionTest.test_add_not_deprecated_version.yaml b/tests/extensions/cassettes/test_version/ItemVersionExtensionTest.test_add_not_deprecated_version.yaml deleted file mode 100644 index 1016aaa26..000000000 --- a/tests/extensions/cassettes/test_version/ItemVersionExtensionTest.test_add_not_deprecated_version.yaml +++ /dev/null @@ -1,131 +0,0 @@ -interactions: -- request: - body: null - headers: - Connection: - - close - Host: - - stac-extensions.github.io - User-Agent: - - Python-urllib/3.11 - method: GET - uri: https://stac-extensions.github.io/version/v1.0.0/schema.json - response: - body: - string: "{\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"$id\": - \"https://stac-extensions.github.io/version/v1.0.0/schema.json#\",\n \"title\": - \"Versioning Indicators Extension\",\n \"description\": \"STAC Versioning - Indicators Extension for STAC Items and STAC Collections.\",\n \"oneOf\": - [\n {\n \"$comment\": \"This is the schema for STAC Items. Remove - this object if this extension only applies to Collections.\",\n \"allOf\": - [\n {\n \"$ref\": \"#/definitions/stac_extensions\"\n },\n - \ {\n \"type\": \"object\",\n \"required\": [\n \"type\",\n - \ \"properties\",\n \"assets\"\n ],\n \"properties\": - {\n \"type\": {\n \"const\": \"Feature\"\n },\n - \ \"properties\": {\n \"allOf\": [\n {\n - \ \"$comment\": \"Require fields here for item properties.\",\n - \ \"required\": [\n \"version\"\n ]\n - \ },\n {\n \"$ref\": \"#/definitions/fields\"\n - \ }\n ]\n },\n \"assets\": - {\n \"$comment\": \"This validates the fields in Item Assets, - but does not require them.\",\n \"type\": \"object\",\n \"additionalProperties\": - {\n \"$ref\": \"#/definitions/fields\"\n }\n }\n - \ }\n }\n ]\n },\n {\n \"$comment\": \"This - is the schema for STAC Collections.\",\n \"type\": \"object\",\n \"allOf\": - [\n {\n \"required\": [\n \"type\"\n ],\n - \ \"properties\": {\n \"type\": {\n \"const\": - \"Collection\"\n }\n }\n },\n {\n \"$ref\": - \"#/definitions/stac_extensions\"\n }\n ],\n \"anyOf\": [\n - \ {\n \"$comment\": \"This is the schema for the top-level - fields in a Collection. Remove this if this extension does not define top-level - fields for Collections.\",\n \"allOf\": [\n {\n \"$comment\": - \"Require fields here for Collections (top-level).\",\n \"required\": - [\n \"version\"\n ]\n },\n {\n - \ \"$ref\": \"#/definitions/fields\"\n }\n ]\n - \ },\n {\n \"$comment\": \"This validates the fields - in Collection Assets, but does not require them.\",\n \"required\": - [\n \"assets\"\n ],\n \"properties\": {\n \"assets\": - {\n \"type\": \"object\",\n \"not\": {\n \"additionalProperties\": - {\n \"not\": {\n \"allOf\": [\n {\n - \ \"$ref\": \"#/definitions/require_any_field\"\n },\n - \ {\n \"$ref\": \"#/definitions/fields\"\n - \ }\n ]\n }\n }\n - \ }\n }\n }\n },\n {\n \"$comment\": - \"This is the schema for the fields in Item Asset Definitions. It doesn't - require any fields.\",\n \"required\": [\n \"item_assets\"\n - \ ],\n \"properties\": {\n \"item_assets\": {\n - \ \"type\": \"object\",\n \"not\": {\n \"additionalProperties\": - {\n \"not\": {\n \"allOf\": [\n {\n - \ \"$ref\": \"#/definitions/require_any_field\"\n },\n - \ {\n \"$ref\": \"#/definitions/fields\"\n - \ }\n ]\n }\n }\n - \ }\n }\n }\n },\n {\n \"$comment\": - \"This is the schema for the fields in Summaries. By default, only checks - the existance of the properties, but not the schema of the summaries.\",\n - \ \"required\": [\n \"summaries\"\n ],\n \"properties\": - {\n \"summaries\": {\n \"$ref\": \"#/definitions/require_any_field\"\n - \ }\n }\n }\n ]\n }\n ],\n \"definitions\": - {\n \"stac_extensions\": {\n \"type\": \"object\",\n \"required\": - [\n \"stac_extensions\"\n ],\n \"properties\": {\n \"stac_extensions\": - {\n \"type\": \"array\",\n \"contains\": {\n \"const\": - \"https://stac-extensions.github.io/version/v1.0.0/schema.json\"\n }\n - \ }\n }\n },\n \"require_any_field\": {\n \"$comment\": - \"Please list all fields here so that we can force the existance of one of - them in other parts of the schemas.\",\n \"anyOf\": [\n {\"required\": - [\"version\"]},\n {\"required\": [\"deprecated\"]}\n ]\n },\n - \ \"fields\": {\n \"type\": \"object\",\n \"properties\": {\n - \ \"version\": {\n \"type\": \"string\",\n \"title\": - \"Version\"\n },\n \"deprecated\": {\n \"type\": \"boolean\",\n - \ \"title\": \"Deprecated\",\n \"default\": false\n }\n - \ }\n }\n }\n}\n" - headers: - Accept-Ranges: - - bytes - Access-Control-Allow-Origin: - - '*' - Age: - - '516' - Cache-Control: - - max-age=600 - Connection: - - close - Content-Length: - - '5009' - Content-Type: - - application/json; charset=utf-8 - Date: - - Wed, 27 Sep 2023 21:20:49 GMT - ETag: - - '"645249bd-1391"' - Last-Modified: - - Wed, 03 May 2023 11:47:09 GMT - Server: - - GitHub.com - Strict-Transport-Security: - - max-age=31556952 - Vary: - - Accept-Encoding - Via: - - 1.1 varnish - X-Cache: - - HIT - X-Cache-Hits: - - '1' - X-Fastly-Request-ID: - - 0d1710c11f74dd885ed23c36249d7cc7a99f4f60 - X-GitHub-Request-Id: - - 96AE:1981:28905C:3865AF:65149AAC - X-Served-By: - - cache-lga21938-LGA - X-Timer: - - S1695849649.472479,VS0,VE2 - expires: - - Wed, 27 Sep 2023 21:22:13 GMT - permissions-policy: - - interest-cohort=() - x-proxy-cache: - - MISS - status: - code: 200 - message: OK -version: 1 diff --git a/tests/extensions/cassettes/test_version/ItemVersionExtensionTest.test_add_version.yaml b/tests/extensions/cassettes/test_version/ItemVersionExtensionTest.test_add_version.yaml deleted file mode 100644 index 62102665e..000000000 --- a/tests/extensions/cassettes/test_version/ItemVersionExtensionTest.test_add_version.yaml +++ /dev/null @@ -1,131 +0,0 @@ -interactions: -- request: - body: null - headers: - Connection: - - close - Host: - - stac-extensions.github.io - User-Agent: - - Python-urllib/3.11 - method: GET - uri: https://stac-extensions.github.io/version/v1.0.0/schema.json - response: - body: - string: "{\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"$id\": - \"https://stac-extensions.github.io/version/v1.0.0/schema.json#\",\n \"title\": - \"Versioning Indicators Extension\",\n \"description\": \"STAC Versioning - Indicators Extension for STAC Items and STAC Collections.\",\n \"oneOf\": - [\n {\n \"$comment\": \"This is the schema for STAC Items. Remove - this object if this extension only applies to Collections.\",\n \"allOf\": - [\n {\n \"$ref\": \"#/definitions/stac_extensions\"\n },\n - \ {\n \"type\": \"object\",\n \"required\": [\n \"type\",\n - \ \"properties\",\n \"assets\"\n ],\n \"properties\": - {\n \"type\": {\n \"const\": \"Feature\"\n },\n - \ \"properties\": {\n \"allOf\": [\n {\n - \ \"$comment\": \"Require fields here for item properties.\",\n - \ \"required\": [\n \"version\"\n ]\n - \ },\n {\n \"$ref\": \"#/definitions/fields\"\n - \ }\n ]\n },\n \"assets\": - {\n \"$comment\": \"This validates the fields in Item Assets, - but does not require them.\",\n \"type\": \"object\",\n \"additionalProperties\": - {\n \"$ref\": \"#/definitions/fields\"\n }\n }\n - \ }\n }\n ]\n },\n {\n \"$comment\": \"This - is the schema for STAC Collections.\",\n \"type\": \"object\",\n \"allOf\": - [\n {\n \"required\": [\n \"type\"\n ],\n - \ \"properties\": {\n \"type\": {\n \"const\": - \"Collection\"\n }\n }\n },\n {\n \"$ref\": - \"#/definitions/stac_extensions\"\n }\n ],\n \"anyOf\": [\n - \ {\n \"$comment\": \"This is the schema for the top-level - fields in a Collection. Remove this if this extension does not define top-level - fields for Collections.\",\n \"allOf\": [\n {\n \"$comment\": - \"Require fields here for Collections (top-level).\",\n \"required\": - [\n \"version\"\n ]\n },\n {\n - \ \"$ref\": \"#/definitions/fields\"\n }\n ]\n - \ },\n {\n \"$comment\": \"This validates the fields - in Collection Assets, but does not require them.\",\n \"required\": - [\n \"assets\"\n ],\n \"properties\": {\n \"assets\": - {\n \"type\": \"object\",\n \"not\": {\n \"additionalProperties\": - {\n \"not\": {\n \"allOf\": [\n {\n - \ \"$ref\": \"#/definitions/require_any_field\"\n },\n - \ {\n \"$ref\": \"#/definitions/fields\"\n - \ }\n ]\n }\n }\n - \ }\n }\n }\n },\n {\n \"$comment\": - \"This is the schema for the fields in Item Asset Definitions. It doesn't - require any fields.\",\n \"required\": [\n \"item_assets\"\n - \ ],\n \"properties\": {\n \"item_assets\": {\n - \ \"type\": \"object\",\n \"not\": {\n \"additionalProperties\": - {\n \"not\": {\n \"allOf\": [\n {\n - \ \"$ref\": \"#/definitions/require_any_field\"\n },\n - \ {\n \"$ref\": \"#/definitions/fields\"\n - \ }\n ]\n }\n }\n - \ }\n }\n }\n },\n {\n \"$comment\": - \"This is the schema for the fields in Summaries. By default, only checks - the existance of the properties, but not the schema of the summaries.\",\n - \ \"required\": [\n \"summaries\"\n ],\n \"properties\": - {\n \"summaries\": {\n \"$ref\": \"#/definitions/require_any_field\"\n - \ }\n }\n }\n ]\n }\n ],\n \"definitions\": - {\n \"stac_extensions\": {\n \"type\": \"object\",\n \"required\": - [\n \"stac_extensions\"\n ],\n \"properties\": {\n \"stac_extensions\": - {\n \"type\": \"array\",\n \"contains\": {\n \"const\": - \"https://stac-extensions.github.io/version/v1.0.0/schema.json\"\n }\n - \ }\n }\n },\n \"require_any_field\": {\n \"$comment\": - \"Please list all fields here so that we can force the existance of one of - them in other parts of the schemas.\",\n \"anyOf\": [\n {\"required\": - [\"version\"]},\n {\"required\": [\"deprecated\"]}\n ]\n },\n - \ \"fields\": {\n \"type\": \"object\",\n \"properties\": {\n - \ \"version\": {\n \"type\": \"string\",\n \"title\": - \"Version\"\n },\n \"deprecated\": {\n \"type\": \"boolean\",\n - \ \"title\": \"Deprecated\",\n \"default\": false\n }\n - \ }\n }\n }\n}\n" - headers: - Accept-Ranges: - - bytes - Access-Control-Allow-Origin: - - '*' - Age: - - '516' - Cache-Control: - - max-age=600 - Connection: - - close - Content-Length: - - '5009' - Content-Type: - - application/json; charset=utf-8 - Date: - - Wed, 27 Sep 2023 21:20:49 GMT - ETag: - - '"645249bd-1391"' - Last-Modified: - - Wed, 03 May 2023 11:47:09 GMT - Server: - - GitHub.com - Strict-Transport-Security: - - max-age=31556952 - Vary: - - Accept-Encoding - Via: - - 1.1 varnish - X-Cache: - - HIT - X-Cache-Hits: - - '1' - X-Fastly-Request-ID: - - 7268ba787ef0f580c134058a458e3a71dfec2e7a - X-GitHub-Request-Id: - - 96AE:1981:28905C:3865AF:65149AAC - X-Served-By: - - cache-lga21956-LGA - X-Timer: - - S1695849650.608273,VS0,VE2 - expires: - - Wed, 27 Sep 2023 21:22:13 GMT - permissions-policy: - - interest-cohort=() - x-proxy-cache: - - MISS - status: - code: 200 - message: OK -version: 1 diff --git a/tests/extensions/cassettes/test_version/ItemVersionExtensionTest.test_all_links.yaml b/tests/extensions/cassettes/test_version/ItemVersionExtensionTest.test_all_links.yaml deleted file mode 100644 index 1dc7361aa..000000000 --- a/tests/extensions/cassettes/test_version/ItemVersionExtensionTest.test_all_links.yaml +++ /dev/null @@ -1,131 +0,0 @@ -interactions: -- request: - body: null - headers: - Connection: - - close - Host: - - stac-extensions.github.io - User-Agent: - - Python-urllib/3.11 - method: GET - uri: https://stac-extensions.github.io/version/v1.0.0/schema.json - response: - body: - string: "{\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"$id\": - \"https://stac-extensions.github.io/version/v1.0.0/schema.json#\",\n \"title\": - \"Versioning Indicators Extension\",\n \"description\": \"STAC Versioning - Indicators Extension for STAC Items and STAC Collections.\",\n \"oneOf\": - [\n {\n \"$comment\": \"This is the schema for STAC Items. Remove - this object if this extension only applies to Collections.\",\n \"allOf\": - [\n {\n \"$ref\": \"#/definitions/stac_extensions\"\n },\n - \ {\n \"type\": \"object\",\n \"required\": [\n \"type\",\n - \ \"properties\",\n \"assets\"\n ],\n \"properties\": - {\n \"type\": {\n \"const\": \"Feature\"\n },\n - \ \"properties\": {\n \"allOf\": [\n {\n - \ \"$comment\": \"Require fields here for item properties.\",\n - \ \"required\": [\n \"version\"\n ]\n - \ },\n {\n \"$ref\": \"#/definitions/fields\"\n - \ }\n ]\n },\n \"assets\": - {\n \"$comment\": \"This validates the fields in Item Assets, - but does not require them.\",\n \"type\": \"object\",\n \"additionalProperties\": - {\n \"$ref\": \"#/definitions/fields\"\n }\n }\n - \ }\n }\n ]\n },\n {\n \"$comment\": \"This - is the schema for STAC Collections.\",\n \"type\": \"object\",\n \"allOf\": - [\n {\n \"required\": [\n \"type\"\n ],\n - \ \"properties\": {\n \"type\": {\n \"const\": - \"Collection\"\n }\n }\n },\n {\n \"$ref\": - \"#/definitions/stac_extensions\"\n }\n ],\n \"anyOf\": [\n - \ {\n \"$comment\": \"This is the schema for the top-level - fields in a Collection. Remove this if this extension does not define top-level - fields for Collections.\",\n \"allOf\": [\n {\n \"$comment\": - \"Require fields here for Collections (top-level).\",\n \"required\": - [\n \"version\"\n ]\n },\n {\n - \ \"$ref\": \"#/definitions/fields\"\n }\n ]\n - \ },\n {\n \"$comment\": \"This validates the fields - in Collection Assets, but does not require them.\",\n \"required\": - [\n \"assets\"\n ],\n \"properties\": {\n \"assets\": - {\n \"type\": \"object\",\n \"not\": {\n \"additionalProperties\": - {\n \"not\": {\n \"allOf\": [\n {\n - \ \"$ref\": \"#/definitions/require_any_field\"\n },\n - \ {\n \"$ref\": \"#/definitions/fields\"\n - \ }\n ]\n }\n }\n - \ }\n }\n }\n },\n {\n \"$comment\": - \"This is the schema for the fields in Item Asset Definitions. It doesn't - require any fields.\",\n \"required\": [\n \"item_assets\"\n - \ ],\n \"properties\": {\n \"item_assets\": {\n - \ \"type\": \"object\",\n \"not\": {\n \"additionalProperties\": - {\n \"not\": {\n \"allOf\": [\n {\n - \ \"$ref\": \"#/definitions/require_any_field\"\n },\n - \ {\n \"$ref\": \"#/definitions/fields\"\n - \ }\n ]\n }\n }\n - \ }\n }\n }\n },\n {\n \"$comment\": - \"This is the schema for the fields in Summaries. By default, only checks - the existance of the properties, but not the schema of the summaries.\",\n - \ \"required\": [\n \"summaries\"\n ],\n \"properties\": - {\n \"summaries\": {\n \"$ref\": \"#/definitions/require_any_field\"\n - \ }\n }\n }\n ]\n }\n ],\n \"definitions\": - {\n \"stac_extensions\": {\n \"type\": \"object\",\n \"required\": - [\n \"stac_extensions\"\n ],\n \"properties\": {\n \"stac_extensions\": - {\n \"type\": \"array\",\n \"contains\": {\n \"const\": - \"https://stac-extensions.github.io/version/v1.0.0/schema.json\"\n }\n - \ }\n }\n },\n \"require_any_field\": {\n \"$comment\": - \"Please list all fields here so that we can force the existance of one of - them in other parts of the schemas.\",\n \"anyOf\": [\n {\"required\": - [\"version\"]},\n {\"required\": [\"deprecated\"]}\n ]\n },\n - \ \"fields\": {\n \"type\": \"object\",\n \"properties\": {\n - \ \"version\": {\n \"type\": \"string\",\n \"title\": - \"Version\"\n },\n \"deprecated\": {\n \"type\": \"boolean\",\n - \ \"title\": \"Deprecated\",\n \"default\": false\n }\n - \ }\n }\n }\n}\n" - headers: - Accept-Ranges: - - bytes - Access-Control-Allow-Origin: - - '*' - Age: - - '516' - Cache-Control: - - max-age=600 - Connection: - - close - Content-Length: - - '5009' - Content-Type: - - application/json; charset=utf-8 - Date: - - Wed, 27 Sep 2023 21:20:49 GMT - ETag: - - '"645249bd-1391"' - Last-Modified: - - Wed, 03 May 2023 11:47:09 GMT - Server: - - GitHub.com - Strict-Transport-Security: - - max-age=31556952 - Vary: - - Accept-Encoding - Via: - - 1.1 varnish - X-Cache: - - HIT - X-Cache-Hits: - - '1' - X-Fastly-Request-ID: - - 23409828487e62ce75feddb9098c346366ddc99d - X-GitHub-Request-Id: - - 96AE:1981:28905C:3865AF:65149AAC - X-Served-By: - - cache-lga21962-LGA - X-Timer: - - S1695849650.736781,VS0,VE2 - expires: - - Wed, 27 Sep 2023 21:22:13 GMT - permissions-policy: - - interest-cohort=() - x-proxy-cache: - - MISS - status: - code: 200 - message: OK -version: 1 diff --git a/tests/extensions/cassettes/test_version/ItemVersionExtensionTest.test_fail_validate.yaml b/tests/extensions/cassettes/test_version/ItemVersionExtensionTest.test_fail_validate.yaml deleted file mode 100644 index afb162029..000000000 --- a/tests/extensions/cassettes/test_version/ItemVersionExtensionTest.test_fail_validate.yaml +++ /dev/null @@ -1,131 +0,0 @@ -interactions: -- request: - body: null - headers: - Connection: - - close - Host: - - stac-extensions.github.io - User-Agent: - - Python-urllib/3.11 - method: GET - uri: https://stac-extensions.github.io/version/v1.0.0/schema.json - response: - body: - string: "{\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"$id\": - \"https://stac-extensions.github.io/version/v1.0.0/schema.json#\",\n \"title\": - \"Versioning Indicators Extension\",\n \"description\": \"STAC Versioning - Indicators Extension for STAC Items and STAC Collections.\",\n \"oneOf\": - [\n {\n \"$comment\": \"This is the schema for STAC Items. Remove - this object if this extension only applies to Collections.\",\n \"allOf\": - [\n {\n \"$ref\": \"#/definitions/stac_extensions\"\n },\n - \ {\n \"type\": \"object\",\n \"required\": [\n \"type\",\n - \ \"properties\",\n \"assets\"\n ],\n \"properties\": - {\n \"type\": {\n \"const\": \"Feature\"\n },\n - \ \"properties\": {\n \"allOf\": [\n {\n - \ \"$comment\": \"Require fields here for item properties.\",\n - \ \"required\": [\n \"version\"\n ]\n - \ },\n {\n \"$ref\": \"#/definitions/fields\"\n - \ }\n ]\n },\n \"assets\": - {\n \"$comment\": \"This validates the fields in Item Assets, - but does not require them.\",\n \"type\": \"object\",\n \"additionalProperties\": - {\n \"$ref\": \"#/definitions/fields\"\n }\n }\n - \ }\n }\n ]\n },\n {\n \"$comment\": \"This - is the schema for STAC Collections.\",\n \"type\": \"object\",\n \"allOf\": - [\n {\n \"required\": [\n \"type\"\n ],\n - \ \"properties\": {\n \"type\": {\n \"const\": - \"Collection\"\n }\n }\n },\n {\n \"$ref\": - \"#/definitions/stac_extensions\"\n }\n ],\n \"anyOf\": [\n - \ {\n \"$comment\": \"This is the schema for the top-level - fields in a Collection. Remove this if this extension does not define top-level - fields for Collections.\",\n \"allOf\": [\n {\n \"$comment\": - \"Require fields here for Collections (top-level).\",\n \"required\": - [\n \"version\"\n ]\n },\n {\n - \ \"$ref\": \"#/definitions/fields\"\n }\n ]\n - \ },\n {\n \"$comment\": \"This validates the fields - in Collection Assets, but does not require them.\",\n \"required\": - [\n \"assets\"\n ],\n \"properties\": {\n \"assets\": - {\n \"type\": \"object\",\n \"not\": {\n \"additionalProperties\": - {\n \"not\": {\n \"allOf\": [\n {\n - \ \"$ref\": \"#/definitions/require_any_field\"\n },\n - \ {\n \"$ref\": \"#/definitions/fields\"\n - \ }\n ]\n }\n }\n - \ }\n }\n }\n },\n {\n \"$comment\": - \"This is the schema for the fields in Item Asset Definitions. It doesn't - require any fields.\",\n \"required\": [\n \"item_assets\"\n - \ ],\n \"properties\": {\n \"item_assets\": {\n - \ \"type\": \"object\",\n \"not\": {\n \"additionalProperties\": - {\n \"not\": {\n \"allOf\": [\n {\n - \ \"$ref\": \"#/definitions/require_any_field\"\n },\n - \ {\n \"$ref\": \"#/definitions/fields\"\n - \ }\n ]\n }\n }\n - \ }\n }\n }\n },\n {\n \"$comment\": - \"This is the schema for the fields in Summaries. By default, only checks - the existance of the properties, but not the schema of the summaries.\",\n - \ \"required\": [\n \"summaries\"\n ],\n \"properties\": - {\n \"summaries\": {\n \"$ref\": \"#/definitions/require_any_field\"\n - \ }\n }\n }\n ]\n }\n ],\n \"definitions\": - {\n \"stac_extensions\": {\n \"type\": \"object\",\n \"required\": - [\n \"stac_extensions\"\n ],\n \"properties\": {\n \"stac_extensions\": - {\n \"type\": \"array\",\n \"contains\": {\n \"const\": - \"https://stac-extensions.github.io/version/v1.0.0/schema.json\"\n }\n - \ }\n }\n },\n \"require_any_field\": {\n \"$comment\": - \"Please list all fields here so that we can force the existance of one of - them in other parts of the schemas.\",\n \"anyOf\": [\n {\"required\": - [\"version\"]},\n {\"required\": [\"deprecated\"]}\n ]\n },\n - \ \"fields\": {\n \"type\": \"object\",\n \"properties\": {\n - \ \"version\": {\n \"type\": \"string\",\n \"title\": - \"Version\"\n },\n \"deprecated\": {\n \"type\": \"boolean\",\n - \ \"title\": \"Deprecated\",\n \"default\": false\n }\n - \ }\n }\n }\n}\n" - headers: - Accept-Ranges: - - bytes - Access-Control-Allow-Origin: - - '*' - Age: - - '516' - Cache-Control: - - max-age=600 - Connection: - - close - Content-Length: - - '5009' - Content-Type: - - application/json; charset=utf-8 - Date: - - Wed, 27 Sep 2023 21:20:49 GMT - ETag: - - '"645249bd-1391"' - Last-Modified: - - Wed, 03 May 2023 11:47:09 GMT - Server: - - GitHub.com - Strict-Transport-Security: - - max-age=31556952 - Vary: - - Accept-Encoding - Via: - - 1.1 varnish - X-Cache: - - HIT - X-Cache-Hits: - - '1' - X-Fastly-Request-ID: - - 3de786e583bfd289b3b278cbd9d8cf4b3047614c - X-GitHub-Request-Id: - - 96AE:1981:28905C:3865AF:65149AAC - X-Served-By: - - cache-lga21950-LGA - X-Timer: - - S1695849650.880264,VS0,VE2 - expires: - - Wed, 27 Sep 2023 21:22:13 GMT - permissions-policy: - - interest-cohort=() - x-proxy-cache: - - MISS - status: - code: 200 - message: OK -version: 1 diff --git a/tests/extensions/cassettes/test_version/ItemVersionExtensionTest.test_latest.yaml b/tests/extensions/cassettes/test_version/ItemVersionExtensionTest.test_latest.yaml deleted file mode 100644 index b1df6a2d5..000000000 --- a/tests/extensions/cassettes/test_version/ItemVersionExtensionTest.test_latest.yaml +++ /dev/null @@ -1,131 +0,0 @@ -interactions: -- request: - body: null - headers: - Connection: - - close - Host: - - stac-extensions.github.io - User-Agent: - - Python-urllib/3.11 - method: GET - uri: https://stac-extensions.github.io/version/v1.0.0/schema.json - response: - body: - string: "{\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"$id\": - \"https://stac-extensions.github.io/version/v1.0.0/schema.json#\",\n \"title\": - \"Versioning Indicators Extension\",\n \"description\": \"STAC Versioning - Indicators Extension for STAC Items and STAC Collections.\",\n \"oneOf\": - [\n {\n \"$comment\": \"This is the schema for STAC Items. Remove - this object if this extension only applies to Collections.\",\n \"allOf\": - [\n {\n \"$ref\": \"#/definitions/stac_extensions\"\n },\n - \ {\n \"type\": \"object\",\n \"required\": [\n \"type\",\n - \ \"properties\",\n \"assets\"\n ],\n \"properties\": - {\n \"type\": {\n \"const\": \"Feature\"\n },\n - \ \"properties\": {\n \"allOf\": [\n {\n - \ \"$comment\": \"Require fields here for item properties.\",\n - \ \"required\": [\n \"version\"\n ]\n - \ },\n {\n \"$ref\": \"#/definitions/fields\"\n - \ }\n ]\n },\n \"assets\": - {\n \"$comment\": \"This validates the fields in Item Assets, - but does not require them.\",\n \"type\": \"object\",\n \"additionalProperties\": - {\n \"$ref\": \"#/definitions/fields\"\n }\n }\n - \ }\n }\n ]\n },\n {\n \"$comment\": \"This - is the schema for STAC Collections.\",\n \"type\": \"object\",\n \"allOf\": - [\n {\n \"required\": [\n \"type\"\n ],\n - \ \"properties\": {\n \"type\": {\n \"const\": - \"Collection\"\n }\n }\n },\n {\n \"$ref\": - \"#/definitions/stac_extensions\"\n }\n ],\n \"anyOf\": [\n - \ {\n \"$comment\": \"This is the schema for the top-level - fields in a Collection. Remove this if this extension does not define top-level - fields for Collections.\",\n \"allOf\": [\n {\n \"$comment\": - \"Require fields here for Collections (top-level).\",\n \"required\": - [\n \"version\"\n ]\n },\n {\n - \ \"$ref\": \"#/definitions/fields\"\n }\n ]\n - \ },\n {\n \"$comment\": \"This validates the fields - in Collection Assets, but does not require them.\",\n \"required\": - [\n \"assets\"\n ],\n \"properties\": {\n \"assets\": - {\n \"type\": \"object\",\n \"not\": {\n \"additionalProperties\": - {\n \"not\": {\n \"allOf\": [\n {\n - \ \"$ref\": \"#/definitions/require_any_field\"\n },\n - \ {\n \"$ref\": \"#/definitions/fields\"\n - \ }\n ]\n }\n }\n - \ }\n }\n }\n },\n {\n \"$comment\": - \"This is the schema for the fields in Item Asset Definitions. It doesn't - require any fields.\",\n \"required\": [\n \"item_assets\"\n - \ ],\n \"properties\": {\n \"item_assets\": {\n - \ \"type\": \"object\",\n \"not\": {\n \"additionalProperties\": - {\n \"not\": {\n \"allOf\": [\n {\n - \ \"$ref\": \"#/definitions/require_any_field\"\n },\n - \ {\n \"$ref\": \"#/definitions/fields\"\n - \ }\n ]\n }\n }\n - \ }\n }\n }\n },\n {\n \"$comment\": - \"This is the schema for the fields in Summaries. By default, only checks - the existance of the properties, but not the schema of the summaries.\",\n - \ \"required\": [\n \"summaries\"\n ],\n \"properties\": - {\n \"summaries\": {\n \"$ref\": \"#/definitions/require_any_field\"\n - \ }\n }\n }\n ]\n }\n ],\n \"definitions\": - {\n \"stac_extensions\": {\n \"type\": \"object\",\n \"required\": - [\n \"stac_extensions\"\n ],\n \"properties\": {\n \"stac_extensions\": - {\n \"type\": \"array\",\n \"contains\": {\n \"const\": - \"https://stac-extensions.github.io/version/v1.0.0/schema.json\"\n }\n - \ }\n }\n },\n \"require_any_field\": {\n \"$comment\": - \"Please list all fields here so that we can force the existance of one of - them in other parts of the schemas.\",\n \"anyOf\": [\n {\"required\": - [\"version\"]},\n {\"required\": [\"deprecated\"]}\n ]\n },\n - \ \"fields\": {\n \"type\": \"object\",\n \"properties\": {\n - \ \"version\": {\n \"type\": \"string\",\n \"title\": - \"Version\"\n },\n \"deprecated\": {\n \"type\": \"boolean\",\n - \ \"title\": \"Deprecated\",\n \"default\": false\n }\n - \ }\n }\n }\n}\n" - headers: - Accept-Ranges: - - bytes - Access-Control-Allow-Origin: - - '*' - Age: - - '516' - Cache-Control: - - max-age=600 - Connection: - - close - Content-Length: - - '5009' - Content-Type: - - application/json; charset=utf-8 - Date: - - Wed, 27 Sep 2023 21:20:50 GMT - ETag: - - '"645249bd-1391"' - Last-Modified: - - Wed, 03 May 2023 11:47:09 GMT - Server: - - GitHub.com - Strict-Transport-Security: - - max-age=31556952 - Vary: - - Accept-Encoding - Via: - - 1.1 varnish - X-Cache: - - HIT - X-Cache-Hits: - - '1' - X-Fastly-Request-ID: - - 8803f491844c96a22564e51ecd5cdf1fbd6214b5 - X-GitHub-Request-Id: - - 96AE:1981:28905C:3865AF:65149AAC - X-Served-By: - - cache-lga21947-LGA - X-Timer: - - S1695849650.041793,VS0,VE2 - expires: - - Wed, 27 Sep 2023 21:22:13 GMT - permissions-policy: - - interest-cohort=() - x-proxy-cache: - - MISS - status: - code: 200 - message: OK -version: 1 diff --git a/tests/extensions/cassettes/test_version/ItemVersionExtensionTest.test_predecessor.yaml b/tests/extensions/cassettes/test_version/ItemVersionExtensionTest.test_predecessor.yaml deleted file mode 100644 index 3c1e3951a..000000000 --- a/tests/extensions/cassettes/test_version/ItemVersionExtensionTest.test_predecessor.yaml +++ /dev/null @@ -1,131 +0,0 @@ -interactions: -- request: - body: null - headers: - Connection: - - close - Host: - - stac-extensions.github.io - User-Agent: - - Python-urllib/3.11 - method: GET - uri: https://stac-extensions.github.io/version/v1.0.0/schema.json - response: - body: - string: "{\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"$id\": - \"https://stac-extensions.github.io/version/v1.0.0/schema.json#\",\n \"title\": - \"Versioning Indicators Extension\",\n \"description\": \"STAC Versioning - Indicators Extension for STAC Items and STAC Collections.\",\n \"oneOf\": - [\n {\n \"$comment\": \"This is the schema for STAC Items. Remove - this object if this extension only applies to Collections.\",\n \"allOf\": - [\n {\n \"$ref\": \"#/definitions/stac_extensions\"\n },\n - \ {\n \"type\": \"object\",\n \"required\": [\n \"type\",\n - \ \"properties\",\n \"assets\"\n ],\n \"properties\": - {\n \"type\": {\n \"const\": \"Feature\"\n },\n - \ \"properties\": {\n \"allOf\": [\n {\n - \ \"$comment\": \"Require fields here for item properties.\",\n - \ \"required\": [\n \"version\"\n ]\n - \ },\n {\n \"$ref\": \"#/definitions/fields\"\n - \ }\n ]\n },\n \"assets\": - {\n \"$comment\": \"This validates the fields in Item Assets, - but does not require them.\",\n \"type\": \"object\",\n \"additionalProperties\": - {\n \"$ref\": \"#/definitions/fields\"\n }\n }\n - \ }\n }\n ]\n },\n {\n \"$comment\": \"This - is the schema for STAC Collections.\",\n \"type\": \"object\",\n \"allOf\": - [\n {\n \"required\": [\n \"type\"\n ],\n - \ \"properties\": {\n \"type\": {\n \"const\": - \"Collection\"\n }\n }\n },\n {\n \"$ref\": - \"#/definitions/stac_extensions\"\n }\n ],\n \"anyOf\": [\n - \ {\n \"$comment\": \"This is the schema for the top-level - fields in a Collection. Remove this if this extension does not define top-level - fields for Collections.\",\n \"allOf\": [\n {\n \"$comment\": - \"Require fields here for Collections (top-level).\",\n \"required\": - [\n \"version\"\n ]\n },\n {\n - \ \"$ref\": \"#/definitions/fields\"\n }\n ]\n - \ },\n {\n \"$comment\": \"This validates the fields - in Collection Assets, but does not require them.\",\n \"required\": - [\n \"assets\"\n ],\n \"properties\": {\n \"assets\": - {\n \"type\": \"object\",\n \"not\": {\n \"additionalProperties\": - {\n \"not\": {\n \"allOf\": [\n {\n - \ \"$ref\": \"#/definitions/require_any_field\"\n },\n - \ {\n \"$ref\": \"#/definitions/fields\"\n - \ }\n ]\n }\n }\n - \ }\n }\n }\n },\n {\n \"$comment\": - \"This is the schema for the fields in Item Asset Definitions. It doesn't - require any fields.\",\n \"required\": [\n \"item_assets\"\n - \ ],\n \"properties\": {\n \"item_assets\": {\n - \ \"type\": \"object\",\n \"not\": {\n \"additionalProperties\": - {\n \"not\": {\n \"allOf\": [\n {\n - \ \"$ref\": \"#/definitions/require_any_field\"\n },\n - \ {\n \"$ref\": \"#/definitions/fields\"\n - \ }\n ]\n }\n }\n - \ }\n }\n }\n },\n {\n \"$comment\": - \"This is the schema for the fields in Summaries. By default, only checks - the existance of the properties, but not the schema of the summaries.\",\n - \ \"required\": [\n \"summaries\"\n ],\n \"properties\": - {\n \"summaries\": {\n \"$ref\": \"#/definitions/require_any_field\"\n - \ }\n }\n }\n ]\n }\n ],\n \"definitions\": - {\n \"stac_extensions\": {\n \"type\": \"object\",\n \"required\": - [\n \"stac_extensions\"\n ],\n \"properties\": {\n \"stac_extensions\": - {\n \"type\": \"array\",\n \"contains\": {\n \"const\": - \"https://stac-extensions.github.io/version/v1.0.0/schema.json\"\n }\n - \ }\n }\n },\n \"require_any_field\": {\n \"$comment\": - \"Please list all fields here so that we can force the existance of one of - them in other parts of the schemas.\",\n \"anyOf\": [\n {\"required\": - [\"version\"]},\n {\"required\": [\"deprecated\"]}\n ]\n },\n - \ \"fields\": {\n \"type\": \"object\",\n \"properties\": {\n - \ \"version\": {\n \"type\": \"string\",\n \"title\": - \"Version\"\n },\n \"deprecated\": {\n \"type\": \"boolean\",\n - \ \"title\": \"Deprecated\",\n \"default\": false\n }\n - \ }\n }\n }\n}\n" - headers: - Accept-Ranges: - - bytes - Access-Control-Allow-Origin: - - '*' - Age: - - '517' - Cache-Control: - - max-age=600 - Connection: - - close - Content-Length: - - '5009' - Content-Type: - - application/json; charset=utf-8 - Date: - - Wed, 27 Sep 2023 21:20:50 GMT - ETag: - - '"645249bd-1391"' - Last-Modified: - - Wed, 03 May 2023 11:47:09 GMT - Server: - - GitHub.com - Strict-Transport-Security: - - max-age=31556952 - Vary: - - Accept-Encoding - Via: - - 1.1 varnish - X-Cache: - - HIT - X-Cache-Hits: - - '1' - X-Fastly-Request-ID: - - 351e5d16b1673cf1be6b345ca7c427f93662b47f - X-GitHub-Request-Id: - - 96AE:1981:28905C:3865AF:65149AAC - X-Served-By: - - cache-lga21928-LGA - X-Timer: - - S1695849650.203105,VS0,VE2 - expires: - - Wed, 27 Sep 2023 21:22:13 GMT - permissions-policy: - - interest-cohort=() - x-proxy-cache: - - MISS - status: - code: 200 - message: OK -version: 1 diff --git a/tests/extensions/cassettes/test_version/ItemVersionExtensionTest.test_successor.yaml b/tests/extensions/cassettes/test_version/ItemVersionExtensionTest.test_successor.yaml deleted file mode 100644 index c218ee89c..000000000 --- a/tests/extensions/cassettes/test_version/ItemVersionExtensionTest.test_successor.yaml +++ /dev/null @@ -1,131 +0,0 @@ -interactions: -- request: - body: null - headers: - Connection: - - close - Host: - - stac-extensions.github.io - User-Agent: - - Python-urllib/3.11 - method: GET - uri: https://stac-extensions.github.io/version/v1.0.0/schema.json - response: - body: - string: "{\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"$id\": - \"https://stac-extensions.github.io/version/v1.0.0/schema.json#\",\n \"title\": - \"Versioning Indicators Extension\",\n \"description\": \"STAC Versioning - Indicators Extension for STAC Items and STAC Collections.\",\n \"oneOf\": - [\n {\n \"$comment\": \"This is the schema for STAC Items. Remove - this object if this extension only applies to Collections.\",\n \"allOf\": - [\n {\n \"$ref\": \"#/definitions/stac_extensions\"\n },\n - \ {\n \"type\": \"object\",\n \"required\": [\n \"type\",\n - \ \"properties\",\n \"assets\"\n ],\n \"properties\": - {\n \"type\": {\n \"const\": \"Feature\"\n },\n - \ \"properties\": {\n \"allOf\": [\n {\n - \ \"$comment\": \"Require fields here for item properties.\",\n - \ \"required\": [\n \"version\"\n ]\n - \ },\n {\n \"$ref\": \"#/definitions/fields\"\n - \ }\n ]\n },\n \"assets\": - {\n \"$comment\": \"This validates the fields in Item Assets, - but does not require them.\",\n \"type\": \"object\",\n \"additionalProperties\": - {\n \"$ref\": \"#/definitions/fields\"\n }\n }\n - \ }\n }\n ]\n },\n {\n \"$comment\": \"This - is the schema for STAC Collections.\",\n \"type\": \"object\",\n \"allOf\": - [\n {\n \"required\": [\n \"type\"\n ],\n - \ \"properties\": {\n \"type\": {\n \"const\": - \"Collection\"\n }\n }\n },\n {\n \"$ref\": - \"#/definitions/stac_extensions\"\n }\n ],\n \"anyOf\": [\n - \ {\n \"$comment\": \"This is the schema for the top-level - fields in a Collection. Remove this if this extension does not define top-level - fields for Collections.\",\n \"allOf\": [\n {\n \"$comment\": - \"Require fields here for Collections (top-level).\",\n \"required\": - [\n \"version\"\n ]\n },\n {\n - \ \"$ref\": \"#/definitions/fields\"\n }\n ]\n - \ },\n {\n \"$comment\": \"This validates the fields - in Collection Assets, but does not require them.\",\n \"required\": - [\n \"assets\"\n ],\n \"properties\": {\n \"assets\": - {\n \"type\": \"object\",\n \"not\": {\n \"additionalProperties\": - {\n \"not\": {\n \"allOf\": [\n {\n - \ \"$ref\": \"#/definitions/require_any_field\"\n },\n - \ {\n \"$ref\": \"#/definitions/fields\"\n - \ }\n ]\n }\n }\n - \ }\n }\n }\n },\n {\n \"$comment\": - \"This is the schema for the fields in Item Asset Definitions. It doesn't - require any fields.\",\n \"required\": [\n \"item_assets\"\n - \ ],\n \"properties\": {\n \"item_assets\": {\n - \ \"type\": \"object\",\n \"not\": {\n \"additionalProperties\": - {\n \"not\": {\n \"allOf\": [\n {\n - \ \"$ref\": \"#/definitions/require_any_field\"\n },\n - \ {\n \"$ref\": \"#/definitions/fields\"\n - \ }\n ]\n }\n }\n - \ }\n }\n }\n },\n {\n \"$comment\": - \"This is the schema for the fields in Summaries. By default, only checks - the existance of the properties, but not the schema of the summaries.\",\n - \ \"required\": [\n \"summaries\"\n ],\n \"properties\": - {\n \"summaries\": {\n \"$ref\": \"#/definitions/require_any_field\"\n - \ }\n }\n }\n ]\n }\n ],\n \"definitions\": - {\n \"stac_extensions\": {\n \"type\": \"object\",\n \"required\": - [\n \"stac_extensions\"\n ],\n \"properties\": {\n \"stac_extensions\": - {\n \"type\": \"array\",\n \"contains\": {\n \"const\": - \"https://stac-extensions.github.io/version/v1.0.0/schema.json\"\n }\n - \ }\n }\n },\n \"require_any_field\": {\n \"$comment\": - \"Please list all fields here so that we can force the existance of one of - them in other parts of the schemas.\",\n \"anyOf\": [\n {\"required\": - [\"version\"]},\n {\"required\": [\"deprecated\"]}\n ]\n },\n - \ \"fields\": {\n \"type\": \"object\",\n \"properties\": {\n - \ \"version\": {\n \"type\": \"string\",\n \"title\": - \"Version\"\n },\n \"deprecated\": {\n \"type\": \"boolean\",\n - \ \"title\": \"Deprecated\",\n \"default\": false\n }\n - \ }\n }\n }\n}\n" - headers: - Accept-Ranges: - - bytes - Access-Control-Allow-Origin: - - '*' - Age: - - '517' - Cache-Control: - - max-age=600 - Connection: - - close - Content-Length: - - '5009' - Content-Type: - - application/json; charset=utf-8 - Date: - - Wed, 27 Sep 2023 21:20:50 GMT - ETag: - - '"645249bd-1391"' - Last-Modified: - - Wed, 03 May 2023 11:47:09 GMT - Server: - - GitHub.com - Strict-Transport-Security: - - max-age=31556952 - Vary: - - Accept-Encoding - Via: - - 1.1 varnish - X-Cache: - - HIT - X-Cache-Hits: - - '1' - X-Fastly-Request-ID: - - b4f39da9a3d422da91576b6743202220c8c70f13 - X-GitHub-Request-Id: - - 96AE:1981:28905C:3865AF:65149AAC - X-Served-By: - - cache-lga21965-LGA - X-Timer: - - S1695849650.349754,VS0,VE2 - expires: - - Wed, 27 Sep 2023 21:22:13 GMT - permissions-policy: - - interest-cohort=() - x-proxy-cache: - - MISS - status: - code: 200 - message: OK -version: 1 diff --git a/tests/extensions/cassettes/test_version/ItemVersionExtensionTest.test_version_in_properties.yaml b/tests/extensions/cassettes/test_version/ItemVersionExtensionTest.test_version_in_properties.yaml deleted file mode 100644 index 3c835c4b3..000000000 --- a/tests/extensions/cassettes/test_version/ItemVersionExtensionTest.test_version_in_properties.yaml +++ /dev/null @@ -1,131 +0,0 @@ -interactions: -- request: - body: null - headers: - Connection: - - close - Host: - - stac-extensions.github.io - User-Agent: - - Python-urllib/3.11 - method: GET - uri: https://stac-extensions.github.io/version/v1.0.0/schema.json - response: - body: - string: "{\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"$id\": - \"https://stac-extensions.github.io/version/v1.0.0/schema.json#\",\n \"title\": - \"Versioning Indicators Extension\",\n \"description\": \"STAC Versioning - Indicators Extension for STAC Items and STAC Collections.\",\n \"oneOf\": - [\n {\n \"$comment\": \"This is the schema for STAC Items. Remove - this object if this extension only applies to Collections.\",\n \"allOf\": - [\n {\n \"$ref\": \"#/definitions/stac_extensions\"\n },\n - \ {\n \"type\": \"object\",\n \"required\": [\n \"type\",\n - \ \"properties\",\n \"assets\"\n ],\n \"properties\": - {\n \"type\": {\n \"const\": \"Feature\"\n },\n - \ \"properties\": {\n \"allOf\": [\n {\n - \ \"$comment\": \"Require fields here for item properties.\",\n - \ \"required\": [\n \"version\"\n ]\n - \ },\n {\n \"$ref\": \"#/definitions/fields\"\n - \ }\n ]\n },\n \"assets\": - {\n \"$comment\": \"This validates the fields in Item Assets, - but does not require them.\",\n \"type\": \"object\",\n \"additionalProperties\": - {\n \"$ref\": \"#/definitions/fields\"\n }\n }\n - \ }\n }\n ]\n },\n {\n \"$comment\": \"This - is the schema for STAC Collections.\",\n \"type\": \"object\",\n \"allOf\": - [\n {\n \"required\": [\n \"type\"\n ],\n - \ \"properties\": {\n \"type\": {\n \"const\": - \"Collection\"\n }\n }\n },\n {\n \"$ref\": - \"#/definitions/stac_extensions\"\n }\n ],\n \"anyOf\": [\n - \ {\n \"$comment\": \"This is the schema for the top-level - fields in a Collection. Remove this if this extension does not define top-level - fields for Collections.\",\n \"allOf\": [\n {\n \"$comment\": - \"Require fields here for Collections (top-level).\",\n \"required\": - [\n \"version\"\n ]\n },\n {\n - \ \"$ref\": \"#/definitions/fields\"\n }\n ]\n - \ },\n {\n \"$comment\": \"This validates the fields - in Collection Assets, but does not require them.\",\n \"required\": - [\n \"assets\"\n ],\n \"properties\": {\n \"assets\": - {\n \"type\": \"object\",\n \"not\": {\n \"additionalProperties\": - {\n \"not\": {\n \"allOf\": [\n {\n - \ \"$ref\": \"#/definitions/require_any_field\"\n },\n - \ {\n \"$ref\": \"#/definitions/fields\"\n - \ }\n ]\n }\n }\n - \ }\n }\n }\n },\n {\n \"$comment\": - \"This is the schema for the fields in Item Asset Definitions. It doesn't - require any fields.\",\n \"required\": [\n \"item_assets\"\n - \ ],\n \"properties\": {\n \"item_assets\": {\n - \ \"type\": \"object\",\n \"not\": {\n \"additionalProperties\": - {\n \"not\": {\n \"allOf\": [\n {\n - \ \"$ref\": \"#/definitions/require_any_field\"\n },\n - \ {\n \"$ref\": \"#/definitions/fields\"\n - \ }\n ]\n }\n }\n - \ }\n }\n }\n },\n {\n \"$comment\": - \"This is the schema for the fields in Summaries. By default, only checks - the existance of the properties, but not the schema of the summaries.\",\n - \ \"required\": [\n \"summaries\"\n ],\n \"properties\": - {\n \"summaries\": {\n \"$ref\": \"#/definitions/require_any_field\"\n - \ }\n }\n }\n ]\n }\n ],\n \"definitions\": - {\n \"stac_extensions\": {\n \"type\": \"object\",\n \"required\": - [\n \"stac_extensions\"\n ],\n \"properties\": {\n \"stac_extensions\": - {\n \"type\": \"array\",\n \"contains\": {\n \"const\": - \"https://stac-extensions.github.io/version/v1.0.0/schema.json\"\n }\n - \ }\n }\n },\n \"require_any_field\": {\n \"$comment\": - \"Please list all fields here so that we can force the existance of one of - them in other parts of the schemas.\",\n \"anyOf\": [\n {\"required\": - [\"version\"]},\n {\"required\": [\"deprecated\"]}\n ]\n },\n - \ \"fields\": {\n \"type\": \"object\",\n \"properties\": {\n - \ \"version\": {\n \"type\": \"string\",\n \"title\": - \"Version\"\n },\n \"deprecated\": {\n \"type\": \"boolean\",\n - \ \"title\": \"Deprecated\",\n \"default\": false\n }\n - \ }\n }\n }\n}\n" - headers: - Accept-Ranges: - - bytes - Access-Control-Allow-Origin: - - '*' - Age: - - '517' - Cache-Control: - - max-age=600 - Connection: - - close - Content-Length: - - '5009' - Content-Type: - - application/json; charset=utf-8 - Date: - - Wed, 27 Sep 2023 21:20:50 GMT - ETag: - - '"645249bd-1391"' - Last-Modified: - - Wed, 03 May 2023 11:47:09 GMT - Server: - - GitHub.com - Strict-Transport-Security: - - max-age=31556952 - Vary: - - Accept-Encoding - Via: - - 1.1 varnish - X-Cache: - - HIT - X-Cache-Hits: - - '1' - X-Fastly-Request-ID: - - c8757216a09cff172aa5f3dd6f582888f9420c7a - X-GitHub-Request-Id: - - 96AE:1981:28905C:3865AF:65149AAC - X-Served-By: - - cache-lga21953-LGA - X-Timer: - - S1695849650.494674,VS0,VE1 - expires: - - Wed, 27 Sep 2023 21:22:13 GMT - permissions-policy: - - interest-cohort=() - x-proxy-cache: - - MISS - status: - code: 200 - message: OK -version: 1 diff --git a/tests/extensions/cassettes/test_version/CollectionVersionExtensionTest.test_predecessor.yaml b/tests/extensions/cassettes/test_version/test_add_deprecated_version.yaml similarity index 96% rename from tests/extensions/cassettes/test_version/CollectionVersionExtensionTest.test_predecessor.yaml rename to tests/extensions/cassettes/test_version/test_add_deprecated_version.yaml index c6838680c..c3083ed25 100644 --- a/tests/extensions/cassettes/test_version/CollectionVersionExtensionTest.test_predecessor.yaml +++ b/tests/extensions/cassettes/test_version/test_add_deprecated_version.yaml @@ -84,7 +84,7 @@ interactions: Access-Control-Allow-Origin: - '*' Age: - - '518' + - '160' Cache-Control: - max-age=600 Connection: @@ -94,7 +94,7 @@ interactions: Content-Type: - application/json; charset=utf-8 Date: - - Wed, 27 Sep 2023 21:20:51 GMT + - Fri, 13 Oct 2023 17:06:37 GMT ETag: - '"645249bd-1391"' Last-Modified: @@ -112,15 +112,15 @@ interactions: X-Cache-Hits: - '1' X-Fastly-Request-ID: - - 461d7b8b0785d9d7b5ad98442cb43bb2cfc1b5d5 + - 93a97b3359e2511b86d3b3a2bffb6387bb5bcc5e X-GitHub-Request-Id: - - 96AE:1981:28905C:3865AF:65149AAC + - 3198:088E:8D4F65:BD7359:6529787C X-Served-By: - - cache-lga21952-LGA + - cache-iad-kjyo7100175-IAD X-Timer: - - S1695849651.289445,VS0,VE2 + - S1697216797.106902,VS0,VE4 expires: - - Wed, 27 Sep 2023 21:22:13 GMT + - Fri, 13 Oct 2023 17:13:57 GMT permissions-policy: - interest-cohort=() x-proxy-cache: diff --git a/tests/extensions/cassettes/test_version/CollectionVersionExtensionTest.test_add_not_deprecated_version.yaml b/tests/extensions/cassettes/test_version/test_add_not_deprecated_version.yaml similarity index 96% rename from tests/extensions/cassettes/test_version/CollectionVersionExtensionTest.test_add_not_deprecated_version.yaml rename to tests/extensions/cassettes/test_version/test_add_not_deprecated_version.yaml index aa857cea1..541756fce 100644 --- a/tests/extensions/cassettes/test_version/CollectionVersionExtensionTest.test_add_not_deprecated_version.yaml +++ b/tests/extensions/cassettes/test_version/test_add_not_deprecated_version.yaml @@ -84,7 +84,7 @@ interactions: Access-Control-Allow-Origin: - '*' Age: - - '517' + - '160' Cache-Control: - max-age=600 Connection: @@ -94,7 +94,7 @@ interactions: Content-Type: - application/json; charset=utf-8 Date: - - Wed, 27 Sep 2023 21:20:50 GMT + - Fri, 13 Oct 2023 17:06:36 GMT ETag: - '"645249bd-1391"' Last-Modified: @@ -112,15 +112,15 @@ interactions: X-Cache-Hits: - '1' X-Fastly-Request-ID: - - 5cc8b1daa791094130bd3d647375872983c7a593 + - ce5e042a2585f50409ab709f6ace8241785d44f7 X-GitHub-Request-Id: - - 96AE:1981:28905C:3865AF:65149AAC + - 3198:088E:8D4F65:BD7359:6529787C X-Served-By: - - cache-lga21944-LGA + - cache-iad-kjyo7100159-IAD X-Timer: - - S1695849651.744949,VS0,VE2 + - S1697216797.953956,VS0,VE2 expires: - - Wed, 27 Sep 2023 21:22:13 GMT + - Fri, 13 Oct 2023 17:13:57 GMT permissions-policy: - interest-cohort=() x-proxy-cache: diff --git a/tests/extensions/cassettes/test_version/CollectionVersionExtensionTest.test_successor.yaml b/tests/extensions/cassettes/test_version/test_add_version.yaml similarity index 96% rename from tests/extensions/cassettes/test_version/CollectionVersionExtensionTest.test_successor.yaml rename to tests/extensions/cassettes/test_version/test_add_version.yaml index cfc6c7dbf..631613e73 100644 --- a/tests/extensions/cassettes/test_version/CollectionVersionExtensionTest.test_successor.yaml +++ b/tests/extensions/cassettes/test_version/test_add_version.yaml @@ -84,7 +84,7 @@ interactions: Access-Control-Allow-Origin: - '*' Age: - - '518' + - '159' Cache-Control: - max-age=600 Connection: @@ -94,7 +94,7 @@ interactions: Content-Type: - application/json; charset=utf-8 Date: - - Wed, 27 Sep 2023 21:20:51 GMT + - Fri, 13 Oct 2023 17:06:36 GMT ETag: - '"645249bd-1391"' Last-Modified: @@ -112,15 +112,15 @@ interactions: X-Cache-Hits: - '1' X-Fastly-Request-ID: - - f0d6b9a4385e311b102ff903774db54d649a26a7 + - 3eb53a4dc40095bc2a5da0e0b43a8ac068d10731 X-GitHub-Request-Id: - - 96AE:1981:28905C:3865AF:65149AAC + - 3198:088E:8D4F65:BD7359:6529787C X-Served-By: - - cache-lga21968-LGA + - cache-iad-kjyo7100105-IAD X-Timer: - - S1695849651.421971,VS0,VE2 + - S1697216797.663531,VS0,VE2 expires: - - Wed, 27 Sep 2023 21:22:13 GMT + - Fri, 13 Oct 2023 17:13:57 GMT permissions-policy: - interest-cohort=() x-proxy-cache: diff --git a/tests/extensions/cassettes/test_version/CollectionVersionExtensionTest.test_fail_validate.yaml b/tests/extensions/cassettes/test_version/test_all_links.yaml similarity index 96% rename from tests/extensions/cassettes/test_version/CollectionVersionExtensionTest.test_fail_validate.yaml rename to tests/extensions/cassettes/test_version/test_all_links.yaml index 1089f9093..80c386dce 100644 --- a/tests/extensions/cassettes/test_version/CollectionVersionExtensionTest.test_fail_validate.yaml +++ b/tests/extensions/cassettes/test_version/test_all_links.yaml @@ -84,7 +84,7 @@ interactions: Access-Control-Allow-Origin: - '*' Age: - - '517' + - '161' Cache-Control: - max-age=600 Connection: @@ -94,7 +94,7 @@ interactions: Content-Type: - application/json; charset=utf-8 Date: - - Wed, 27 Sep 2023 21:20:50 GMT + - Fri, 13 Oct 2023 17:06:37 GMT ETag: - '"645249bd-1391"' Last-Modified: @@ -112,15 +112,15 @@ interactions: X-Cache-Hits: - '1' X-Fastly-Request-ID: - - 8aa620895428e2051aaaba178500112e064afcd1 + - cb1c0112cac3ea978d0aca3802b5c88be98ea4fc X-GitHub-Request-Id: - - 96AE:1981:28905C:3865AF:65149AAC + - 3198:088E:8D4F65:BD7359:6529787C X-Served-By: - - cache-lga21935-LGA + - cache-iad-kjyo7100025-IAD X-Timer: - - S1695849651.980769,VS0,VE11 + - S1697216798.909821,VS0,VE3 expires: - - Wed, 27 Sep 2023 21:22:13 GMT + - Fri, 13 Oct 2023 17:13:57 GMT permissions-policy: - interest-cohort=() x-proxy-cache: diff --git a/tests/extensions/cassettes/test_version/CollectionVersionExtensionTest.test_add_deprecated_version.yaml b/tests/extensions/cassettes/test_version/test_collection_add_version.yaml similarity index 96% rename from tests/extensions/cassettes/test_version/CollectionVersionExtensionTest.test_add_deprecated_version.yaml rename to tests/extensions/cassettes/test_version/test_collection_add_version.yaml index 49f3e4a4a..5eeac9e85 100644 --- a/tests/extensions/cassettes/test_version/CollectionVersionExtensionTest.test_add_deprecated_version.yaml +++ b/tests/extensions/cassettes/test_version/test_collection_add_version.yaml @@ -84,7 +84,7 @@ interactions: Access-Control-Allow-Origin: - '*' Age: - - '517' + - '161' Cache-Control: - max-age=600 Connection: @@ -94,7 +94,7 @@ interactions: Content-Type: - application/json; charset=utf-8 Date: - - Wed, 27 Sep 2023 21:20:50 GMT + - Fri, 13 Oct 2023 17:06:38 GMT ETag: - '"645249bd-1391"' Last-Modified: @@ -112,15 +112,15 @@ interactions: X-Cache-Hits: - '2' X-Fastly-Request-ID: - - 8b9fffd9434fd81ec501ce6f8c825aa774cc06e7 + - 84ee8baf57289a36b25b46757450ab827b8dd8c0 X-GitHub-Request-Id: - - 96AE:1981:28905C:3865AF:65149AAC + - 3198:088E:8D4F65:BD7359:6529787C X-Served-By: - - cache-lga21962-LGA + - cache-iad-kjyo7100082-IAD X-Timer: - - S1695849651.615996,VS0,VE1 + - S1697216798.138845,VS0,VE0 expires: - - Wed, 27 Sep 2023 21:22:13 GMT + - Fri, 13 Oct 2023 17:13:57 GMT permissions-policy: - interest-cohort=() x-proxy-cache: diff --git a/tests/extensions/cassettes/test_version/test_collection_validate_all.yaml b/tests/extensions/cassettes/test_version/test_collection_validate_all.yaml new file mode 100644 index 000000000..699afd23d --- /dev/null +++ b/tests/extensions/cassettes/test_version/test_collection_validate_all.yaml @@ -0,0 +1,131 @@ +interactions: +- request: + body: null + headers: + Connection: + - close + Host: + - stac-extensions.github.io + User-Agent: + - Python-urllib/3.11 + method: GET + uri: https://stac-extensions.github.io/version/v1.0.0/schema.json + response: + body: + string: "{\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"$id\": + \"https://stac-extensions.github.io/version/v1.0.0/schema.json#\",\n \"title\": + \"Versioning Indicators Extension\",\n \"description\": \"STAC Versioning + Indicators Extension for STAC Items and STAC Collections.\",\n \"oneOf\": + [\n {\n \"$comment\": \"This is the schema for STAC Items. Remove + this object if this extension only applies to Collections.\",\n \"allOf\": + [\n {\n \"$ref\": \"#/definitions/stac_extensions\"\n },\n + \ {\n \"type\": \"object\",\n \"required\": [\n \"type\",\n + \ \"properties\",\n \"assets\"\n ],\n \"properties\": + {\n \"type\": {\n \"const\": \"Feature\"\n },\n + \ \"properties\": {\n \"allOf\": [\n {\n + \ \"$comment\": \"Require fields here for item properties.\",\n + \ \"required\": [\n \"version\"\n ]\n + \ },\n {\n \"$ref\": \"#/definitions/fields\"\n + \ }\n ]\n },\n \"assets\": + {\n \"$comment\": \"This validates the fields in Item Assets, + but does not require them.\",\n \"type\": \"object\",\n \"additionalProperties\": + {\n \"$ref\": \"#/definitions/fields\"\n }\n }\n + \ }\n }\n ]\n },\n {\n \"$comment\": \"This + is the schema for STAC Collections.\",\n \"type\": \"object\",\n \"allOf\": + [\n {\n \"required\": [\n \"type\"\n ],\n + \ \"properties\": {\n \"type\": {\n \"const\": + \"Collection\"\n }\n }\n },\n {\n \"$ref\": + \"#/definitions/stac_extensions\"\n }\n ],\n \"anyOf\": [\n + \ {\n \"$comment\": \"This is the schema for the top-level + fields in a Collection. Remove this if this extension does not define top-level + fields for Collections.\",\n \"allOf\": [\n {\n \"$comment\": + \"Require fields here for Collections (top-level).\",\n \"required\": + [\n \"version\"\n ]\n },\n {\n + \ \"$ref\": \"#/definitions/fields\"\n }\n ]\n + \ },\n {\n \"$comment\": \"This validates the fields + in Collection Assets, but does not require them.\",\n \"required\": + [\n \"assets\"\n ],\n \"properties\": {\n \"assets\": + {\n \"type\": \"object\",\n \"not\": {\n \"additionalProperties\": + {\n \"not\": {\n \"allOf\": [\n {\n + \ \"$ref\": \"#/definitions/require_any_field\"\n },\n + \ {\n \"$ref\": \"#/definitions/fields\"\n + \ }\n ]\n }\n }\n + \ }\n }\n }\n },\n {\n \"$comment\": + \"This is the schema for the fields in Item Asset Definitions. It doesn't + require any fields.\",\n \"required\": [\n \"item_assets\"\n + \ ],\n \"properties\": {\n \"item_assets\": {\n + \ \"type\": \"object\",\n \"not\": {\n \"additionalProperties\": + {\n \"not\": {\n \"allOf\": [\n {\n + \ \"$ref\": \"#/definitions/require_any_field\"\n },\n + \ {\n \"$ref\": \"#/definitions/fields\"\n + \ }\n ]\n }\n }\n + \ }\n }\n }\n },\n {\n \"$comment\": + \"This is the schema for the fields in Summaries. By default, only checks + the existance of the properties, but not the schema of the summaries.\",\n + \ \"required\": [\n \"summaries\"\n ],\n \"properties\": + {\n \"summaries\": {\n \"$ref\": \"#/definitions/require_any_field\"\n + \ }\n }\n }\n ]\n }\n ],\n \"definitions\": + {\n \"stac_extensions\": {\n \"type\": \"object\",\n \"required\": + [\n \"stac_extensions\"\n ],\n \"properties\": {\n \"stac_extensions\": + {\n \"type\": \"array\",\n \"contains\": {\n \"const\": + \"https://stac-extensions.github.io/version/v1.0.0/schema.json\"\n }\n + \ }\n }\n },\n \"require_any_field\": {\n \"$comment\": + \"Please list all fields here so that we can force the existance of one of + them in other parts of the schemas.\",\n \"anyOf\": [\n {\"required\": + [\"version\"]},\n {\"required\": [\"deprecated\"]}\n ]\n },\n + \ \"fields\": {\n \"type\": \"object\",\n \"properties\": {\n + \ \"version\": {\n \"type\": \"string\",\n \"title\": + \"Version\"\n },\n \"deprecated\": {\n \"type\": \"boolean\",\n + \ \"title\": \"Deprecated\",\n \"default\": false\n }\n + \ }\n }\n }\n}\n" + headers: + Accept-Ranges: + - bytes + Access-Control-Allow-Origin: + - '*' + Age: + - '179' + Cache-Control: + - max-age=600 + Connection: + - close + Content-Length: + - '5009' + Content-Type: + - application/json; charset=utf-8 + Date: + - Fri, 13 Oct 2023 17:06:55 GMT + ETag: + - '"645249bd-1391"' + Last-Modified: + - Wed, 03 May 2023 11:47:09 GMT + Server: + - GitHub.com + Strict-Transport-Security: + - max-age=31556952 + Vary: + - Accept-Encoding + Via: + - 1.1 varnish + X-Cache: + - HIT + X-Cache-Hits: + - '1' + X-Fastly-Request-ID: + - 0a288a9a74a6d95844d1fbf1a5a734fa0bde4ad0 + X-GitHub-Request-Id: + - 3198:088E:8D4F65:BD7359:6529787C + X-Served-By: + - cache-iad-kjyo7100038-IAD + X-Timer: + - S1697216816.725781,VS0,VE1 + expires: + - Fri, 13 Oct 2023 17:13:57 GMT + permissions-policy: + - interest-cohort=() + x-proxy-cache: + - MISS + status: + code: 200 + message: OK +version: 1 diff --git a/tests/extensions/cassettes/test_version/test_fail_validate.yaml b/tests/extensions/cassettes/test_version/test_fail_validate.yaml new file mode 100644 index 000000000..7e62a301d --- /dev/null +++ b/tests/extensions/cassettes/test_version/test_fail_validate.yaml @@ -0,0 +1,131 @@ +interactions: +- request: + body: null + headers: + Connection: + - close + Host: + - stac-extensions.github.io + User-Agent: + - Python-urllib/3.11 + method: GET + uri: https://stac-extensions.github.io/version/v1.0.0/schema.json + response: + body: + string: "{\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"$id\": + \"https://stac-extensions.github.io/version/v1.0.0/schema.json#\",\n \"title\": + \"Versioning Indicators Extension\",\n \"description\": \"STAC Versioning + Indicators Extension for STAC Items and STAC Collections.\",\n \"oneOf\": + [\n {\n \"$comment\": \"This is the schema for STAC Items. Remove + this object if this extension only applies to Collections.\",\n \"allOf\": + [\n {\n \"$ref\": \"#/definitions/stac_extensions\"\n },\n + \ {\n \"type\": \"object\",\n \"required\": [\n \"type\",\n + \ \"properties\",\n \"assets\"\n ],\n \"properties\": + {\n \"type\": {\n \"const\": \"Feature\"\n },\n + \ \"properties\": {\n \"allOf\": [\n {\n + \ \"$comment\": \"Require fields here for item properties.\",\n + \ \"required\": [\n \"version\"\n ]\n + \ },\n {\n \"$ref\": \"#/definitions/fields\"\n + \ }\n ]\n },\n \"assets\": + {\n \"$comment\": \"This validates the fields in Item Assets, + but does not require them.\",\n \"type\": \"object\",\n \"additionalProperties\": + {\n \"$ref\": \"#/definitions/fields\"\n }\n }\n + \ }\n }\n ]\n },\n {\n \"$comment\": \"This + is the schema for STAC Collections.\",\n \"type\": \"object\",\n \"allOf\": + [\n {\n \"required\": [\n \"type\"\n ],\n + \ \"properties\": {\n \"type\": {\n \"const\": + \"Collection\"\n }\n }\n },\n {\n \"$ref\": + \"#/definitions/stac_extensions\"\n }\n ],\n \"anyOf\": [\n + \ {\n \"$comment\": \"This is the schema for the top-level + fields in a Collection. Remove this if this extension does not define top-level + fields for Collections.\",\n \"allOf\": [\n {\n \"$comment\": + \"Require fields here for Collections (top-level).\",\n \"required\": + [\n \"version\"\n ]\n },\n {\n + \ \"$ref\": \"#/definitions/fields\"\n }\n ]\n + \ },\n {\n \"$comment\": \"This validates the fields + in Collection Assets, but does not require them.\",\n \"required\": + [\n \"assets\"\n ],\n \"properties\": {\n \"assets\": + {\n \"type\": \"object\",\n \"not\": {\n \"additionalProperties\": + {\n \"not\": {\n \"allOf\": [\n {\n + \ \"$ref\": \"#/definitions/require_any_field\"\n },\n + \ {\n \"$ref\": \"#/definitions/fields\"\n + \ }\n ]\n }\n }\n + \ }\n }\n }\n },\n {\n \"$comment\": + \"This is the schema for the fields in Item Asset Definitions. It doesn't + require any fields.\",\n \"required\": [\n \"item_assets\"\n + \ ],\n \"properties\": {\n \"item_assets\": {\n + \ \"type\": \"object\",\n \"not\": {\n \"additionalProperties\": + {\n \"not\": {\n \"allOf\": [\n {\n + \ \"$ref\": \"#/definitions/require_any_field\"\n },\n + \ {\n \"$ref\": \"#/definitions/fields\"\n + \ }\n ]\n }\n }\n + \ }\n }\n }\n },\n {\n \"$comment\": + \"This is the schema for the fields in Summaries. By default, only checks + the existance of the properties, but not the schema of the summaries.\",\n + \ \"required\": [\n \"summaries\"\n ],\n \"properties\": + {\n \"summaries\": {\n \"$ref\": \"#/definitions/require_any_field\"\n + \ }\n }\n }\n ]\n }\n ],\n \"definitions\": + {\n \"stac_extensions\": {\n \"type\": \"object\",\n \"required\": + [\n \"stac_extensions\"\n ],\n \"properties\": {\n \"stac_extensions\": + {\n \"type\": \"array\",\n \"contains\": {\n \"const\": + \"https://stac-extensions.github.io/version/v1.0.0/schema.json\"\n }\n + \ }\n }\n },\n \"require_any_field\": {\n \"$comment\": + \"Please list all fields here so that we can force the existance of one of + them in other parts of the schemas.\",\n \"anyOf\": [\n {\"required\": + [\"version\"]},\n {\"required\": [\"deprecated\"]}\n ]\n },\n + \ \"fields\": {\n \"type\": \"object\",\n \"properties\": {\n + \ \"version\": {\n \"type\": \"string\",\n \"title\": + \"Version\"\n },\n \"deprecated\": {\n \"type\": \"boolean\",\n + \ \"title\": \"Deprecated\",\n \"default\": false\n }\n + \ }\n }\n }\n}\n" + headers: + Accept-Ranges: + - bytes + Access-Control-Allow-Origin: + - '*' + Age: + - '161' + Cache-Control: + - max-age=600 + Connection: + - close + Content-Length: + - '5009' + Content-Type: + - application/json; charset=utf-8 + Date: + - Fri, 13 Oct 2023 17:06:37 GMT + ETag: + - '"645249bd-1391"' + Last-Modified: + - Wed, 03 May 2023 11:47:09 GMT + Server: + - GitHub.com + Strict-Transport-Security: + - max-age=31556952 + Vary: + - Accept-Encoding + Via: + - 1.1 varnish + X-Cache: + - HIT + X-Cache-Hits: + - '1' + X-Fastly-Request-ID: + - c42324df71b1b92536e6576d57c6c856cb72d653 + X-GitHub-Request-Id: + - 3198:088E:8D4F65:BD7359:6529787C + X-Served-By: + - cache-iad-kjyo7100164-IAD + X-Timer: + - S1697216798.765835,VS0,VE2 + expires: + - Fri, 13 Oct 2023 17:13:57 GMT + permissions-policy: + - interest-cohort=() + x-proxy-cache: + - MISS + status: + code: 200 + message: OK +version: 1 diff --git a/tests/extensions/cassettes/test_version/test_latest.yaml b/tests/extensions/cassettes/test_version/test_latest.yaml new file mode 100644 index 000000000..1e81e62f6 --- /dev/null +++ b/tests/extensions/cassettes/test_version/test_latest.yaml @@ -0,0 +1,131 @@ +interactions: +- request: + body: null + headers: + Connection: + - close + Host: + - stac-extensions.github.io + User-Agent: + - Python-urllib/3.11 + method: GET + uri: https://stac-extensions.github.io/version/v1.0.0/schema.json + response: + body: + string: "{\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"$id\": + \"https://stac-extensions.github.io/version/v1.0.0/schema.json#\",\n \"title\": + \"Versioning Indicators Extension\",\n \"description\": \"STAC Versioning + Indicators Extension for STAC Items and STAC Collections.\",\n \"oneOf\": + [\n {\n \"$comment\": \"This is the schema for STAC Items. Remove + this object if this extension only applies to Collections.\",\n \"allOf\": + [\n {\n \"$ref\": \"#/definitions/stac_extensions\"\n },\n + \ {\n \"type\": \"object\",\n \"required\": [\n \"type\",\n + \ \"properties\",\n \"assets\"\n ],\n \"properties\": + {\n \"type\": {\n \"const\": \"Feature\"\n },\n + \ \"properties\": {\n \"allOf\": [\n {\n + \ \"$comment\": \"Require fields here for item properties.\",\n + \ \"required\": [\n \"version\"\n ]\n + \ },\n {\n \"$ref\": \"#/definitions/fields\"\n + \ }\n ]\n },\n \"assets\": + {\n \"$comment\": \"This validates the fields in Item Assets, + but does not require them.\",\n \"type\": \"object\",\n \"additionalProperties\": + {\n \"$ref\": \"#/definitions/fields\"\n }\n }\n + \ }\n }\n ]\n },\n {\n \"$comment\": \"This + is the schema for STAC Collections.\",\n \"type\": \"object\",\n \"allOf\": + [\n {\n \"required\": [\n \"type\"\n ],\n + \ \"properties\": {\n \"type\": {\n \"const\": + \"Collection\"\n }\n }\n },\n {\n \"$ref\": + \"#/definitions/stac_extensions\"\n }\n ],\n \"anyOf\": [\n + \ {\n \"$comment\": \"This is the schema for the top-level + fields in a Collection. Remove this if this extension does not define top-level + fields for Collections.\",\n \"allOf\": [\n {\n \"$comment\": + \"Require fields here for Collections (top-level).\",\n \"required\": + [\n \"version\"\n ]\n },\n {\n + \ \"$ref\": \"#/definitions/fields\"\n }\n ]\n + \ },\n {\n \"$comment\": \"This validates the fields + in Collection Assets, but does not require them.\",\n \"required\": + [\n \"assets\"\n ],\n \"properties\": {\n \"assets\": + {\n \"type\": \"object\",\n \"not\": {\n \"additionalProperties\": + {\n \"not\": {\n \"allOf\": [\n {\n + \ \"$ref\": \"#/definitions/require_any_field\"\n },\n + \ {\n \"$ref\": \"#/definitions/fields\"\n + \ }\n ]\n }\n }\n + \ }\n }\n }\n },\n {\n \"$comment\": + \"This is the schema for the fields in Item Asset Definitions. It doesn't + require any fields.\",\n \"required\": [\n \"item_assets\"\n + \ ],\n \"properties\": {\n \"item_assets\": {\n + \ \"type\": \"object\",\n \"not\": {\n \"additionalProperties\": + {\n \"not\": {\n \"allOf\": [\n {\n + \ \"$ref\": \"#/definitions/require_any_field\"\n },\n + \ {\n \"$ref\": \"#/definitions/fields\"\n + \ }\n ]\n }\n }\n + \ }\n }\n }\n },\n {\n \"$comment\": + \"This is the schema for the fields in Summaries. By default, only checks + the existance of the properties, but not the schema of the summaries.\",\n + \ \"required\": [\n \"summaries\"\n ],\n \"properties\": + {\n \"summaries\": {\n \"$ref\": \"#/definitions/require_any_field\"\n + \ }\n }\n }\n ]\n }\n ],\n \"definitions\": + {\n \"stac_extensions\": {\n \"type\": \"object\",\n \"required\": + [\n \"stac_extensions\"\n ],\n \"properties\": {\n \"stac_extensions\": + {\n \"type\": \"array\",\n \"contains\": {\n \"const\": + \"https://stac-extensions.github.io/version/v1.0.0/schema.json\"\n }\n + \ }\n }\n },\n \"require_any_field\": {\n \"$comment\": + \"Please list all fields here so that we can force the existance of one of + them in other parts of the schemas.\",\n \"anyOf\": [\n {\"required\": + [\"version\"]},\n {\"required\": [\"deprecated\"]}\n ]\n },\n + \ \"fields\": {\n \"type\": \"object\",\n \"properties\": {\n + \ \"version\": {\n \"type\": \"string\",\n \"title\": + \"Version\"\n },\n \"deprecated\": {\n \"type\": \"boolean\",\n + \ \"title\": \"Deprecated\",\n \"default\": false\n }\n + \ }\n }\n }\n}\n" + headers: + Accept-Ranges: + - bytes + Access-Control-Allow-Origin: + - '*' + Age: + - '160' + Cache-Control: + - max-age=600 + Connection: + - close + Content-Length: + - '5009' + Content-Type: + - application/json; charset=utf-8 + Date: + - Fri, 13 Oct 2023 17:06:37 GMT + ETag: + - '"645249bd-1391"' + Last-Modified: + - Wed, 03 May 2023 11:47:09 GMT + Server: + - GitHub.com + Strict-Transport-Security: + - max-age=31556952 + Vary: + - Accept-Encoding + Via: + - 1.1 varnish + X-Cache: + - HIT + X-Cache-Hits: + - '1' + X-Fastly-Request-ID: + - df08dd4d458893a27b978d943506bd6fd7dce32d + X-GitHub-Request-Id: + - 3198:088E:8D4F65:BD7359:6529787C + X-Served-By: + - cache-iad-kjyo7100082-IAD + X-Timer: + - S1697216797.254462,VS0,VE2 + expires: + - Fri, 13 Oct 2023 17:13:57 GMT + permissions-policy: + - interest-cohort=() + x-proxy-cache: + - MISS + status: + code: 200 + message: OK +version: 1 diff --git a/tests/extensions/cassettes/test_version/test_predecessor.yaml b/tests/extensions/cassettes/test_version/test_predecessor.yaml new file mode 100644 index 000000000..aaa261177 --- /dev/null +++ b/tests/extensions/cassettes/test_version/test_predecessor.yaml @@ -0,0 +1,131 @@ +interactions: +- request: + body: null + headers: + Connection: + - close + Host: + - stac-extensions.github.io + User-Agent: + - Python-urllib/3.11 + method: GET + uri: https://stac-extensions.github.io/version/v1.0.0/schema.json + response: + body: + string: "{\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"$id\": + \"https://stac-extensions.github.io/version/v1.0.0/schema.json#\",\n \"title\": + \"Versioning Indicators Extension\",\n \"description\": \"STAC Versioning + Indicators Extension for STAC Items and STAC Collections.\",\n \"oneOf\": + [\n {\n \"$comment\": \"This is the schema for STAC Items. Remove + this object if this extension only applies to Collections.\",\n \"allOf\": + [\n {\n \"$ref\": \"#/definitions/stac_extensions\"\n },\n + \ {\n \"type\": \"object\",\n \"required\": [\n \"type\",\n + \ \"properties\",\n \"assets\"\n ],\n \"properties\": + {\n \"type\": {\n \"const\": \"Feature\"\n },\n + \ \"properties\": {\n \"allOf\": [\n {\n + \ \"$comment\": \"Require fields here for item properties.\",\n + \ \"required\": [\n \"version\"\n ]\n + \ },\n {\n \"$ref\": \"#/definitions/fields\"\n + \ }\n ]\n },\n \"assets\": + {\n \"$comment\": \"This validates the fields in Item Assets, + but does not require them.\",\n \"type\": \"object\",\n \"additionalProperties\": + {\n \"$ref\": \"#/definitions/fields\"\n }\n }\n + \ }\n }\n ]\n },\n {\n \"$comment\": \"This + is the schema for STAC Collections.\",\n \"type\": \"object\",\n \"allOf\": + [\n {\n \"required\": [\n \"type\"\n ],\n + \ \"properties\": {\n \"type\": {\n \"const\": + \"Collection\"\n }\n }\n },\n {\n \"$ref\": + \"#/definitions/stac_extensions\"\n }\n ],\n \"anyOf\": [\n + \ {\n \"$comment\": \"This is the schema for the top-level + fields in a Collection. Remove this if this extension does not define top-level + fields for Collections.\",\n \"allOf\": [\n {\n \"$comment\": + \"Require fields here for Collections (top-level).\",\n \"required\": + [\n \"version\"\n ]\n },\n {\n + \ \"$ref\": \"#/definitions/fields\"\n }\n ]\n + \ },\n {\n \"$comment\": \"This validates the fields + in Collection Assets, but does not require them.\",\n \"required\": + [\n \"assets\"\n ],\n \"properties\": {\n \"assets\": + {\n \"type\": \"object\",\n \"not\": {\n \"additionalProperties\": + {\n \"not\": {\n \"allOf\": [\n {\n + \ \"$ref\": \"#/definitions/require_any_field\"\n },\n + \ {\n \"$ref\": \"#/definitions/fields\"\n + \ }\n ]\n }\n }\n + \ }\n }\n }\n },\n {\n \"$comment\": + \"This is the schema for the fields in Item Asset Definitions. It doesn't + require any fields.\",\n \"required\": [\n \"item_assets\"\n + \ ],\n \"properties\": {\n \"item_assets\": {\n + \ \"type\": \"object\",\n \"not\": {\n \"additionalProperties\": + {\n \"not\": {\n \"allOf\": [\n {\n + \ \"$ref\": \"#/definitions/require_any_field\"\n },\n + \ {\n \"$ref\": \"#/definitions/fields\"\n + \ }\n ]\n }\n }\n + \ }\n }\n }\n },\n {\n \"$comment\": + \"This is the schema for the fields in Summaries. By default, only checks + the existance of the properties, but not the schema of the summaries.\",\n + \ \"required\": [\n \"summaries\"\n ],\n \"properties\": + {\n \"summaries\": {\n \"$ref\": \"#/definitions/require_any_field\"\n + \ }\n }\n }\n ]\n }\n ],\n \"definitions\": + {\n \"stac_extensions\": {\n \"type\": \"object\",\n \"required\": + [\n \"stac_extensions\"\n ],\n \"properties\": {\n \"stac_extensions\": + {\n \"type\": \"array\",\n \"contains\": {\n \"const\": + \"https://stac-extensions.github.io/version/v1.0.0/schema.json\"\n }\n + \ }\n }\n },\n \"require_any_field\": {\n \"$comment\": + \"Please list all fields here so that we can force the existance of one of + them in other parts of the schemas.\",\n \"anyOf\": [\n {\"required\": + [\"version\"]},\n {\"required\": [\"deprecated\"]}\n ]\n },\n + \ \"fields\": {\n \"type\": \"object\",\n \"properties\": {\n + \ \"version\": {\n \"type\": \"string\",\n \"title\": + \"Version\"\n },\n \"deprecated\": {\n \"type\": \"boolean\",\n + \ \"title\": \"Deprecated\",\n \"default\": false\n }\n + \ }\n }\n }\n}\n" + headers: + Accept-Ranges: + - bytes + Access-Control-Allow-Origin: + - '*' + Age: + - '160' + Cache-Control: + - max-age=600 + Connection: + - close + Content-Length: + - '5009' + Content-Type: + - application/json; charset=utf-8 + Date: + - Fri, 13 Oct 2023 17:06:37 GMT + ETag: + - '"645249bd-1391"' + Last-Modified: + - Wed, 03 May 2023 11:47:09 GMT + Server: + - GitHub.com + Strict-Transport-Security: + - max-age=31556952 + Vary: + - Accept-Encoding + Via: + - 1.1 varnish + X-Cache: + - HIT + X-Cache-Hits: + - '1' + X-Fastly-Request-ID: + - 608722d3ecf86bfaa3820e6ba535bfb652620eaa + X-GitHub-Request-Id: + - 3198:088E:8D4F65:BD7359:6529787C + X-Served-By: + - cache-iad-kjyo7100170-IAD + X-Timer: + - S1697216797.404685,VS0,VE2 + expires: + - Fri, 13 Oct 2023 17:13:57 GMT + permissions-policy: + - interest-cohort=() + x-proxy-cache: + - MISS + status: + code: 200 + message: OK +version: 1 diff --git a/tests/extensions/cassettes/test_version/test_successor.yaml b/tests/extensions/cassettes/test_version/test_successor.yaml new file mode 100644 index 000000000..faa1b2702 --- /dev/null +++ b/tests/extensions/cassettes/test_version/test_successor.yaml @@ -0,0 +1,131 @@ +interactions: +- request: + body: null + headers: + Connection: + - close + Host: + - stac-extensions.github.io + User-Agent: + - Python-urllib/3.11 + method: GET + uri: https://stac-extensions.github.io/version/v1.0.0/schema.json + response: + body: + string: "{\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"$id\": + \"https://stac-extensions.github.io/version/v1.0.0/schema.json#\",\n \"title\": + \"Versioning Indicators Extension\",\n \"description\": \"STAC Versioning + Indicators Extension for STAC Items and STAC Collections.\",\n \"oneOf\": + [\n {\n \"$comment\": \"This is the schema for STAC Items. Remove + this object if this extension only applies to Collections.\",\n \"allOf\": + [\n {\n \"$ref\": \"#/definitions/stac_extensions\"\n },\n + \ {\n \"type\": \"object\",\n \"required\": [\n \"type\",\n + \ \"properties\",\n \"assets\"\n ],\n \"properties\": + {\n \"type\": {\n \"const\": \"Feature\"\n },\n + \ \"properties\": {\n \"allOf\": [\n {\n + \ \"$comment\": \"Require fields here for item properties.\",\n + \ \"required\": [\n \"version\"\n ]\n + \ },\n {\n \"$ref\": \"#/definitions/fields\"\n + \ }\n ]\n },\n \"assets\": + {\n \"$comment\": \"This validates the fields in Item Assets, + but does not require them.\",\n \"type\": \"object\",\n \"additionalProperties\": + {\n \"$ref\": \"#/definitions/fields\"\n }\n }\n + \ }\n }\n ]\n },\n {\n \"$comment\": \"This + is the schema for STAC Collections.\",\n \"type\": \"object\",\n \"allOf\": + [\n {\n \"required\": [\n \"type\"\n ],\n + \ \"properties\": {\n \"type\": {\n \"const\": + \"Collection\"\n }\n }\n },\n {\n \"$ref\": + \"#/definitions/stac_extensions\"\n }\n ],\n \"anyOf\": [\n + \ {\n \"$comment\": \"This is the schema for the top-level + fields in a Collection. Remove this if this extension does not define top-level + fields for Collections.\",\n \"allOf\": [\n {\n \"$comment\": + \"Require fields here for Collections (top-level).\",\n \"required\": + [\n \"version\"\n ]\n },\n {\n + \ \"$ref\": \"#/definitions/fields\"\n }\n ]\n + \ },\n {\n \"$comment\": \"This validates the fields + in Collection Assets, but does not require them.\",\n \"required\": + [\n \"assets\"\n ],\n \"properties\": {\n \"assets\": + {\n \"type\": \"object\",\n \"not\": {\n \"additionalProperties\": + {\n \"not\": {\n \"allOf\": [\n {\n + \ \"$ref\": \"#/definitions/require_any_field\"\n },\n + \ {\n \"$ref\": \"#/definitions/fields\"\n + \ }\n ]\n }\n }\n + \ }\n }\n }\n },\n {\n \"$comment\": + \"This is the schema for the fields in Item Asset Definitions. It doesn't + require any fields.\",\n \"required\": [\n \"item_assets\"\n + \ ],\n \"properties\": {\n \"item_assets\": {\n + \ \"type\": \"object\",\n \"not\": {\n \"additionalProperties\": + {\n \"not\": {\n \"allOf\": [\n {\n + \ \"$ref\": \"#/definitions/require_any_field\"\n },\n + \ {\n \"$ref\": \"#/definitions/fields\"\n + \ }\n ]\n }\n }\n + \ }\n }\n }\n },\n {\n \"$comment\": + \"This is the schema for the fields in Summaries. By default, only checks + the existance of the properties, but not the schema of the summaries.\",\n + \ \"required\": [\n \"summaries\"\n ],\n \"properties\": + {\n \"summaries\": {\n \"$ref\": \"#/definitions/require_any_field\"\n + \ }\n }\n }\n ]\n }\n ],\n \"definitions\": + {\n \"stac_extensions\": {\n \"type\": \"object\",\n \"required\": + [\n \"stac_extensions\"\n ],\n \"properties\": {\n \"stac_extensions\": + {\n \"type\": \"array\",\n \"contains\": {\n \"const\": + \"https://stac-extensions.github.io/version/v1.0.0/schema.json\"\n }\n + \ }\n }\n },\n \"require_any_field\": {\n \"$comment\": + \"Please list all fields here so that we can force the existance of one of + them in other parts of the schemas.\",\n \"anyOf\": [\n {\"required\": + [\"version\"]},\n {\"required\": [\"deprecated\"]}\n ]\n },\n + \ \"fields\": {\n \"type\": \"object\",\n \"properties\": {\n + \ \"version\": {\n \"type\": \"string\",\n \"title\": + \"Version\"\n },\n \"deprecated\": {\n \"type\": \"boolean\",\n + \ \"title\": \"Deprecated\",\n \"default\": false\n }\n + \ }\n }\n }\n}\n" + headers: + Accept-Ranges: + - bytes + Access-Control-Allow-Origin: + - '*' + Age: + - '160' + Cache-Control: + - max-age=600 + Connection: + - close + Content-Length: + - '5009' + Content-Type: + - application/json; charset=utf-8 + Date: + - Fri, 13 Oct 2023 17:06:37 GMT + ETag: + - '"645249bd-1391"' + Last-Modified: + - Wed, 03 May 2023 11:47:09 GMT + Server: + - GitHub.com + Strict-Transport-Security: + - max-age=31556952 + Vary: + - Accept-Encoding + Via: + - 1.1 varnish + X-Cache: + - HIT + X-Cache-Hits: + - '1' + X-Fastly-Request-ID: + - f63947d22c0587e05c2a4a87bd28ce67901a2408 + X-GitHub-Request-Id: + - 3198:088E:8D4F65:BD7359:6529787C + X-Served-By: + - cache-iad-kjyo7100056-IAD + X-Timer: + - S1697216798.562011,VS0,VE2 + expires: + - Fri, 13 Oct 2023 17:13:57 GMT + permissions-policy: + - interest-cohort=() + x-proxy-cache: + - MISS + status: + code: 200 + message: OK +version: 1 diff --git a/tests/extensions/cassettes/test_version/test_version_in_properties.yaml b/tests/extensions/cassettes/test_version/test_version_in_properties.yaml new file mode 100644 index 000000000..d88ace0b8 --- /dev/null +++ b/tests/extensions/cassettes/test_version/test_version_in_properties.yaml @@ -0,0 +1,131 @@ +interactions: +- request: + body: null + headers: + Connection: + - close + Host: + - stac-extensions.github.io + User-Agent: + - Python-urllib/3.11 + method: GET + uri: https://stac-extensions.github.io/version/v1.0.0/schema.json + response: + body: + string: "{\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"$id\": + \"https://stac-extensions.github.io/version/v1.0.0/schema.json#\",\n \"title\": + \"Versioning Indicators Extension\",\n \"description\": \"STAC Versioning + Indicators Extension for STAC Items and STAC Collections.\",\n \"oneOf\": + [\n {\n \"$comment\": \"This is the schema for STAC Items. Remove + this object if this extension only applies to Collections.\",\n \"allOf\": + [\n {\n \"$ref\": \"#/definitions/stac_extensions\"\n },\n + \ {\n \"type\": \"object\",\n \"required\": [\n \"type\",\n + \ \"properties\",\n \"assets\"\n ],\n \"properties\": + {\n \"type\": {\n \"const\": \"Feature\"\n },\n + \ \"properties\": {\n \"allOf\": [\n {\n + \ \"$comment\": \"Require fields here for item properties.\",\n + \ \"required\": [\n \"version\"\n ]\n + \ },\n {\n \"$ref\": \"#/definitions/fields\"\n + \ }\n ]\n },\n \"assets\": + {\n \"$comment\": \"This validates the fields in Item Assets, + but does not require them.\",\n \"type\": \"object\",\n \"additionalProperties\": + {\n \"$ref\": \"#/definitions/fields\"\n }\n }\n + \ }\n }\n ]\n },\n {\n \"$comment\": \"This + is the schema for STAC Collections.\",\n \"type\": \"object\",\n \"allOf\": + [\n {\n \"required\": [\n \"type\"\n ],\n + \ \"properties\": {\n \"type\": {\n \"const\": + \"Collection\"\n }\n }\n },\n {\n \"$ref\": + \"#/definitions/stac_extensions\"\n }\n ],\n \"anyOf\": [\n + \ {\n \"$comment\": \"This is the schema for the top-level + fields in a Collection. Remove this if this extension does not define top-level + fields for Collections.\",\n \"allOf\": [\n {\n \"$comment\": + \"Require fields here for Collections (top-level).\",\n \"required\": + [\n \"version\"\n ]\n },\n {\n + \ \"$ref\": \"#/definitions/fields\"\n }\n ]\n + \ },\n {\n \"$comment\": \"This validates the fields + in Collection Assets, but does not require them.\",\n \"required\": + [\n \"assets\"\n ],\n \"properties\": {\n \"assets\": + {\n \"type\": \"object\",\n \"not\": {\n \"additionalProperties\": + {\n \"not\": {\n \"allOf\": [\n {\n + \ \"$ref\": \"#/definitions/require_any_field\"\n },\n + \ {\n \"$ref\": \"#/definitions/fields\"\n + \ }\n ]\n }\n }\n + \ }\n }\n }\n },\n {\n \"$comment\": + \"This is the schema for the fields in Item Asset Definitions. It doesn't + require any fields.\",\n \"required\": [\n \"item_assets\"\n + \ ],\n \"properties\": {\n \"item_assets\": {\n + \ \"type\": \"object\",\n \"not\": {\n \"additionalProperties\": + {\n \"not\": {\n \"allOf\": [\n {\n + \ \"$ref\": \"#/definitions/require_any_field\"\n },\n + \ {\n \"$ref\": \"#/definitions/fields\"\n + \ }\n ]\n }\n }\n + \ }\n }\n }\n },\n {\n \"$comment\": + \"This is the schema for the fields in Summaries. By default, only checks + the existance of the properties, but not the schema of the summaries.\",\n + \ \"required\": [\n \"summaries\"\n ],\n \"properties\": + {\n \"summaries\": {\n \"$ref\": \"#/definitions/require_any_field\"\n + \ }\n }\n }\n ]\n }\n ],\n \"definitions\": + {\n \"stac_extensions\": {\n \"type\": \"object\",\n \"required\": + [\n \"stac_extensions\"\n ],\n \"properties\": {\n \"stac_extensions\": + {\n \"type\": \"array\",\n \"contains\": {\n \"const\": + \"https://stac-extensions.github.io/version/v1.0.0/schema.json\"\n }\n + \ }\n }\n },\n \"require_any_field\": {\n \"$comment\": + \"Please list all fields here so that we can force the existance of one of + them in other parts of the schemas.\",\n \"anyOf\": [\n {\"required\": + [\"version\"]},\n {\"required\": [\"deprecated\"]}\n ]\n },\n + \ \"fields\": {\n \"type\": \"object\",\n \"properties\": {\n + \ \"version\": {\n \"type\": \"string\",\n \"title\": + \"Version\"\n },\n \"deprecated\": {\n \"type\": \"boolean\",\n + \ \"title\": \"Deprecated\",\n \"default\": false\n }\n + \ }\n }\n }\n}\n" + headers: + Accept-Ranges: + - bytes + Access-Control-Allow-Origin: + - '*' + Age: + - '160' + Cache-Control: + - max-age=600 + Connection: + - close + Content-Length: + - '5009' + Content-Type: + - application/json; charset=utf-8 + Date: + - Fri, 13 Oct 2023 17:06:36 GMT + ETag: + - '"645249bd-1391"' + Last-Modified: + - Wed, 03 May 2023 11:47:09 GMT + Server: + - GitHub.com + Strict-Transport-Security: + - max-age=31556952 + Vary: + - Accept-Encoding + Via: + - 1.1 varnish + X-Cache: + - HIT + X-Cache-Hits: + - '1' + X-Fastly-Request-ID: + - d49a2c0d051469920a12bacab15e37ba784c3035 + X-GitHub-Request-Id: + - 3198:088E:8D4F65:BD7359:6529787C + X-Served-By: + - cache-iad-kjyo7100108-IAD + X-Timer: + - S1697216797.810891,VS0,VE4 + expires: + - Fri, 13 Oct 2023 17:13:57 GMT + permissions-policy: + - interest-cohort=() + x-proxy-cache: + - MISS + status: + code: 200 + message: OK +version: 1 diff --git a/tests/extensions/test_version.py b/tests/extensions/test_version.py index 66fe7e75b..013998711 100644 --- a/tests/extensions/test_version.py +++ b/tests/extensions/test_version.py @@ -1,6 +1,5 @@ """Tests for pystac.extensions.version.""" -import unittest from collections.abc import Generator from datetime import datetime from typing import Optional @@ -8,6 +7,7 @@ import pytest from pystac import ( + Catalog, Collection, ExtensionNotImplemented, Extent, @@ -17,10 +17,9 @@ TemporalExtent, ) from pystac.errors import DeprecatedWarning, ExtensionTypeError -from pystac.extensions import version from pystac.extensions.version import ( - CollectionVersionExtension, - ItemVersionExtension, + DEPRECATED, + VERSION, VersionExtension, VersionRelType, ignore_deprecated, @@ -30,6 +29,26 @@ URL_TEMPLATE: str = "http://example.com/catalog/%s.json" +@pytest.fixture +def item() -> Item: + return make_item(2011) + + +@pytest.fixture +def item_from_file() -> Item: + return Item.from_file(TestCases.get_path("data-files/version/item.json")) + + +@pytest.fixture +def collection() -> Collection: + return make_collection(2011) + + +@pytest.fixture +def version() -> str: + return "1.2.3" + + def make_item(year: int) -> Item: """Create basic test items that are only slightly different.""" asset_id = f"USGS/GAP/CONUS/{year}" @@ -43,232 +62,6 @@ def make_item(year: int) -> Item: return item -class VersionExtensionTest(unittest.TestCase): - def test_should_raise_exception_when_passing_invalid_extension_object( - self, - ) -> None: - self.assertRaisesRegex( - ExtensionTypeError, - r"^VersionExtension does not apply to type 'object'$", - VersionExtension.ext, - object(), - ) - - -class ItemVersionExtensionTest(unittest.TestCase): - version: str = "1.2.3" - - def setUp(self) -> None: - super().setUp() - self.item = make_item(2011) - self.example_item_uri = TestCases.get_path("data-files/version/item.json") - - def test_rel_types(self) -> None: - self.assertEqual(VersionRelType.LATEST.value, "latest-version") - self.assertEqual(VersionRelType.PREDECESSOR.value, "predecessor-version") - self.assertEqual(VersionRelType.SUCCESSOR.value, "successor-version") - - def test_stac_extensions(self) -> None: - self.assertTrue(VersionExtension.has_extension(self.item)) - - @pytest.mark.vcr() - def test_add_version(self) -> None: - VersionExtension.ext(self.item).apply(self.version) - self.assertEqual(self.version, VersionExtension.ext(self.item).version) - self.assertNotIn(version.DEPRECATED, self.item.properties) - self.assertFalse(VersionExtension.ext(self.item).deprecated) - self.item.validate() - - @pytest.mark.vcr() - def test_version_in_properties(self) -> None: - VersionExtension.ext(self.item).apply(self.version, deprecated=True) - self.assertIn(version.VERSION, self.item.properties) - self.assertIn(version.DEPRECATED, self.item.properties) - self.item.validate() - - @pytest.mark.vcr() - def test_add_not_deprecated_version(self) -> None: - VersionExtension.ext(self.item).apply(self.version, deprecated=False) - self.assertIn(version.DEPRECATED, self.item.properties) - self.assertFalse(VersionExtension.ext(self.item).deprecated) - self.item.validate() - - @pytest.mark.vcr() - def test_add_deprecated_version(self) -> None: - VersionExtension.ext(self.item).apply(self.version, deprecated=True) - self.assertIn(version.DEPRECATED, self.item.properties) - self.assertTrue(VersionExtension.ext(self.item).deprecated) - self.item.validate() - - @pytest.mark.vcr() - def test_latest(self) -> None: - year = 2013 - latest = make_item(year) - VersionExtension.ext(self.item).apply(self.version, latest=latest) - latest_result = VersionExtension.ext(self.item).latest - self.assertIs(latest, latest_result) - - expected_href = URL_TEMPLATE % year - link = self.item.get_links(VersionRelType.LATEST)[0] - self.assertEqual(expected_href, link.get_href()) - self.item.validate() - - @pytest.mark.vcr() - def test_predecessor(self) -> None: - year = 2010 - predecessor = make_item(year) - VersionExtension.ext(self.item).apply(self.version, predecessor=predecessor) - predecessor_result = VersionExtension.ext(self.item).predecessor - self.assertIs(predecessor, predecessor_result) - - expected_href = URL_TEMPLATE % year - link = self.item.get_links(VersionRelType.PREDECESSOR)[0] - self.assertEqual(expected_href, link.get_href()) - self.item.validate() - - @pytest.mark.vcr() - def test_successor(self) -> None: - year = 2012 - successor = make_item(year) - VersionExtension.ext(self.item).apply(self.version, successor=successor) - successor_result = VersionExtension.ext(self.item).successor - self.assertIs(successor, successor_result) - - expected_href = URL_TEMPLATE % year - link = self.item.get_links(VersionRelType.SUCCESSOR)[0] - self.assertEqual(expected_href, link.get_href()) - self.item.validate() - - @pytest.mark.vcr() - def test_fail_validate(self) -> None: - with self.assertRaises(STACValidationError): - self.item.validate() - - @pytest.mark.vcr() - def test_all_links(self) -> None: - deprecated = True - latest = make_item(2013) - predecessor = make_item(2010) - successor = make_item(2012) - VersionExtension.ext(self.item).apply( - self.version, deprecated, latest, predecessor, successor - ) - self.item.validate() - - def test_full_copy(self) -> None: - cat = TestCases.case_1() - - # Fetch two items from the catalog - item1 = next(cat.get_items("area-1-1-imagery", recursive=True)) - item2 = next(cat.get_items("area-2-2-imagery", recursive=True)) - - # Enable the version extension on each, and link them - # as if they are different versions of the same Item - VersionExtension.add_to(item1) - VersionExtension.add_to(item2) - - VersionExtension.ext(item1).apply(version="2.0", predecessor=item2) - VersionExtension.ext(item2).apply(version="1.0", successor=item1, latest=item1) - - # Make a full copy of the catalog - cat_copy = cat.full_copy() - - # Retrieve the copied version of the items - item1_copy = next(cat_copy.get_items("area-1-1-imagery", recursive=True)) - item2_copy = next(cat_copy.get_items("area-2-2-imagery", recursive=True)) - - # Check to see if the version links point to the instances of the - # item objects as they should. - - predecessor = item1_copy.get_single_link(VersionRelType.PREDECESSOR) - assert predecessor is not None - predecessor_target = predecessor.target - successor = item2_copy.get_single_link(VersionRelType.SUCCESSOR) - assert successor is not None - successor_target = successor.target - latest = item2_copy.get_single_link(VersionRelType.LATEST) - assert latest is not None - latest_target = latest.target - - self.assertIs(predecessor_target, item2_copy) - self.assertIs(successor_target, item1_copy) - self.assertIs(latest_target, item1_copy) - - def test_setting_none_clears_link(self) -> None: - deprecated = False - latest = make_item(2013) - predecessor = make_item(2010) - successor = make_item(2012) - VersionExtension.ext(self.item).apply( - self.version, deprecated, latest, predecessor, successor - ) - - VersionExtension.ext(self.item).latest = None - links = self.item.get_links(VersionRelType.LATEST) - self.assertEqual(0, len(links)) - self.assertIsNone(VersionExtension.ext(self.item).latest) - - VersionExtension.ext(self.item).predecessor = None - links = self.item.get_links(VersionRelType.PREDECESSOR) - self.assertEqual(0, len(links)) - self.assertIsNone(VersionExtension.ext(self.item).predecessor) - - VersionExtension.ext(self.item).successor = None - links = self.item.get_links(VersionRelType.SUCCESSOR) - self.assertEqual(0, len(links)) - self.assertIsNone(VersionExtension.ext(self.item).successor) - - def test_multiple_link_setting(self) -> None: - deprecated = False - latest1 = make_item(2013) - predecessor1 = make_item(2010) - successor1 = make_item(2012) - VersionExtension.ext(self.item).apply( - self.version, deprecated, latest1, predecessor1, successor1 - ) - - year = 2015 - latest2 = make_item(year) - expected_href = URL_TEMPLATE % year - VersionExtension.ext(self.item).latest = latest2 - links = self.item.get_links(VersionRelType.LATEST) - self.assertEqual(1, len(links)) - self.assertEqual(expected_href, links[0].get_href()) - - year = 2009 - predecessor2 = make_item(year) - expected_href = URL_TEMPLATE % year - VersionExtension.ext(self.item).predecessor = predecessor2 - links = self.item.get_links(VersionRelType.PREDECESSOR) - self.assertEqual(1, len(links)) - self.assertEqual(expected_href, links[0].get_href()) - - year = 2014 - successor2 = make_item(year) - expected_href = URL_TEMPLATE % year - VersionExtension.ext(self.item).successor = successor2 - links = self.item.get_links(VersionRelType.SUCCESSOR) - self.assertEqual(1, len(links)) - self.assertEqual(expected_href, links[0].get_href()) - - def test_extension_not_implemented(self) -> None: - # Should raise exception if Item does not include extension URI - item = Item.from_file(self.example_item_uri) - item.stac_extensions.remove(VersionExtension.get_schema_uri()) - - with self.assertRaises(ExtensionNotImplemented): - _ = VersionExtension.ext(item) - - def test_ext_add_to(self) -> None: - item = Item.from_file(self.example_item_uri) - item.stac_extensions.remove(VersionExtension.get_schema_uri()) - self.assertNotIn(VersionExtension.get_schema_uri(), item.stac_extensions) - - _ = VersionExtension.ext(item, add_if_missing=True) - - self.assertIn(VersionExtension.get_schema_uri(), item.stac_extensions) - - def make_collection(year: int) -> Collection: asset_id = f"my/collection/of/things/{year}" start = datetime(2014, 8, 10) @@ -287,244 +80,266 @@ def make_collection(year: int) -> Collection: return collection -class CollectionVersionExtensionTest(unittest.TestCase): - version: str = "1.2.3" - - def setUp(self) -> None: - super().setUp() - self.collection = make_collection(2011) - self.example_collection_uri = TestCases.get_path( - "data-files/version/collection.json" - ) - - def test_stac_extensions(self) -> None: - self.assertTrue(VersionExtension.has_extension(self.collection)) - - @pytest.mark.vcr() - def test_add_version(self) -> None: - VersionExtension.ext(self.collection).apply(self.version) - self.assertEqual(self.version, VersionExtension.ext(self.collection).version) - self.assertNotIn(version.DEPRECATED, self.collection.extra_fields) - self.assertFalse(VersionExtension.ext(self.collection).deprecated) - self.collection.validate() - - @pytest.mark.vcr() - def test_version_deprecated(self) -> None: - VersionExtension.ext(self.collection).apply(self.version, deprecated=True) - self.assertIn(version.VERSION, self.collection.extra_fields) - self.assertIn(version.DEPRECATED, self.collection.extra_fields) - self.collection.validate() - - @pytest.mark.vcr() - def test_add_not_deprecated_version(self) -> None: - VersionExtension.ext(self.collection).apply(self.version, deprecated=False) - self.assertIn(version.DEPRECATED, self.collection.extra_fields) - self.assertFalse(VersionExtension.ext(self.collection).deprecated) - self.collection.validate() - - @pytest.mark.vcr() - def test_add_deprecated_version(self) -> None: - VersionExtension.ext(self.collection).apply(self.version, deprecated=True) - self.assertIn(version.DEPRECATED, self.collection.extra_fields) - self.assertTrue(VersionExtension.ext(self.collection).deprecated) - self.collection.validate() - - @pytest.mark.vcr() - def test_latest(self) -> None: - year = 2013 - latest = make_collection(year) - VersionExtension.ext(self.collection).apply(self.version, latest=latest) - latest_result = VersionExtension.ext(self.collection).latest - self.assertIs(latest, latest_result) - - expected_href = URL_TEMPLATE % year - link = self.collection.get_links(VersionRelType.LATEST)[0] - self.assertEqual(expected_href, link.get_href()) - self.collection.validate() - - @pytest.mark.vcr() - def test_predecessor(self) -> None: - year = 2010 - predecessor = make_collection(year) - VersionExtension.ext(self.collection).apply( - self.version, predecessor=predecessor - ) - predecessor_result = VersionExtension.ext(self.collection).predecessor - self.assertIs(predecessor, predecessor_result) - - expected_href = URL_TEMPLATE % year - link = self.collection.get_links(VersionRelType.PREDECESSOR)[0] - self.assertEqual(expected_href, link.get_href()) - self.collection.validate() - - @pytest.mark.vcr() - def test_successor(self) -> None: - year = 2012 - successor = make_collection(year) - VersionExtension.ext(self.collection).apply(self.version, successor=successor) - successor_result = VersionExtension.ext(self.collection).successor - self.assertIs(successor, successor_result) - - expected_href = URL_TEMPLATE % year - link = self.collection.get_links(VersionRelType.SUCCESSOR)[0] - self.assertEqual(expected_href, link.get_href()) - self.collection.validate() - - @pytest.mark.vcr() - def test_fail_validate(self) -> None: - with self.assertRaises(STACValidationError): - self.collection.validate() - - @pytest.mark.vcr() - def test_validate_all(self) -> None: - deprecated = True - latest = make_collection(2013) - predecessor = make_collection(2010) - successor = make_collection(2012) - VersionExtension.ext(self.collection).apply( - self.version, deprecated, latest, predecessor, successor - ) - self.collection.validate() - - def test_full_copy(self) -> None: - cat = TestCases.case_1() - - # Fetch two collections from the catalog - col1 = cat.get_child("area-1-1", recursive=True) - assert isinstance(col1, Collection) - col2 = cat.get_child("area-2-2", recursive=True) - assert isinstance(col2, Collection) - - # Enable the version extension on each, and link them - # as if they are different versions of the same Collection - VersionExtension.add_to(col1) - VersionExtension.add_to(col2) - - VersionExtension.ext(col1).apply(version="2.0", predecessor=col2) - VersionExtension.ext(col2).apply(version="1.0", successor=col1, latest=col1) - - # Make a full copy of the catalog - cat_copy = cat.full_copy() - - # Retrieve the copied version of the items - col1_copy = cat_copy.get_child("area-1-1", recursive=True) - assert col1_copy is not None - col2_copy = cat_copy.get_child("area-2-2", recursive=True) - assert col2_copy is not None - - # Check to see if the version links point to the instances of the - # col objects as they should. - predecessor = col1_copy.get_single_link(VersionRelType.PREDECESSOR) - assert predecessor is not None - predecessor_target = predecessor.target - successor = col2_copy.get_single_link(VersionRelType.SUCCESSOR) - assert successor is not None - successor_target = successor.target - latest = col2_copy.get_single_link(VersionRelType.LATEST) - assert latest is not None - latest_target = latest.target - - self.assertIs(predecessor_target, col2_copy) - self.assertIs(successor_target, col1_copy) - self.assertIs(latest_target, col1_copy) - - def test_setting_none_clears_link(self) -> None: - deprecated = False - latest = make_collection(2013) - predecessor = make_collection(2010) - successor = make_collection(2012) - VersionExtension.ext(self.collection).apply( - self.version, deprecated, latest, predecessor, successor - ) - - VersionExtension.ext(self.collection).latest = None - links = self.collection.get_links(VersionRelType.LATEST) - self.assertEqual(0, len(links)) - self.assertIsNone(VersionExtension.ext(self.collection).latest) - - VersionExtension.ext(self.collection).predecessor = None - links = self.collection.get_links(VersionRelType.PREDECESSOR) - self.assertEqual(0, len(links)) - self.assertIsNone(VersionExtension.ext(self.collection).predecessor) - - VersionExtension.ext(self.collection).successor = None - links = self.collection.get_links(VersionRelType.SUCCESSOR) - self.assertEqual(0, len(links)) - self.assertIsNone(VersionExtension.ext(self.collection).successor) - - def test_multiple_link_setting(self) -> None: - deprecated = False - latest1 = make_collection(2013) - predecessor1 = make_collection(2010) - successor1 = make_collection(2012) - VersionExtension.ext(self.collection).apply( - self.version, deprecated, latest1, predecessor1, successor1 - ) - - year = 2015 - latest2 = make_collection(year) - expected_href = URL_TEMPLATE % year - VersionExtension.ext(self.collection).latest = latest2 - links = self.collection.get_links(VersionRelType.LATEST) - self.assertEqual(1, len(links)) - self.assertEqual(expected_href, links[0].get_href()) - - year = 2009 - predecessor2 = make_collection(year) - expected_href = URL_TEMPLATE % year - VersionExtension.ext(self.collection).predecessor = predecessor2 - links = self.collection.get_links(VersionRelType.PREDECESSOR) - self.assertEqual(1, len(links)) - self.assertEqual(expected_href, links[0].get_href()) - - year = 2014 - successor2 = make_collection(year) - expected_href = URL_TEMPLATE % year - VersionExtension.ext(self.collection).successor = successor2 - links = self.collection.get_links(VersionRelType.SUCCESSOR) - self.assertEqual(1, len(links)) - self.assertEqual(expected_href, links[0].get_href()) - - def test_extension_not_implemented(self) -> None: - # Should raise exception if Collection does not include extension URI - with ignore_deprecated(): - collection = Collection.from_file(self.example_collection_uri) - collection.stac_extensions.remove(VersionExtension.get_schema_uri()) - - with self.assertRaises(ExtensionNotImplemented): - _ = VersionExtension.ext(collection) - - def test_ext_add_to(self) -> None: - with ignore_deprecated(): - collection = Collection.from_file(self.example_collection_uri) - collection.stac_extensions.remove(VersionExtension.get_schema_uri()) - self.assertNotIn(VersionExtension.get_schema_uri(), collection.stac_extensions) - - _ = VersionExtension.ext(collection, add_if_missing=True) - - self.assertIn(VersionExtension.get_schema_uri(), collection.stac_extensions) +def test_should_raise_exception_when_passing_invalid_extension_object() -> None: + with pytest.raises( + ExtensionTypeError, match="^VersionExtension does not apply to type 'object'$" + ): + VersionExtension.ext(object()) # type: ignore + + +def test_rel_types() -> None: + assert VersionRelType.LATEST.value == "latest-version" + assert VersionRelType.PREDECESSOR.value == "predecessor-version" + assert VersionRelType.SUCCESSOR.value == "successor-version" + + +def test_stac_extensions(item: Item) -> None: + assert item.ext.has("version") + + +@pytest.mark.vcr() +def test_add_version(item: Item, version: str) -> None: + item.ext.version.apply(version) + assert version == item.ext.version.version + assert DEPRECATED not in item.properties + assert not item.ext.version.deprecated + item.validate() + + +@pytest.mark.vcr() +def test_version_in_properties(item: Item, version: str) -> None: + item.ext.version.apply(version, deprecated=True) + assert VERSION in item.properties + assert DEPRECATED in item.properties + item.validate() + + +@pytest.mark.vcr() +def test_add_not_deprecated_version(item: Item, version: str) -> None: + item.ext.version.apply(version, deprecated=False) + assert DEPRECATED in item.properties + assert not item.ext.version.deprecated + item.validate() + + +@pytest.mark.vcr() +def test_add_deprecated_version(item: Item, version: str) -> None: + item.ext.version.apply(version, deprecated=True) + assert DEPRECATED in item.properties + assert item.ext.version.deprecated + item.validate() + + +@pytest.mark.vcr() +def test_latest(item: Item, version: str) -> None: + year = 2013 + latest = make_item(year) + item.ext.version.apply(version, latest=latest) + assert item.ext.version.latest is latest + expected_href = URL_TEMPLATE % year + link = item.get_links(VersionRelType.LATEST)[0] + assert expected_href == link.get_href() + item.validate() + + +@pytest.mark.vcr() +def test_predecessor(item: Item, version: str) -> None: + year = 2010 + predecessor = make_item(year) + item.ext.version.apply(version, predecessor=predecessor) + assert item.ext.version.predecessor is predecessor + expected_href = URL_TEMPLATE % year + link = item.get_links(VersionRelType.PREDECESSOR)[0] + assert expected_href == link.get_href() + item.validate() + + +@pytest.mark.vcr() +def test_successor(item: Item, version: str) -> None: + year = 2012 + successor = make_item(year) + item.ext.version.apply(version, successor=successor) + assert item.ext.version.successor is successor + expected_href = URL_TEMPLATE % year + link = item.get_links(VersionRelType.SUCCESSOR)[0] + assert expected_href == link.get_href() + item.validate() + + +@pytest.mark.vcr() +def test_fail_validate(item: Item) -> None: + with pytest.raises(STACValidationError): + item.validate() + + +@pytest.mark.vcr() +def test_all_links(item: Item, version: str) -> None: + deprecated = True + latest = make_item(2013) + predecessor = make_item(2010) + successor = make_item(2012) + item.ext.version.apply( + version, + deprecated=deprecated, + latest=latest, + predecessor=predecessor, + successor=successor, + ) + item.validate() + + +def test_full_copy(test_case_1_catalog: Catalog) -> None: + # Fetch two items from the catalog + item1 = next(test_case_1_catalog.get_items("area-1-1-imagery", recursive=True)) + item2 = next(test_case_1_catalog.get_items("area-2-2-imagery", recursive=True)) + + # Enable the version extension on each, and link them + # as if they are different versions of the same Item + item1.ext.add("version") + item2.ext.add("version") + + item1.ext.version.apply(version="2.0", predecessor=item2) + item2.ext.version.apply(version="1.0", successor=item1, latest=item1) + + # Make a full copy of the catalog + cat_copy = test_case_1_catalog.full_copy() + + # Retrieve the copied version of the items + item1_copy = next(cat_copy.get_items("area-1-1-imagery", recursive=True)) + item2_copy = next(cat_copy.get_items("area-2-2-imagery", recursive=True)) + + # Check to see if the version links point to the instances of the + # item objects as they should. + + predecessor = item1_copy.get_single_link(VersionRelType.PREDECESSOR) + assert predecessor is not None + predecessor_target = predecessor.target + successor = item2_copy.get_single_link(VersionRelType.SUCCESSOR) + assert successor is not None + successor_target = successor.target + latest = item2_copy.get_single_link(VersionRelType.LATEST) + assert latest is not None + latest_target = latest.target + + assert predecessor_target is item2_copy + assert successor_target is item1_copy + assert latest_target is item1_copy + + +def test_setting_none_clears_link(item: Item, version: str) -> None: + deprecated = False + latest = make_item(2013) + predecessor = make_item(2010) + successor = make_item(2012) + item.ext.version.apply(version, deprecated, latest, predecessor, successor) + + item.ext.version.latest = None + links = item.get_links(VersionRelType.LATEST) + assert 0 == len(links) + + item.ext.version.predecessor = None + links = item.get_links(VersionRelType.PREDECESSOR) + assert 0 == len(links) + + item.ext.version.successor = None + links = item.get_links(VersionRelType.SUCCESSOR) + assert 0 == len(links) + + +def test_multiple_link_setting(item: Item, version: str) -> None: + deprecated = False + latest1 = make_item(2013) + predecessor1 = make_item(2010) + successor1 = make_item(2012) + item.ext.version.apply(version, deprecated, latest1, predecessor1, successor1) + + year = 2015 + latest2 = make_item(year) + expected_href = URL_TEMPLATE % year + item.ext.version.latest = latest2 + links = item.get_links(VersionRelType.LATEST) + assert 1 == len(links) + assert expected_href == links[0].get_href() + + year = 2009 + predecessor2 = make_item(year) + expected_href = URL_TEMPLATE % year + item.ext.version.predecessor = predecessor2 + links = item.get_links(VersionRelType.PREDECESSOR) + assert 1 == len(links) + assert expected_href == links[0].get_href() + + year = 2014 + successor2 = make_item(year) + expected_href = URL_TEMPLATE % year + item.ext.version.successor = successor2 + links = item.get_links(VersionRelType.SUCCESSOR) + assert 1 == len(links) + assert expected_href == links[0].get_href() + + +def test_extension_not_implemented(item_from_file: Item) -> None: + # Should raise exception if Item does not include extension URI + item_from_file.stac_extensions.remove(VersionExtension.get_schema_uri()) + with pytest.raises(ExtensionNotImplemented): + item_from_file.ext.version + + +def test_ext_add_to(item_from_file: Item) -> None: + item_from_file.stac_extensions.remove(VersionExtension.get_schema_uri()) + item_from_file.ext.add("version") + assert VersionExtension.get_schema_uri() in item_from_file.stac_extensions + + +def test_collection_stac_extensions(collection: Collection) -> None: + assert collection.ext.has("version") + + +@pytest.mark.vcr() +def test_collection_add_version(collection: Collection, version: str) -> None: + collection.ext.version.apply(version) + assert collection.ext.version.version == version + assert DEPRECATED not in collection.extra_fields + collection.validate() + + +@pytest.mark.vcr() +def test_collection_validate_all(collection: Collection, version: str) -> None: + deprecated = True + latest = make_collection(2013) + predecessor = make_collection(2010) + successor = make_collection(2012) + collection.ext.version.apply(version, deprecated, latest, predecessor, successor) + + links = collection.get_links(VersionRelType.LATEST) + assert 1 == len(links) + links = collection.get_links(VersionRelType.PREDECESSOR) + assert 1 == len(links) + links = collection.get_links(VersionRelType.SUCCESSOR) + assert 1 == len(links) + + collection.validate() def test_item_deprecation_warning( item: Item, recwarn: Generator[pytest.WarningsRecorder, None, None] ) -> None: - version = ItemVersionExtension.ext(item, add_if_missing=True) - version.deprecated = True + item.ext.version.deprecated = True item_dict = item.to_dict() - with pytest.warns(DeprecatedWarning, match="The item 'test-item' is deprecated."): + with pytest.warns(DeprecatedWarning, match="The item '.*' is deprecated."): _ = Item.from_dict(item_dict) - version.deprecated = False + item.ext.version.deprecated = False item_dict = item.to_dict() _ = Item.from_dict(item_dict) assert len(list(recwarn)) == 0 - version.deprecated = None + item.ext.version.deprecated = None item_dict = item.to_dict() _ = Item.from_dict(item_dict) assert len(list(recwarn)) == 0 - ItemVersionExtension.remove_from(item) + item.ext.remove("version") item_dict = item.to_dict() _ = Item.from_dict(item_dict) assert len(list(recwarn)) == 0 @@ -534,26 +349,22 @@ def test_collection_deprecation_warning( collection: Collection, recwarn: Generator[pytest.WarningsRecorder, None, None], ) -> None: - version = CollectionVersionExtension.ext(collection, add_if_missing=True) - version.deprecated = True + collection.ext.version.deprecated = True collection_dict = collection.to_dict() - with pytest.warns( - DeprecatedWarning, match="The collection 'test-collection' is deprecated." - ): + with pytest.warns(DeprecatedWarning, match="The collection '.*' is deprecated."): _ = Collection.from_dict(collection_dict) - version.deprecated = False - collection.extra_fields["deprecated"] = False + collection.ext.version.deprecated = False collection_dict = collection.to_dict() _ = Collection.from_dict(collection_dict) assert len(list(recwarn)) == 0 - version.deprecated = None + collection.ext.version.deprecated = None collection_dict = collection.to_dict() _ = Collection.from_dict(collection_dict) assert len(list(recwarn)) == 0 - CollectionVersionExtension.remove_from(collection) + collection.ext.remove("version") collection_dict = collection.to_dict() _ = Collection.from_dict(collection_dict) assert len(list(recwarn)) == 0