Skip to content

Commit

Permalink
Merge pull request #209 from aboddie/master
Browse files Browse the repository at this point in the history
Remove STAT_EE and update tests
  • Loading branch information
eblondel authored Dec 12, 2024
2 parents 2ed4449 + ad03841 commit 101f026
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 51 deletions.
13 changes: 1 addition & 12 deletions R/SDMXServiceProvider-methods.R
Original file line number Diff line number Diff line change
Expand Up @@ -430,17 +430,6 @@ setSDMXServiceProviders <- function(){ # nocov start
)
)

#STAT_EE - Statistics Estonia database {Estonia}
STAT_EE <- SDMXServiceProvider(
agencyId = "STAT_EE", name = "Statistics Estonia database",
scale = "national", country = "EST",
builder = SDMXDotStatRequestBuilder(
regUrl = "http://andmebaas.stat.ee/restsdmx/sdmx.ashx",
repoUrl = "http://andmebaas.stat.ee/restsdmx/sdmx.ashx",
unsupportedResources = list("dataflow")
)
)

#UKDS removed - no support for SDMX-JSON in rsdmx at now
#UKDS <- SDMXServiceProvider(
# agencyId = "UKDS", name = "United Kingdom Data Service",
Expand Down Expand Up @@ -568,7 +557,7 @@ setSDMXServiceProviders <- function(){ # nocov start
#international
BIS, ECB, ESTAT,ESTAT_COMEXT, ESTAT_COMP, ESTAT_GROW, ESTAT_EMPL, IMF, IMF_DATA, OECD, UNICEF, CD2030, UNSD, ILO_Legacy, ILO, WBG_WITS, WB, PDH,
#national
ABS, NBB, INSEE, INEGI, ISTAT_LEGACY, ISTAT, NOMIS, LSD, NCSI, STAT_EE, BBK,
ABS, NBB, INSEE, INEGI, ISTAT_LEGACY, ISTAT, NOMIS, LSD, NCSI, BBK,
#others
KNOEMA
)
Expand Down
28 changes: 15 additions & 13 deletions tests/testthat/test_Main.R
Original file line number Diff line number Diff line change
Expand Up @@ -78,22 +78,24 @@ test_that("readSDMX - SDMXDataStructureDefinition (DSD) - 2.0",{
expect_is(dsd@datastructures, "SDMXDataStructures")
})

test_that("readSDMX - Catch 400 bad request", {
test_that("readSDMX - Catch 404 bad request", {
testthat::skip_on_travis()
testthat::skip_on_cran()
expect_error(
sdmx <- readSDMX(providerId = "KNOEMA", resource = "data", flowRef = "bad_ref")
sdmx <- readSDMX(providerId = "OECD", resource = "data", flowRef = "bad_ref"),
"HTTP request failed with status: 404"
)
})

test_that("readSDMX - Catch good request that fails for other reason (bad proxy)", {
testthat::skip_on_travis()
testthat::skip_on_cran()
old_opts <- options()
options(RCurlOptions = list("proxy" = "bad_proxy"))

expect_error(
sdmx <- readSDMX(providerId = "KNOEMA", resource = "data", flowRef = "SADG2015")
)
options(old_opts)
})
# Knoema is failing with 502 regardless of proxy settings
#test_that("readSDMX - Catch good request that fails for other reason (bad proxy)", {
# testthat::skip_on_travis()
# testthat::skip_on_cran()
# old_opts <- options()
# options(RCurlOptions = list("proxy" = "bad_proxy"))
#
# expect_error(
# sdmx <- readSDMX(providerId = "KNOEMA", resource = "data", flowRef = "SADG2015")
# )
# options(old_opts)
#})
28 changes: 2 additions & 26 deletions tests/testthat/test_Main_Helpers.R
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ test_that("Main helpers arguments",{
expect_error(readSDMX(providerId = providerId2, resource = "dataflow"), "No provider with identifier IMF!")

#wrong request
expect_error(readSDMX(providerId = "KNOEMA", resource = "data", flowRef = "SADG2015-WRONG"),
"HTTP request failed with status: 400 ")
expect_error(readSDMX(providerId = "OECD", resource = "data", flowRef = "SADG2015-WRONG"))

})

Expand Down Expand Up @@ -192,7 +191,7 @@ test_that("OECD - data",{
sdmx <- readSDMX(providerId = "OECD", resource = "data", flowRef = "DSD_PRICES@DF_PRICES_N_CP01",
key = list("GRC", NULL, NULL, NULL, NULL, NULL, NULL, NULL), start = 2020, end = 2020)
if(!is.null(sdmx)){
expect_is(sdmx, "SDMXMessageGroup")
expect_is(sdmx, "SDMXGenericData")
}
})

Expand Down Expand Up @@ -704,29 +703,6 @@ test_that("NCSI - datastructure",{
# }
#})

#STAT_E (Estonia)
#-------------

#-> datastructure
test_that("STAT_EE - datastructure",{
testthat::skip_on_cran()
sdmx <- readSDMX(providerId = "STAT_EE", resource = "datastructure", resourceId = "KK11")
if(!is.null(sdmx)){
expect_is(sdmx, "SDMXDataStructureDefinition")
}
})

#-> data
test_that("STAT_EE - data",{
testthat::skip_on_cran()
sdmx <- readSDMX(providerId = "STAT_EE", resource = "data",
flowRef = "KK11", key = "all", key.mode = "SDMX",
start = "2015", end = "2015")
if(!is.null(sdmx)){
expect_is(sdmx, "SDMXMessageGroup")
}
})


#BBK (Bundesbank)
#-------------
Expand Down

0 comments on commit 101f026

Please sign in to comment.