Skip to content

Commit

Permalink
fix(tests): clear the validator before each test
Browse files Browse the repository at this point in the history
  • Loading branch information
gadomski committed Sep 27, 2023
1 parent 9c323c4 commit fd3a2bf
Show file tree
Hide file tree
Showing 288 changed files with 92,319 additions and 988 deletions.
2 changes: 1 addition & 1 deletion pystac/validation/local_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def _validate_from_local(

def _validator(self, stac_type: str, version: str) -> Draft7Validator:
schema = _read_schema(f"stac-spec/v{version}/{stac_type}.json")
return Draft7Validator(schema, registry=self.registry)
return Draft7Validator(schema, registry=self.registry())

def catalog_validator(self, version: str = VERSION) -> Draft7Validator:
return self._validator("catalog", version)
Expand Down
64 changes: 32 additions & 32 deletions tests/cassettes/test_catalog/TestCatalog.test_read_remote.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ interactions:
Cross-Origin-Resource-Policy:
- cross-origin
Date:
- Fri, 22 Sep 2023 19:13:47 GMT
- Wed, 27 Sep 2023 21:19:53 GMT
ETag:
- '"e74ebcbc46d43c5b693ecb995381fbeba03583627e6d65b21ed7678a10d94729"'
Expires:
- Fri, 22 Sep 2023 19:18:47 GMT
- Wed, 27 Sep 2023 21:24:53 GMT
Source-Age:
- '0'
Strict-Transport-Security:
Expand All @@ -51,21 +51,21 @@ interactions:
Via:
- 1.1 varnish
X-Cache:
- MISS
- HIT
X-Cache-Hits:
- '0'
- '1'
X-Content-Type-Options:
- nosniff
X-Fastly-Request-ID:
- 02289045ec4473cb0c90eb413af6020437e0a8e0
- c8250cab95667b61e3288bcb3ed456aa681f31b2
X-Frame-Options:
- deny
X-GitHub-Request-Id:
- A942:394D:1B35C5:2001FB:650DE769
- 0FCE:5675:3E60:4E0D:65149A87
X-Served-By:
- cache-den8281-DEN
- cache-lga21951-LGA
X-Timer:
- S1695410027.011637,VS0,VE150
- S1695849594.681744,VS0,VE80
X-XSS-Protection:
- 1; mode=block
status:
Expand Down Expand Up @@ -127,11 +127,11 @@ interactions:
Cross-Origin-Resource-Policy:
- cross-origin
Date:
- Fri, 22 Sep 2023 19:13:47 GMT
- Wed, 27 Sep 2023 21:19:53 GMT
ETag:
- '"ddd340bc27c120dd2e43868bcde0510a326a6223dac1b0c47c05100e20d1397e"'
Expires:
- Fri, 22 Sep 2023 19:18:47 GMT
- Wed, 27 Sep 2023 21:24:53 GMT
Source-Age:
- '0'
Strict-Transport-Security:
Expand All @@ -141,21 +141,21 @@ interactions:
Via:
- 1.1 varnish
X-Cache:
- MISS
- HIT
X-Cache-Hits:
- '0'
- '1'
X-Content-Type-Options:
- nosniff
X-Fastly-Request-ID:
- 1faabc2f221d7528ed2cb4ce476bb4743267dec7
- ee433958a36f405851103062a9bf386e5db2217e
X-Frame-Options:
- deny
X-GitHub-Request-Id:
- 390A:531D:17C928:1C9465:650DE76A
- A926:6AE7:2E60:3C38:65149A88
X-Served-By:
- cache-den8274-DEN
- cache-lga21965-LGA
X-Timer:
- S1695410027.284138,VS0,VE129
- S1695849594.867877,VS0,VE81
X-XSS-Protection:
- 1; mode=block
status:
Expand Down Expand Up @@ -227,11 +227,11 @@ interactions:
Cross-Origin-Resource-Policy:
- cross-origin
Date:
- Fri, 22 Sep 2023 19:13:47 GMT
- Wed, 27 Sep 2023 21:19:54 GMT
ETag:
- '"80ec96bc0acf2e604a03f109bd730426aa82e442d44946231cbe82a531b944f7"'
Expires:
- Fri, 22 Sep 2023 19:18:47 GMT
- Wed, 27 Sep 2023 21:24:54 GMT
Source-Age:
- '0'
Strict-Transport-Security:
Expand All @@ -241,21 +241,21 @@ interactions:
Via:
- 1.1 varnish
X-Cache:
- MISS
- HIT
X-Cache-Hits:
- '0'
- '1'
X-Content-Type-Options:
- nosniff
X-Fastly-Request-ID:
- af8a2e5e50cf4a6b7933ef2cd7c2c27078a65d39
- 2adea1b418fa9194e021a9cddf8940135145355d
X-Frame-Options:
- deny
X-GitHub-Request-Id:
- 7364:1817:169CBE:1B6929:650DE76A
- 4992:28E3:3397:41F3:65149A87
X-Served-By:
- cache-den8236-DEN
- cache-lga21955-LGA
X-Timer:
- S1695410028.515211,VS0,VE166
- S1695849594.063816,VS0,VE72
X-XSS-Protection:
- 1; mode=block
status:
Expand Down Expand Up @@ -327,11 +327,11 @@ interactions:
Cross-Origin-Resource-Policy:
- cross-origin
Date:
- Fri, 22 Sep 2023 19:13:47 GMT
- Wed, 27 Sep 2023 21:19:54 GMT
ETag:
- '"726870312c74ead0b10c3125045c301e8600929684c49447d64c2db72dc779fc"'
Expires:
- Fri, 22 Sep 2023 19:18:47 GMT
- Wed, 27 Sep 2023 21:24:54 GMT
Source-Age:
- '0'
Strict-Transport-Security:
Expand All @@ -341,21 +341,21 @@ interactions:
Via:
- 1.1 varnish
X-Cache:
- MISS
- HIT
X-Cache-Hits:
- '0'
- '1'
X-Content-Type-Options:
- nosniff
X-Fastly-Request-ID:
- 9e07dc7de7a765128e6a8ae9fc028d69a4502bdb
- a17a4b697a894e9a49687527cea60f190d84dabe
X-Frame-Options:
- deny
X-GitHub-Request-Id:
- BB3C:61A6:15AFE9:1A7D50:650DE76B
- 5ACE:2795:4719:5769:65149A87
X-Served-By:
- cache-den8223-DEN
- cache-lga21935-LGA
X-Timer:
- S1695410028.779866,VS0,VE131
- S1695849594.236812,VS0,VE101
X-XSS-Protection:
- 1; mode=block
status:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ interactions:
Access-Control-Allow-Origin:
- '*'
Age:
- '0'
- '497'
Cache-Control:
- max-age=600
Connection:
Expand All @@ -120,7 +120,7 @@ interactions:
Content-Type:
- application/json; charset=utf-8
Date:
- Fri, 22 Sep 2023 19:13:49 GMT
- Wed, 27 Sep 2023 21:19:57 GMT
ETag:
- '"61eb1dc9-1abf"'
Last-Modified:
Expand All @@ -134,19 +134,19 @@ interactions:
Via:
- 1.1 varnish
X-Cache:
- MISS
- HIT
X-Cache-Hits:
- '0'
- '1'
X-Fastly-Request-ID:
- aefd7fd863a66263bbc2b318eaf85dfe5b985226
- 0143e3b78ec477aa5b33fac747cd6eaf4005d0d3
X-GitHub-Request-Id:
- 5F5C:6545:C45AE5:11B6DB0:650DE76B
- 821C:0FF5:2D086F:420327:6514696C
X-Served-By:
- cache-den8275-DEN
- cache-lga21962-LGA
X-Timer:
- S1695410030.515408,VS0,VE62
- S1695849597.293127,VS0,VE1
expires:
- Fri, 22 Sep 2023 19:23:49 GMT
- Wed, 27 Sep 2023 17:52:04 GMT
permissions-policy:
- interest-cohort=()
x-proxy-cache:
Expand Down
157 changes: 157 additions & 0 deletions tests/cassettes/test_catalog/TestCatalog.test_validate_all[cat1].yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
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/label/v1.0.1/schema.json
response:
body:
string: "{\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"$id\":
\"https://stac-extensions.github.io/label/v1.0.1/schema.json#\",\n \"title\":
\"Label Extension\",\n \"description\": \"STAC Label Extension for STAC Items
and STAC Collections.\",\n \"oneOf\": [\n {\n \"$comment\": \"This
is the schema for STAC Items.\",\n \"allOf\": [\n {\n \"type\":
\"object\",\n \"required\": [\n \"type\",\n \"properties\",\n
\ \"links\",\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 \"label:properties\",\n
\ \"label:description\",\n \"label:type\"\n
\ ]\n },\n {\n \"$ref\":
\"#/definitions/fields\"\n }\n ]\n },\n
\ \"links\": {\n \"type\": \"array\",\n \"items\":
{\n \"$ref\": \"#/definitions/link_fields\"\n }\n
\ },\n \"assets\": {\n \"type\": \"object\",\n
\ \"additionalProperties\": {\n \"$ref\": \"#/definitions/fields\"\n
\ }\n }\n }\n },\n {\n \"$ref\":
\"#/definitions/stac_extensions\"\n }\n ]\n },\n {\n \"$comment\":
\"This is the schema for STAC Collections.\",\n \"allOf\": [\n {\n
\ \"type\": \"object\",\n \"required\": [\n \"type\"\n
\ ],\n \"properties\": {\n \"type\": {\n \"const\":
\"Collection\"\n },\n \"assets\": {\n \"type\":
\"object\",\n \"additionalProperties\": {\n \"$ref\":
\"#/definitions/fields\"\n }\n },\n \"item_assets\":
{\n \"type\": \"object\",\n \"additionalProperties\":
{\n \"$ref\": \"#/definitions/fields\"\n }\n }\n
\ }\n },\n {\n \"$ref\": \"#/definitions/stac_extensions\"\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/label/v1.0.1/schema.json\"\n
\ }\n }\n }\n },\n \"link_fields\": {\n \"type\":
\"object\",\n \"properties\": {\n \"label:assets\": {\n \"type\":
\"array\",\n \"items\": {\n \"type\": \"string\"\n }\n
\ }\n },\n \"patternProperties\": {\n \"^(?!label:)\":
{}\n },\n \"additionalProperties\": false\n },\n \"fields\":
{\n \"type\": \"object\",\n \"properties\": {\n \"label:properties\":
{\n \"title\": \"Property\",\n \"oneOf\": [\n {\n
\ \"type\": \"array\",\n \"minItems\": 1,\n \"items\":
{\n \"type\": \"string\"\n }\n },\n
\ {\n \"type\": \"null\"\n }\n ]\n
\ },\n \"label:classes\": {\n \"title\": \"Classes\",\n
\ \"type\": \"array\",\n \"items\": {\n \"type\":
\"object\",\n \"required\": [\n \"name\",\n \"classes\"\n
\ ],\n \"properties\": {\n \"name\": {\n
\ \"title\": \"Name\"\n },\n \"classes\":
{\n \"title\": \"Classes\",\n \"oneOf\": [\n
\ {\n \"type\": \"array\",\n \"items\":
{\n \"type\": \"string\"\n }\n },\n
\ {\n \"type\": \"array\",\n \"items\":
{\n \"type\": \"number\"\n }\n }\n
\ ]\n }\n }\n }\n },\n
\ \"label:description\": {\n \"title\": \"Description\",\n
\ \"type\": \"string\",\n \"minLength\": 1\n },\n
\ \"label:type\": {\n \"title\": \"Type\",\n \"type\":
\"string\",\n \"enum\": [\n \"raster\",\n \"vector\"\n
\ ]\n },\n \"label:tasks\": {\n \"title\":
\"Task\",\n \"type\": \"array\",\n \"items\": {\n \"type\":
\"string\"\n }\n },\n \"label:methods\": {\n \"title\":
\"Method\",\n \"type\": \"array\",\n \"items\": {\n \"type\":
\"string\"\n }\n },\n \"label:overviews\": {\n \"title\":
\"Overview\",\n \"type\": \"array\",\n \"items\": {\n \"type\":
\"object\",\n \"properties\": {\n \"property_key\":
{\n \"title\": \"Property Key\",\n \"type\":
\"string\"\n },\n \"counts\": {\n \"title\":
\"Counts\",\n \"type\": \"array\",\n \"items\":
{\n \"type\": \"object\",\n \"properties\":
{\n \"name\": {\n \"title\": \"Class
Name\",\n \"type\": \"string\"\n },\n
\ \"count\": {\n \"title\": \"Count\",\n
\ \"type\": \"integer\"\n }\n }\n
\ }\n },\n \"statistics\": {\n \"title\":
\"Statistics\",\n \"type\": \"array\",\n \"items\":
{\n \"type\": \"object\",\n \"properties\":
{\n \"name\": {\n \"title\": \"Stat
Name\",\n \"type\": \"string\"\n },\n
\ \"value\": {\n \"title\": \"Value\",\n
\ \"type\": \"number\"\n }\n }\n
\ }\n }\n }\n }\n }\n
\ },\n \"if\": {\n \"properties\": {\n \"label:type\":
{\n \"const\": \"raster\"\n }\n }\n },\n \"then\":
{\n \"properties\": {\n \"label:classes\": {\n \"items\":
{\n \"properties\": {\n \"name\": {\n \"type\":
\"null\"\n }\n }\n }\n }\n
\ }\n },\n \"else\": {\n \"properties\": {\n \"label:classes\":
{\n \"items\": {\n \"properties\": {\n \"name\":
{\n \"type\": \"string\",\n \"minLength\":
1\n }\n }\n }\n }\n }\n
\ },\n \"patternProperties\": {\n \"^(?!label:)\": {}\n },\n
\ \"additionalProperties\": false\n }\n }\n}"
headers:
Accept-Ranges:
- bytes
Access-Control-Allow-Origin:
- '*'
Age:
- '497'
Cache-Control:
- max-age=600
Connection:
- close
Content-Length:
- '6847'
Content-Type:
- application/json; charset=utf-8
Date:
- Wed, 27 Sep 2023 21:19:57 GMT
ETag:
- '"61eb1dc9-1abf"'
Last-Modified:
- Fri, 21 Jan 2022 20:55:37 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:
- 8e0c7f08fe1dee62273884e215cc2f9033ee7dd2
X-GitHub-Request-Id:
- 821C:0FF5:2D086F:420327:6514696C
X-Served-By:
- cache-lga21932-LGA
X-Timer:
- S1695849598.593243,VS0,VE1
expires:
- Wed, 27 Sep 2023 17:52:04 GMT
permissions-policy:
- interest-cohort=()
x-proxy-cache:
- MISS
status:
code: 200
message: OK
version: 1
Loading

0 comments on commit fd3a2bf

Please sign in to comment.