-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
13 changed files
with
275 additions
and
440 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,25 @@ | ||
|
||
# setup a new environment to store error messages, etc. | ||
soilDB.env <- new.env(hash=TRUE, parent = parent.frame()) | ||
|
||
# safely register some options at package load time | ||
.onLoad <- function(libname, pkgname) { | ||
|
||
## TODO: normalize these option names | ||
# set to FALSE at CRAN submission time: do not test APIs, this protects from API failures | ||
# set to TRUE for testing non-NASIS components on machines that don't have local ODBC connection setup | ||
options(.soilDB_testNetworkFunctions=TRUE) | ||
|
||
# function verbosity | ||
options(soilDB.verbose=FALSE) | ||
|
||
# set default local nasis authentication | ||
options(soilDB.NASIS.credentials="DSN=nasis_local;UID=NasisSqlRO;PWD=nasisRe@d0n1y") | ||
|
||
# update according to win 7 or 10 | ||
si <- Sys.info() | ||
if( grepl('windows', si['sysname'], ignore.case = TRUE) & grepl('8|10', si['release'], ignore.case = TRUE) ) { | ||
options(soilDB.NASIS.credentials="DSN=nasis_local;UID=NasisSqlRO;PWD=nasisRe@d0n1y365") | ||
} | ||
} | ||
|
||
|
||
|
||
|
||
# setup a new environment to store error messages, etc. | ||
soilDB.env <- new.env(hash=TRUE, parent = parent.frame()) | ||
|
||
# safely register some options at package load time | ||
.onLoad <- function(libname, pkgname) { | ||
|
||
# deprecated: soilDB 2.5.9 CRAN release | ||
options(.soilDB_testNetworkFunctions=TRUE) | ||
|
||
# function verbosity | ||
options(soilDB.verbose=FALSE) | ||
|
||
# set default local nasis authentication | ||
options(soilDB.NASIS.credentials="DSN=nasis_local;UID=NasisSqlRO;PWD=nasisRe@d0n1y") | ||
|
||
# update according to win 7 or 10 | ||
si <- Sys.info() | ||
if( grepl('windows', si['sysname'], ignore.case = TRUE) & grepl('8|10', si['release'], ignore.case = TRUE) ) { | ||
options(soilDB.NASIS.credentials="DSN=nasis_local;UID=NasisSqlRO;PWD=nasisRe@d0n1y365") | ||
} | ||
} | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,30 @@ | ||
context("OSDquery() -- requires internet connection") | ||
|
||
test_that("OSDquery() works", { | ||
|
||
skip_if_offline() | ||
|
||
# hack for in-house testing only | ||
# WWW services aren't always available and will cause CRAN to drop our package if tests fail | ||
if( ! getOption('.soilDB_testNetworkFunctions') ) { | ||
skip("in-house testing only") | ||
} | ||
|
||
|
||
skip_on_cran() | ||
|
||
# a message is printed and NULL returned when no results | ||
res <- suppressMessages(OSDquery(geog_assoc_soils = 'pardee')) | ||
|
||
# standard request | ||
expect_true(inherits(res, 'data.frame')) | ||
|
||
}) | ||
|
||
|
||
test_that("OSDquery() returns NULL with bogus query", { | ||
|
||
skip_if_offline() | ||
|
||
# hack for in-house testing only | ||
# WWW services aren't always available and will cause CRAN to drop our package if tests fail | ||
if( ! getOption('.soilDB_testNetworkFunctions') ) { | ||
skip("in-house testing only") | ||
} | ||
|
||
|
||
skip_on_cran() | ||
|
||
# a message is printed and NULL returned when no results | ||
res <- suppressMessages(OSDquery(geog_assoc_soils = 'XXX')) | ||
expect_null(res) | ||
|
||
}) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.