Skip to content

Commit

Permalink
Remove redundant assertion
Browse files Browse the repository at this point in the history
  • Loading branch information
wkmor1 committed Sep 14, 2023
1 parent 2fb314e commit 606be64
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 65 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/check-standard.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,7 @@ jobs:

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: |
any::rcmdcheck
any::xml2
extra-packages: any::rcmdcheck
needs: check

- uses: r-lib/actions/check-r-package@v2
Expand Down
8 changes: 0 additions & 8 deletions R/api_get.R
Original file line number Diff line number Diff line change
Expand Up @@ -226,14 +226,6 @@ api_get <- function(obj) {

resp_type <- gsub("\\s", "", resp[[c("headers", "content-type")]])

if (!identical(resp_type, "application/json;charset=utf-8")) {

obj <- NULL

stop("API did not return json", call. = FALSE)

}

parsed <- httr::content(resp)

if (!identical(resp[["status_code"]], 200L)) {
Expand Down
33 changes: 0 additions & 33 deletions tests/cassettes/api_get.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,36 +95,3 @@ http_interactions:
string: '{"status":400,"message":"No such field for base UNIT: not_a_var"}'
recorded_at: 2023-08-28 10:59:04 GMT
recorded_with: vcr/1.2.2, webmockr/0.9.0
- request:
method: get
uri: https://apitest.laji.fi/v0/warehouse/query/unit/list?format=xml&page=1&pageSize=1&selected=unit.unitId&access_token=<finbif_token>
body:
encoding: ''
string: ''
headers:
Content-Type: ''
Accept: application/json
response:
status:
status_code: 200
category: Success
reason: OK
message: 'Success: (200) OK'
headers:
date: Mon, 28 Aug 2023 10:59:04 GMT
content-type: application/xml;charset=utf-8
transfer-encoding: chunked
access-control-allow-origin: '*'
via: 1.0 staging.laji.fi
cache-control: no-store
x-frame-options: DENY
x-xss-protection: 1;mode=block
x-content-type-options: nosniff
strict-transport-security: max-age=31536000;includeSubDomains;preload
referrer-policy: no-referrer-when-downgrade
body:
encoding: ''
file: no
string: <response><currentPage>1</currentPage><nextPage>2</nextPage><lastPage>2621259</lastPage><pageSize>1</pageSize><total>2621259</total><cacheTimestamp>1693220344</cacheTimestamp><results><unit><unitId>http://tun.fi/KE.176/64e725902d0ec27bece0497f#Unit1</unitId></unit></results></response>
recorded_at: 2023-08-28 10:59:04 GMT
recorded_with: vcr/1.2.2, webmockr/0.9.0
21 changes: 0 additions & 21 deletions tests/testthat/test-finbif_api_get.R
Original file line number Diff line number Diff line change
Expand Up @@ -41,27 +41,6 @@ test_that(
}
)

test_that(
"that doesn't receive JSON returns an error message", {

skip_on_cran()

expect_error(
api_get(
list(
path = "warehouse/query/unit/list",
query = list(
format = "xml", page = 1, pageSize = 1, selected = "unit.unitId"
),
cache = FALSE
)
),
"API did not return json"
)

}
)

suppressMessages(eject_cassette("api_get"))

suppressMessages(insert_cassette("api_get_with_email"))
Expand Down

0 comments on commit 606be64

Please sign in to comment.