Skip to content

Commit

Permalink
fixing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
John Waller committed May 2, 2024
1 parent 47054a3 commit 9074fe0
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 40 deletions.
8 changes: 4 additions & 4 deletions test/test-occurrences-get.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@
@vcr.use_cassette("test/vcr_cassettes/test_get.yaml")
def test_get():
"occurrences.get - basic test"
res = occurrences.get(key=1986620884)
res = occurrences.get(key=142316497)
assert "dict" == res.__class__.__name__
assert len(res) > 30
assert 1986620884 == res["key"]
assert 142316497 == res["key"]


@vcr.use_cassette("test/vcr_cassettes/test_get_verbatim.yaml")
def test_get_verbatim():
"occurrences.get_verbatim - basic test"
res = occurrences.get_verbatim(key=1986620884)
res = occurrences.get_verbatim(key=142316497)
assert "dict" == res.__class__.__name__
assert len(res) > 20
assert 1986620884 == res["key"]
assert 142316497 == res["key"]


@vcr.use_cassette("test/vcr_cassettes/test_get_fragment.yaml")
Expand Down
29 changes: 11 additions & 18 deletions test/vcr_cassettes/test_get.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,38 +9,31 @@ interactions:
Connection:
- keep-alive
user-agent:
- python-requests/2.31.0,pygbif/0.6.3
- python-requests/2.31.0,pygbif/0.6.4
method: GET
uri: https://api.gbif.org/v1/occurrence/1986620884
uri: https://api.gbif.org/v1/occurrence/142316497
response:
body:
string: '{"key":1986620884,"datasetKey":"50c9509d-22c7-4a22-a47d-8c48425ef4a7","publishingOrgKey":"28eb1a3f-1c15-4a95-931a-4af90ecb574d","installationKey":"997448a8-f762-11e1-a439-00145eb45e9a","hostingOrganizationKey":"28eb1a3f-1c15-4a95-931a-4af90ecb574d","publishingCountry":"US","protocol":"DWC_ARCHIVE","lastCrawled":"2024-02-23T05:16:29.968+00:00","lastParsed":"2024-02-23T14:29:43.197+00:00","crawlId":437,"extensions":{"http://rs.gbif.org/terms/1.0/Multimedia":[{"http://rs.tdwg.org/dwc/terms/catalogNumber":"30065447","http://purl.org/dc/terms/format":"image/jpeg","http://purl.org/dc/terms/identifier":"https://inaturalist-open-data.s3.amazonaws.com/photos/30065447/original.jpg","http://purl.org/dc/terms/rightsHolder":"John
Waller","http://purl.org/dc/terms/creator":"John Waller","http://purl.org/dc/terms/created":"2019-01-09T16:06:54Z","http://purl.org/dc/terms/publisher":"iNaturalist","http://purl.org/dc/terms/type":"StillImage","http://purl.org/dc/terms/references":"https://www.inaturalist.org/photos/30065447","http://purl.org/dc/terms/license":"http://creativecommons.org/licenses/by-nc/4.0/"}]},"basisOfRecord":"HUMAN_OBSERVATION","occurrenceStatus":"PRESENT","lifeStage":"Adult","taxonKey":4264680,"kingdomKey":1,"phylumKey":44,"classKey":359,"orderKey":1459,"familyKey":3240572,"genusKey":3240573,"speciesKey":4264680,"acceptedTaxonKey":4264680,"scientificName":"Myocastor
coypus (Molina, 1782)","acceptedScientificName":"Myocastor coypus (Molina,
1782)","kingdom":"Animalia","phylum":"Chordata","order":"Rodentia","family":"Myocastoridae","genus":"Myocastor","species":"Myocastor
coypus","genericName":"Myocastor","specificEpithet":"coypus","taxonRank":"SPECIES","taxonomicStatus":"ACCEPTED","iucnRedListCategory":"LC","dateIdentified":"2019-01-09T18:12:11","decimalLatitude":48.755169,"decimalLongitude":25.102155,"coordinateUncertaintyInMeters":19.0,"continent":"EUROPE","stateProvince":"Ivano-Frankivs''k","gadm":{"level0":{"gid":"UKR","name":"Ukraine"},"level1":{"gid":"UKR.7_1","name":"Ivano-Frankivs''k"},"level2":{"gid":"UKR.7.14_1","name":"Tlumats''kyi"}},"year":2019,"month":1,"day":9,"eventDate":"2019-01-09T18:06:54","startDayOfYear":9,"endDayOfYear":9,"issues":["COORDINATE_ROUNDED","CONTINENT_DERIVED_FROM_COORDINATES","TAXON_MATCH_TAXON_ID_IGNORED"],"modified":"2023-02-10T01:24:27.000+00:00","lastInterpreted":"2024-02-23T14:29:43.197+00:00","references":"https://www.inaturalist.org/observations/19535428","license":"http://creativecommons.org/publicdomain/zero/1.0/legalcode","isSequenced":false,"identifiers":[{"identifier":"19535428"}],"media":[{"type":"StillImage","format":"image/jpeg","references":"https://www.inaturalist.org/photos/30065447","created":"2019-01-09T16:06:54.000+00:00","creator":"John
Waller","publisher":"iNaturalist","license":"http://creativecommons.org/licenses/by-nc/4.0/","rightsHolder":"John
Waller","identifier":"https://inaturalist-open-data.s3.amazonaws.com/photos/30065447/original.jpg"}],"facts":[],"relations":[],"isInCluster":false,"datasetName":"iNaturalist
research-grade observations","recordedBy":"John Waller","identifiedBy":"John
Waller","geodeticDatum":"WGS84","class":"Mammalia","countryCode":"UA","recordedByIDs":[],"identifiedByIDs":[],"gbifRegion":"EUROPE","country":"Ukraine","publishedByGbifRegion":"NORTH_AMERICA","rightsHolder":"John
Waller","identifier":"19535428","http://unknown.org/nick":"pigeonspotters1888","verbatimEventDate":"Wed
Jan 09 2019 20:06:54 GMT+0200 (GMT+2)","verbatimLocality":"Khotymyr, Khotymyr,
Ivano-Frankivsk Oblast, UA","collectionCode":"Observations","gbifID":"1986620884","occurrenceID":"https://www.inaturalist.org/observations/19535428","taxonID":"43997","catalogNumber":"19535428","institutionCode":"iNaturalist","eventTime":"18:06:54+02:00","http://unknown.org/captive":"wild","identificationID":"42848020"}'
string: "{\"key\":142316497,\"datasetKey\":\"8575f23e-f762-11e1-a439-00145eb45e9a\",\"publishingOrgKey\":\"57254bd0-8256-11d8-b7ed-b8a03c50a862\",\"networkKeys\":[\"17abcf75-2f1e-46dd-bf75-a5b21dd02655\"],\"installationKey\":\"60454014-f762-11e1-a439-00145eb45e9a\",\"hostingOrganizationKey\":\"57254bd0-8256-11d8-b7ed-b8a03c50a862\",\"publishingCountry\":\"DE\",\"protocol\":\"BIOCASE\",\"lastCrawled\":\"2024-04-28T21:25:35.174+00:00\",\"lastParsed\":\"2024-04-28T21:31:42.450+00:00\",\"crawlId\":275,\"extensions\":{},\"basisOfRecord\":\"PRESERVED_SPECIMEN\",\"occurrenceStatus\":\"PRESENT\",\"taxonKey\":3883382,\"kingdomKey\":6,\"phylumKey\":7707728,\"classKey\":220,\"orderKey\":408,\"familyKey\":2497,\"genusKey\":5428512,\"speciesKey\":10846508,\"acceptedTaxonKey\":10846508,\"scientificName\":\"Ballota
acetabulosa (L.) Benth.\",\"acceptedScientificName\":\"Pseudodictamnus acetabulosus
(L.) Salmaki & Siadati\",\"kingdom\":\"Plantae\",\"phylum\":\"Tracheophyta\",\"order\":\"Lamiales\",\"family\":\"Lamiaceae\",\"genus\":\"Pseudodictamnus\",\"species\":\"Pseudodictamnus
acetabulosus\",\"genericName\":\"Ballota\",\"specificEpithet\":\"acetabulosa\",\"taxonRank\":\"SPECIES\",\"taxonomicStatus\":\"SYNONYM\",\"iucnRedListCategory\":\"NE\",\"decimalLatitude\":38.10695,\"decimalLongitude\":26.85083,\"elevation\":0.0,\"continent\":\"ASIA\",\"gadm\":{\"level0\":{\"gid\":\"TUR\",\"name\":\"Turkey\"},\"level1\":{\"gid\":\"TUR.41_1\",\"name\":\"Izmir\"},\"level2\":{\"gid\":\"TUR.41.24_1\",\"name\":\"Seferihisar\"}},\"year\":1999,\"month\":6,\"day\":18,\"eventDate\":\"1999-06-18T00:00\",\"startDayOfYear\":169,\"endDayOfYear\":169,\"issues\":[\"GEODETIC_DATUM_ASSUMED_WGS84\",\"CONTINENT_DERIVED_FROM_COORDINATES\",\"COLLECTION_MATCH_NONE\",\"INSTITUTION_MATCH_FUZZY\"],\"lastInterpreted\":\"2024-04-28T21:31:42.450+00:00\",\"license\":\"http://creativecommons.org/licenses/by/4.0/legalcode\",\"isSequenced\":false,\"identifiers\":[{\"identifier\":\"urn:catalog:BGBM:Pontaurus:1\"}],\"media\":[],\"facts\":[],\"relations\":[],\"institutionKey\":\"4cf93dd2-06c8-4f49-89bc-a5d0805c6747\",\"isInCluster\":false,\"recordedBy\":\"Markus
D\xF6ring\",\"identifiedBy\":\"Markus D\xF6ring\",\"geodeticDatum\":\"WGS84\",\"class\":\"Magnoliopsida\",\"countryCode\":\"TR\",\"recordedByIDs\":[],\"identifiedByIDs\":[],\"gbifRegion\":\"EUROPE\",\"country\":\"T\xFCrkiye\",\"publishedByGbifRegion\":\"EUROPE\",\"catalogNumber\":\"1\",\"institutionCode\":\"BGBM\",\"gbifID\":\"142316497\",\"collectionCode\":\"Pontaurus\"}"
headers:
Accept-Ranges:
- bytes
Age:
- '0'
- '312'
Cache-Control:
- public, max-age=3601
Connection:
- keep-alive
Content-Length:
- '3820'
- '2234'
Content-Type:
- application/json
Date:
- Fri, 01 Mar 2024 08:32:20 GMT
- Thu, 02 May 2024 09:55:30 GMT
Expires:
- '0'
Pragma:
Expand All @@ -54,7 +47,7 @@ interactions:
X-Frame-Options:
- DENY
X-Varnish:
- '725189778'
- 619577756 617153489
X-XSS-Protection:
- 1; mode=block
status:
Expand Down
8 changes: 4 additions & 4 deletions test/vcr_cassettes/test_get_fragment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ interactions:
Connection:
- keep-alive
user-agent:
- python-requests/2.31.0,pygbif/0.6.3
- python-requests/2.31.0,pygbif/0.6.4
method: GET
uri: https://api.gbif.org/v1/occurrence/1986620884/fragment
response:
Expand All @@ -27,7 +27,7 @@ interactions:
Accept-Ranges:
- bytes
Age:
- '0'
- '59'
Cache-Control:
- public, max-age=3601
Connection:
Expand All @@ -37,7 +37,7 @@ interactions:
Content-Type:
- application/json
Date:
- Fri, 01 Mar 2024 08:32:21 GMT
- Thu, 02 May 2024 10:15:20 GMT
Expires:
- '0'
Pragma:
Expand All @@ -51,7 +51,7 @@ interactions:
X-Frame-Options:
- DENY
X-Varnish:
- '705464058'
- 521640760 615810878
X-XSS-Protection:
- 1; mode=block
status:
Expand Down
24 changes: 10 additions & 14 deletions test/vcr_cassettes/test_get_verbatim.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,34 +9,30 @@ interactions:
Connection:
- keep-alive
user-agent:
- python-requests/2.31.0,pygbif/0.6.3
- python-requests/2.31.0,pygbif/0.6.4
method: GET
uri: https://api.gbif.org/v1/occurrence/1986620884/verbatim
uri: https://api.gbif.org/v1/occurrence/142316497/verbatim
response:
body:
string: '{"key":1986620884,"datasetKey":"50c9509d-22c7-4a22-a47d-8c48425ef4a7","publishingOrgKey":"28eb1a3f-1c15-4a95-931a-4af90ecb574d","installationKey":"997448a8-f762-11e1-a439-00145eb45e9a","publishingCountry":"US","protocol":"DWC_ARCHIVE","lastCrawled":"2024-02-23T05:16:29.968+00:00","lastParsed":"2024-02-23T14:29:43.197+00:00","crawlId":437,"extensions":{"http://rs.gbif.org/terms/1.0/Multimedia":[{"http://rs.tdwg.org/dwc/terms/catalogNumber":"30065447","http://purl.org/dc/terms/format":"image/jpeg","http://purl.org/dc/terms/identifier":"https://inaturalist-open-data.s3.amazonaws.com/photos/30065447/original.jpg","http://purl.org/dc/terms/rightsHolder":"John
Waller","http://purl.org/dc/terms/creator":"John Waller","http://purl.org/dc/terms/created":"2019-01-09T16:06:54Z","http://purl.org/dc/terms/publisher":"iNaturalist","http://purl.org/dc/terms/type":"StillImage","http://purl.org/dc/terms/references":"https://www.inaturalist.org/photos/30065447","http://purl.org/dc/terms/license":"http://creativecommons.org/licenses/by-nc/4.0/"}]},"publishedByGbifRegion":"NORTH_AMERICA","http://rs.tdwg.org/dwc/terms/verbatimEventDate":"Wed
Jan 09 2019 20:06:54 GMT+0200 (GMT+2)","http://rs.tdwg.org/dwc/terms/collectionCode":"Observations","http://rs.tdwg.org/dwc/terms/taxonID":"43997","http://rs.tdwg.org/dwc/terms/order":"Rodentia","http://rs.tdwg.org/dwc/terms/verbatimLocality":"Khotymyr,
Khotymyr, Ivano-Frankivsk Oblast, UA","http://rs.tdwg.org/dwc/terms/taxonRank":"species","http://rs.tdwg.org/dwc/terms/lifeStage":"adult","http://rs.tdwg.org/dwc/terms/basisOfRecord":"HumanObservation","http://purl.org/dc/terms/rightsHolder":"John
Waller","http://rs.tdwg.org/dwc/terms/identificationID":"42848020","http://rs.tdwg.org/dwc/terms/family":"Echimyidae","http://purl.org/dc/terms/modified":"2023-02-10T01:24:27Z","http://rs.tdwg.org/dwc/terms/decimalLatitude":"48.7551693647","http://rs.tdwg.org/dwc/terms/eventTime":"18:06:54+02:00","http://rs.tdwg.org/dwc/terms/stateProvince":"Ivano-Frankivs''k","http://rs.tdwg.org/dwc/terms/scientificName":"Myocastor
coypus","http://rs.tdwg.org/dwc/terms/recordedBy":"John Waller","http://rs.tdwg.org/dwc/terms/phylum":"Chordata","http://purl.org/dc/terms/license":"http://creativecommons.org/publicdomain/zero/1.0/","http://rs.gbif.org/terms/1.0/gbifID":"1986620884","http://rs.tdwg.org/dwc/terms/datasetName":"iNaturalist
research-grade observations","http://rs.tdwg.org/dwc/terms/genus":"Myocastor","http://rs.tdwg.org/dwc/terms/kingdom":"Animalia","http://rs.tdwg.org/dwc/terms/coordinateUncertaintyInMeters":"19","http://purl.org/dc/terms/identifier":"19535428","https://www.inaturalist.org/schema/terms/captive":"wild","http://rs.tdwg.org/dwc/terms/class":"Mammalia","http://rs.tdwg.org/dwc/terms/occurrenceID":"https://www.inaturalist.org/observations/19535428","http://rs.tdwg.org/dwc/terms/identifiedBy":"John
Waller","http://rs.tdwg.org/dwc/terms/eventDate":"2019-01-09T18:06:54+02:00","http://rs.tdwg.org/dwc/terms/catalogNumber":"19535428","http://purl.org/dc/terms/references":"https://www.inaturalist.org/observations/19535428","http://rs.tdwg.org/dwc/terms/decimalLongitude":"25.1021547229","http://rs.tdwg.org/dwc/terms/countryCode":"UA","http://rs.tdwg.org/dwc/terms/institutionCode":"iNaturalist","http://xmlns.com/foaf/0.1/nick":"pigeonspotters1888","http://rs.tdwg.org/dwc/terms/geodeticDatum":"EPSG:4326","http://rs.tdwg.org/dwc/terms/dateIdentified":"2019-01-09T18:12:11Z"}'
string: "{\"key\":142316497,\"datasetKey\":\"8575f23e-f762-11e1-a439-00145eb45e9a\",\"publishingOrgKey\":\"57254bd0-8256-11d8-b7ed-b8a03c50a862\",\"networkKeys\":[\"17abcf75-2f1e-46dd-bf75-a5b21dd02655\"],\"installationKey\":\"60454014-f762-11e1-a439-00145eb45e9a\",\"publishingCountry\":\"DE\",\"protocol\":\"BIOCASE\",\"lastCrawled\":\"2024-04-28T21:25:35.174+00:00\",\"lastParsed\":\"2024-04-28T21:31:42.450+00:00\",\"crawlId\":275,\"extensions\":{},\"publishedByGbifRegion\":\"EUROPE\",\"http://rs.gbif.org/terms/1.0/gbifID\":\"142316497\",\"http://rs.tdwg.org/dwc/terms/kingdom\":\"Plantae\",\"http://purl.org/dc/terms/identifier\":\"urn:catalog:BGBM:Pontaurus:1\",\"http://rs.tdwg.org/dwc/terms/country\":\"Turkey\",\"http://rs.tdwg.org/dwc/terms/class\":\"Magnoliopsida\",\"http://rs.tdwg.org/dwc/terms/collectionCode\":\"Pontaurus\",\"http://rs.tdwg.org/dwc/terms/order\":\"Lamiales\",\"http://rs.tdwg.org/dwc/terms/minimumElevationInMeters\":\"0\",\"http://rs.tdwg.org/dwc/terms/identifiedBy\":\"Markus
D\xF6ring\",\"http://rs.tdwg.org/dwc/terms/basisOfRecord\":\"specimen\",\"http://rs.tdwg.org/dwc/terms/eventDate\":\"1999-06-18T00:00:00\",\"http://rs.tdwg.org/dwc/terms/catalogNumber\":\"1\",\"http://rs.tdwg.org/dwc/terms/family\":\"Lamiaceae\",\"http://rs.tdwg.org/dwc/terms/decimalLongitude\":\"26.85083\",\"http://rs.tdwg.org/dwc/terms/decimalLatitude\":\"38.10695\",\"http://rs.tdwg.org/dwc/terms/institutionCode\":\"BGBM\",\"http://rs.tdwg.org/dwc/terms/scientificName\":\"Ballota
acetabulosa (L.) Benth.\",\"http://rs.tdwg.org/dwc/terms/recordedBy\":\"Markus
D\xF6ring\",\"http://rs.tdwg.org/dwc/terms/phylum\":\"Magnoliophyta\"}"
headers:
Accept-Ranges:
- bytes
Age:
- '0'
- '372'
Cache-Control:
- public, max-age=3601
Connection:
- keep-alive
Content-Length:
- '3438'
- '1517'
Content-Type:
- application/json
Date:
- Fri, 01 Mar 2024 08:32:21 GMT
- Thu, 02 May 2024 09:55:28 GMT
Expires:
- '0'
Pragma:
Expand All @@ -50,7 +46,7 @@ interactions:
X-Frame-Options:
- DENY
X-Varnish:
- '709396787'
- 293846355 581601578
X-XSS-Protection:
- 1; mode=block
status:
Expand Down

0 comments on commit 9074fe0

Please sign in to comment.