Skip to content

Commit

Permalink
fixing matching issue with occ_downoad_cache #748
Browse files Browse the repository at this point in the history
  • Loading branch information
John Waller committed Sep 20, 2024
1 parent 40f1985 commit 5dd619c
Show file tree
Hide file tree
Showing 46 changed files with 118,640 additions and 1 deletion.
2 changes: 1 addition & 1 deletion R/occ_download_user_dl.R
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ DownloadMatch <- R6::R6Class(
check_matches = function() {
assert(self$age, c("integer", "numeric"))
self$preds <- self$preds[tolower(self$preds$status) == "succeeded", ]
mtchs <- unclass(check_inputs(self$pred$request)) == self$preds$pred_str
mtchs <- unclass(check_inputs(self$pred$request)) == gsub(",\"matchCase\":\"FALSE\"", "", self$preds$pred_str)
if (!any(mtchs)) {
self$output <- self$pred_match()
} else {
Expand Down
23 changes: 23 additions & 0 deletions tests/fixtures/occ_download_cancel.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
http_interactions:
- request:
method: delete
uri: https://api.gbif.org/v1/occurrence/download/request/0030224-240506114902167
body:
encoding: ''
string: ''
headers:
Accept-Encoding: gzip, deflate
Accept: application/json, text/xml, application/xml, */*
response:
status:
status_code: '204'
message: No Content
explanation: Request fulfilled, nothing follows
headers:
status: HTTP/1.1 204 No Content
body:
encoding: ''
file: no
string: ''
recorded_at: 2024-09-20 15:29:32 GMT
recorded_with: vcr/1.2.0, webmockr/0.9.0
533 changes: 533 additions & 0 deletions tests/fixtures/occ_get.yml

Large diffs are not rendered by default.

245 changes: 245 additions & 0 deletions tests/fixtures/occ_get_other.yml

Large diffs are not rendered by default.

167 changes: 167 additions & 0 deletions tests/fixtures/occ_metadata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
http_interactions:
- request:
method: get
uri: https://api.gbif.org/v1/occurrence/search/catalogNumber?q=122&limit=5
body:
encoding: ''
string: ''
headers:
Accept-Encoding: gzip, deflate
Accept: application/json, text/xml, application/xml, */*
response:
status:
status_code: '200'
message: OK
explanation: Request fulfilled, document follows
headers:
status: HTTP/1.1 200 OK
content-type: application/json
body:
encoding: ''
file: no
string: '["122","122 (WSP iSOTYPE)","122 (WSP, isotype) San Martin, F. 8010S","122
E10","122 F"]'
recorded_at: 2024-09-20 15:35:07 GMT
recorded_with: vcr/1.2.0, webmockr/0.9.0
- request:
method: get
uri: https://api.gbif.org/v1/occurrence/search/collectionCode?q=12&limit=5
body:
encoding: ''
string: ''
headers:
Accept-Encoding: gzip, deflate
Accept: application/json, text/xml, application/xml, */*
response:
status:
status_code: '200'
message: OK
explanation: Request fulfilled, document follows
headers:
status: HTTP/1.1 200 OK
content-type: application/json
body:
encoding: ''
file: no
string: '["12","12-00","12-1","12-82","12-CF"]'
recorded_at: 2024-09-20 15:35:07 GMT
recorded_with: vcr/1.2.0, webmockr/0.9.0
- request:
method: get
uri: https://api.gbif.org/v1/occurrence/search/institutionCode?q=GB&limit=5
body:
encoding: ''
string: ''
headers:
Accept-Encoding: gzip, deflate
Accept: application/json, text/xml, application/xml, */*
response:
status:
status_code: '200'
message: OK
explanation: Request fulfilled, document follows
headers:
status: HTTP/1.1 200 OK
content-type: application/json
body:
encoding: ''
file: no
string: '["GB","GB, GH, S","GB, US","GBA","GBAO"]'
recorded_at: 2024-09-20 15:35:07 GMT
recorded_with: vcr/1.2.0, webmockr/0.9.0
- request:
method: get
uri: https://api.gbif.org/v1/occurrence/search/catalogNumber?q=122&limit=5
body:
encoding: ''
string: ''
headers:
Accept-Encoding: gzip, deflate
Accept: application/json, text/xml, application/xml, */*
response:
status:
status_code: '200'
message: OK
explanation: Request fulfilled, document follows
headers:
status: HTTP/1.1 200 OK
content-type: application/json
body:
encoding: ''
file: no
string: '["122","122 (WSP iSOTYPE)","122 (WSP, isotype) San Martin, F. 8010S","122
E10","122 F"]'
recorded_at: 2024-09-20 15:35:07 GMT
recorded_with: vcr/1.2.0, webmockr/0.9.0
- request:
method: get
uri: https://api.gbif.org/v1/occurrence/search/catalogNumber?q=122&limit=10
body:
encoding: ''
string: ''
headers:
Accept-Encoding: gzip, deflate
Accept: application/json, text/xml, application/xml, */*
response:
status:
status_code: '200'
message: OK
explanation: Request fulfilled, document follows
headers:
status: HTTP/1.1 200 OK
content-type: application/json
body:
encoding: ''
file: no
string: '["122","122 (WSP iSOTYPE)","122 (WSP, isotype) San Martin, F. 8010S","122
E10","122 F","122 RMCA 16981-M-","122 a","122 cyl","122 tauschii","122(4165)"]'
recorded_at: 2024-09-20 15:35:07 GMT
recorded_with: vcr/1.2.0, webmockr/0.9.0
- request:
method: get
uri: https://api.gbif.org/v1/occurrence/search/catalogNumber?q=122&limit=5
body:
encoding: ''
string: ''
headers:
Accept-Encoding: gzip, deflate
Accept: application/json, text/xml, application/xml, */*
response:
status:
status_code: '200'
message: OK
explanation: Request fulfilled, document follows
headers:
status: HTTP/1.1 200 OK
content-type: application/json
body:
encoding: ''
file: no
string: '["122","122 (WSP iSOTYPE)","122 (WSP, isotype) San Martin, F. 8010S","122
E10","122 F"]'
recorded_at: 2024-09-20 15:35:07 GMT
recorded_with: vcr/1.2.0, webmockr/0.9.0
- request:
method: get
uri: https://api.gbif.org/v1/occurrence/search/recordedBy?q=scott&limit=5
body:
encoding: ''
string: ''
headers:
Accept-Encoding: gzip, deflate
Accept: application/json, text/xml, application/xml, */*
response:
status:
status_code: '200'
message: OK
explanation: Request fulfilled, document follows
headers:
status: HTTP/1.1 200 OK
content-type: application/json
body:
encoding: ''
file: no
string: '["SCOTT","SCOTT SUSAN","SCOTT A","SCOTT AND DOUGLAS MOODY","SCOTT
AND KING"]'
recorded_at: 2024-09-20 15:35:07 GMT
recorded_with: vcr/1.2.0, webmockr/0.9.0
Loading

0 comments on commit 5dd619c

Please sign in to comment.