Skip to content

Commit

Permalink
add tests for shinyapps.io deploymentTarget and NEWS.md entry for 932…
Browse files Browse the repository at this point in the history
… bugfix
  • Loading branch information
mslynch committed Jul 26, 2023
1 parent 2a5bfb6 commit 09555d2
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 33 deletions.
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# rsconnect (development version)

* Fixed redeployments to shinyapps.io where `appName` is provided, but no local
record of the deployment exists. (#932)

* `deployApp()` and `writeManifest()` now error if your library and `renv.lock`
are out-of-sync. Previously it always used what was defined in the `renv.lock`
but that was (a) slow and (b) could lead to different results than what you
Expand Down
70 changes: 37 additions & 33 deletions tests/testthat/test-deploymentTarget.R
Original file line number Diff line number Diff line change
Expand Up @@ -187,42 +187,46 @@ test_that("default title is the empty string", {
})

test_that("can find existing application on server & use it", {
local_temp_config()
addTestServer()
addTestAccount("ron")
local_mocked_bindings(
applications = function(...) data.frame(
name = "my_app",
id = 123,
url = "http://example.com/test",
stringsAsFactors = FALSE
),
shouldUpdateApp = function(...) TRUE
)

app_dir <- withr::local_tempdir()
target <- deploymentTarget(app_dir, appName = "my_app")
expect_equal(target$appId, 123)
for (server in c("example.com", "shinyapps.io")) {
local_temp_config()
addTestServer()
addTestAccount("ron", server = server)
local_mocked_bindings(
applications = function(...) data.frame(
name = "my_app",
id = 123,
url = "http://example.com/test",
stringsAsFactors = FALSE
),
shouldUpdateApp = function(...) TRUE
)

app_dir <- withr::local_tempdir()
target <- deploymentTarget(app_dir, appName = "my_app", server = server)
expect_equal(target$appId, 123)
}
})

test_that("can find existing application on server & not use it", {
local_temp_config()
addTestServer()
addTestAccount("ron")
local_mocked_bindings(
applications = function(...) data.frame(
name = "my_app",
id = 123,
url = "http://example.com/test",
stringsAsFactors = FALSE
),
shouldUpdateApp = function(...) FALSE
)

app_dir <- withr::local_tempdir()
target <- deploymentTarget(app_dir, appName = "my_app")
expect_equal(target$appName, "my_app-1")
expect_equal(target$appId, NULL)
for (server in c("example.com", "shinyapps.io")) {
local_temp_config()
addTestServer()
addTestAccount("ron", server = server)
local_mocked_bindings(
applications = function(...) data.frame(
name = "my_app",
id = 123,
url = "http://example.com/test",
stringsAsFactors = FALSE
),
shouldUpdateApp = function(...) FALSE
)

app_dir <- withr::local_tempdir()
target <- deploymentTarget(app_dir, appName = "my_app", server = server)
expect_equal(target$appName, "my_app-1")
expect_equal(target$appId, NULL)
}
})

# defaultAppName ----------------------------------------------------------
Expand Down

0 comments on commit 09555d2

Please sign in to comment.