Skip to content

Commit

Permalink
updated service endpoint mock_dir with valid data
Browse files Browse the repository at this point in the history
  • Loading branch information
datapumpernickel committed Nov 17, 2023
1 parent ed69e72 commit 0a9c660
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
structure(list(method = "GET", url = "https://comtradeapi.un.org/data/v1/get/S/A/EB?cmdCode=200&flowCode=M%2CX%2CRM%2CRX&partnerCode=32%2C280%2C276&reporterCode=156&period=2010&motCode=0&partner2Code=0&customsCode=C00&includeDesc=TRUE", # nolint start
status_code = 401L, headers = structure(list(`Content-Length` = "143",
`Content-Type` = "application/json", `Request-Context` = "appId=cid-v1:9b6e1d5a-3728-46ff-b743-6d33d23e54a6",
`WWW-Authenticate` = "AzureApiManagementKey realm=\"https://comtradeapi.un.org/data\",name=\"Ocp-Apim-Subscription-Key\",type=\"header\"",
Date = "Fri, 01 Sep 2023 17:43:39 GMT"), class = "httr2_headers"),
body = charToRaw("{ \"statusCode\": 401, \"message\": \"Access denied due to invalid subscription key. Make sure to provide a valid key for an active subscription.\" }")), class = "httr2_response") # nolint end
structure(list(method = "GET", url = "https://comtradeapi.un.org/data/v1/get/S/A/EB?cmdCode=200&flowCode=M%2CX%2CRM%2CRX&partnerCode=32%2C280%2C276&reporterCode=156&period=2010&motCode=0&partner2Code=0&customsCode=C00&includeDesc=TRUE",
status_code = 200L, headers = structure(list(`Transfer-Encoding` = "chunked",
`Content-Type` = "application/json; charset=utf-8", `Content-Encoding` = "gzip",
Vary = "Accept-Encoding", `Request-Context` = "appId=cid-v1:9b6e1d5a-3728-46ff-b743-6d33d23e54a6",
`x-frame-options` = "deny", `X-Content-Type-Options` = "nosniff",
`X-XSS-Protection` = "1;mode=block", `strict-transport-security` = "max-age=31536000;includeSubDomains",
`content-security-policy` = "frame-src 'self'", `x-permitted-cross-domain-policies` = "none",
`Referrer-Policy` = "no-referrer-when-downgrade", `Permissions-Policy` = "accelerometer=(), camera=(), geolocation=(), gyroscope=(), magnetometer=(), microphone=(), payment=(), usb=()",
Date = "Fri, 17 Nov 2023 10:50:31 GMT"), class = "httr2_headers"),
body = charToRaw("{\"elapsedTime\":\"6.69 secs\",\"count\":0,\"data\":[],\"error\":\"\"}")), class = "httr2_response")
2 changes: 1 addition & 1 deletion tests/testthat/test-ct_get_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ httptest2::with_mock_dir("goods",simplify = F, {
})
})

httptest2::with_mock_dir("services", {
httptest2::with_mock_dir("services",simplify = F, {
test_that("We can get services data", {
expect_s3_class(comtradr::ct_get_data(type = 'services',
commodity_classification = 'EB',
Expand Down

0 comments on commit 0a9c660

Please sign in to comment.