Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bumping lifecycle #105

Merged
merged 6 commits into from
Feb 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions R/AutoReportFuns.R
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ filterAutoRep <- function(data, by, pass) {
#' @export

selectByReg <- function(config, reg) {
lifecycle::deprecate_warn(
lifecycle::deprecate_stop(
"1.12.0", "selectByReg()", "filterAutoRep()"
)
if (length(config) == 0) {
Expand Down Expand Up @@ -356,7 +356,7 @@ selectByReg <- function(config, reg) {
#' @export

selectByType <- function(config, type) {
lifecycle::deprecate_warn(
lifecycle::deprecate_stop(
"1.12.0", "selectByType()", "filterAutoRep()"
)
if (length(config) == 0) {
Expand Down Expand Up @@ -384,7 +384,7 @@ selectByType <- function(config, type) {
#' @export

selectByOwner <- function(config, owner) {
lifecycle::deprecate_warn(
lifecycle::deprecate_stop(
"1.12.0", "selectByOwner()", "filterAutoRep()"
)
if (length(config) == 0) {
Expand Down Expand Up @@ -412,7 +412,7 @@ selectByOwner <- function(config, owner) {
#' @export

selectByOrganization <- function(config, organization) {
lifecycle::deprecate_warn(
lifecycle::deprecate_stop(
"1.12.0", "selectByOrganization()", "filterAutoRep()"
)
if (length(config) == 0) {
Expand Down Expand Up @@ -885,7 +885,7 @@ makeAutoReportTab <- function(session, namespace = character(),
#' @export

makeUserSubscriptionTab <- function(session, mapOrgId = NULL) {
lifecycle::deprecate_warn(
lifecycle::deprecate_stop(
"1.12.0", "rapbase::makeUserSubscriptionTab()",
"rapbase::makeAutoReportTab()"
)
Expand Down Expand Up @@ -956,7 +956,7 @@ NULL
#' @rdname makeUserSubscriptionTabV2
#' @export
makeUserSubscriptionTab_v2 <- function(session, map_resh_name = NULL) {
lifecycle::deprecate_warn(
lifecycle::deprecate_stop(
"1.12.0", "rapbase::makeUserSubscriptionTab_v2()",
"rapbase::makeUserDispatchmentTab()",
details = paste(
Expand Down Expand Up @@ -1032,7 +1032,7 @@ makeUserSubscriptionTab_v2 <- function(session, map_resh_name = NULL) {
#' @rdname makeUserSubscriptionTabV2
#' @export
makeUserSubscriptionTabV2 <- function(session, map_resh_name = NULL) {
lifecycle::deprecate_warn(
lifecycle::deprecate_stop(
"1.12.0", "rapbase::makeUserSubscriptionTabV2()",
"rapbase::makeUserDispatchmentTab()",
details = paste(
Expand Down
2 changes: 1 addition & 1 deletion R/GetShinyUserGroups.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@


getShinyUserGroups <- function(shinySession, testCase = FALSE) {
lifecycle::deprecate_warn(
lifecycle::deprecate_stop(
"1.10.0", "rapbase::GetShinyUserGroups()",
"rapbase::getUserGroups()"
)
Expand Down
2 changes: 1 addition & 1 deletion R/GetShinyUserName.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@


getShinyUserName <- function(shinySession, testCase = FALSE) {
lifecycle::deprecate_warn(
lifecycle::deprecate_stop(
"1.10.0", "rapbase::GetShinyUserName()",
"rapbase::getUserName()"
)
Expand Down
2 changes: 1 addition & 1 deletion R/GetShinyUserReshId.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@


getShinyUserReshId <- function(shinySession, testCase = FALSE) {
lifecycle::deprecate_warn(
lifecycle::deprecate_stop(
"1.10.0", "rapbase::GetShinyUserReshId()",
"rapbase::getUserReshId()"
)
Expand Down
2 changes: 1 addition & 1 deletion R/GetShinyUserRole.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@


getShinyUserRole <- function(shinySession, testCase = FALSE) {
lifecycle::deprecate_warn(
lifecycle::deprecate_stop(
"1.10.0", "rapbase::GetShinyUserRole()",
"rapbase::getUserRole()"
)
Expand Down
4 changes: 2 additions & 2 deletions R/LoadRegData.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ NULL
#' @rdname loadRegData
#' @export
LoadRegData <- function(registryName, query, dbType = "mysql") {
lifecycle::deprecate_warn(
lifecycle::deprecate_stop(
"1.12.0", "rapbase::LoadRegData()",
"rapbase::loadRegData()"
)
Expand Down Expand Up @@ -71,4 +71,4 @@ describeRegistryDb <- function(registryName, tabs = c()) {
}

desc
}
}
2 changes: 1 addition & 1 deletion R/MakeMessage.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ NULL
#' @export
MakeMessage <- function(story, message, newLine = TRUE, newPara = FALSE,
timeStamp = TRUE) {
lifecycle::deprecate_warn("1.12.0", "rapbase::MakeMessage()",
lifecycle::deprecate_stop("1.12.0", "rapbase::MakeMessage()",
"rapbase::makeMessage()",
details = "Purely camelCase conformity :-)"
)
Expand Down
2 changes: 1 addition & 1 deletion R/ShinySessionInfo.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#' @export

shinySessionInfo <- function(shinySession, entity, testCase = FALSE) {
lifecycle::deprecate_warn(
lifecycle::deprecate_stop(
"1.10.0", "rapbase::shinySessionInfo()",
"rapbase::userInfo()"
)
Expand Down
3 changes: 3 additions & 0 deletions inst/template/default.latex
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
\usepackage{booktabs}
\usepackage[24hr]{datetime}
\usepackage{xcolor}
%\usepackage[immediate]{silence}
%\WarningFilter[temp]{latex}{Command} % silence the warning
\usepackage{sectsty}
%\DeactivateWarningFilters[temp] % So nothing unrelated gets silenced
\usepackage{marginnote}
\usepackage[utf8]{inputenc}
\usepackage[norsk]{babel}
Expand Down
45 changes: 0 additions & 45 deletions tests/testthat/test-auto-report-functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -38,23 +38,6 @@ test_that("auto reports can be filterd by valid entity on empty input", {
expect_true(is.list(filterAutoRep(list(), "package", c("test"))))
})

test_that("Config data can be filterd by registry on empty input", {
expect_true(is.list(selectByReg(list(), "test")))
})

test_that("config data can be filterd by type on empty input", {
expect_true(is.list(selectByType(list(), "test")))
})

test_that("Config data can be filterd by owner on empty input", {
expect_true(is.list(selectByOwner(list(), "test")))
})

test_that("Config data can be filtered by organization on empty input", {
expect_true(is.list(selectByOrganization(list(), "test")))
})


test_that("Auto report can be created as dry run (stout)", {
res <- createAutoReport(synopsis, package, type, fun, paramNames,
paramValues, owner, ownerName, email, organization,
Expand All @@ -77,22 +60,6 @@ Sys.setenv(R_RAP_INSTANCE = "")

rd <- readAutoReportData()

test_that("Auto reports can be filtered by registry/package", {
expect_true(is.list(selectByReg(rd, package)))
})

test_that("Auto reports can be filtered by type", {
expect_true(is.list(selectByType(rd, type)))
})

test_that("Auto reports can be filtered by owner", {
expect_true(is.list(selectByOwner(rd, owner)))
})

test_that("Auto reports can be filtered by organization", {
expect_true(is.list(selectByOrganization(rd, organization)))
})

test_that("Registries/packages can be extracted from config", {
expect_true(is.vector(getRegs(rd)))
})
Expand Down Expand Up @@ -190,18 +157,6 @@ test_that("a registry dispatchment table (for shiny) can be made", {
))
})

test_that("A per-user subscription table (for shiny) can be made", {
expect_true(is.list(makeUserSubscriptionTab(session = shinySession)))
})

test_that("per user subscription table provides warning for deprecated v2", {
expect_warning(makeUserSubscriptionTab_v2(session = shinySession))
})

test_that("per-user subscription table for v2 also provides dep warning", {
expect_warning(makeUserSubscriptionTabV2(session = shinySession))
})

test_that("Writing conf with undefined R_RAP_CONFIG_PATH provides an error", {
expect_error(writeAutoReportData(config = NULL))
})
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-dbConnection.R
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ test_that("A mysql db connection and driver can be provided and cleaned", {
expect_false(RMariaDB::dbIsValid(l$con))
})

test_that("Deprecated interface provides a warning", {
test_that("Deprecated defunct interface provides an error", {
checkDb()
query <- "SELECT * FROM testTable"
expect_warning(LoadRegData(regName, query, dbType = "mysql"))
expect_error(LoadRegData(regName, query, dbType = "mysql"))
})

test_that("Data can be queried from (MySQL) db", {
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-message.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
context("Generate messages")

test_that("deprecated function provides warning", {
expect_warning(MakeMessage("test", "test"))
test_that("deprecated defunct function provides warning", {
expect_error(MakeMessage("test", "test"))
})

test_that("Function return one element atomic char vector", {
Expand Down
56 changes: 5 additions & 51 deletions tests/testthat/test-shinySessionInfo.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,62 +19,16 @@ attr(shinySession, "class") <- "ShinySession"

# now deprecated, main function
test_that("shinySessionInfo() is deprecated", {
expect_warning(shinySessionInfo(
expect_error(shinySessionInfo(
shinySession = shinySession,
entity = "user"
))
})

# now deprecated, wrapper functions
test_that("wrapper funs are deprecated", {
expect_warning(getShinyUserName(shinySession),
class = "lifecycle_warning_deprecated"
)
expect_warning(getShinyUserGroups(shinySession),
class = "lifecycle_warning_deprecated"
)
expect_warning(getShinyUserReshId(shinySession),
class = "lifecycle_warning_deprecated"
)
expect_warning(getShinyUserRole(shinySession),
class = "lifecycle_warning_deprecated"
)
})

# now deprecated, but should still work
withr::local_options(list(lifecycle_verbosity = "quiet"))

test_that("Default is to assume real data scenario", {
expect_equal(getShinyUserName(shinySession), "user1")
expect_equal(getShinyUserGroups(shinySession), "group1,group2")
expect_equal(getShinyUserReshId(shinySession), "789012")
expect_equal(getShinyUserRole(shinySession), "LC")
})

test_that("Also working for test cases", {
expect_equal(
getShinyUserName(shinySessionTest, testCase = TRUE),
"testUser1"
)
expect_equal(
getShinyUserGroups(shinySessionTest, testCase = TRUE),
"testGroup1,testGroup2"
)
expect_equal(
getShinyUserReshId(shinySessionTest, testCase = TRUE),
"123456"
)
expect_equal(getShinyUserRole(shinySessionTest, testCase = TRUE), "LU")
})

test_that("Function handle errors", {
expect_error(shinySessionInfo(shinySession = NULL, entity = "user"))
expect_error(shinySessionInfo(
shinySession = shinySessionWrongClass,
entity = "user"
))
expect_error(shinySessionInfo(
shinySession = shinySession,
entity = ""
))
expect_error(getShinyUserName(shinySession))
expect_error(getShinyUserGroups(shinySession))
expect_error(getShinyUserReshId(shinySession))
expect_error(getShinyUserRole(shinySession))
})