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 09555d2 commit 78ddd1d
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 45 deletions.
8 changes: 0 additions & 8 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
# 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
see when running locally (#930).

* Deploying from an renv project includes the `renv.lock` in the bundle. A
manifest created for an renv project references the `renv.lock` in the
`manifest.json`. (#926)
Expand Down
70 changes: 33 additions & 37 deletions tests/testthat/test-deploymentTarget.R
Original file line number Diff line number Diff line change
Expand Up @@ -187,46 +187,42 @@ test_that("default title is the empty string", {
})

test_that("can find existing application on server & use it", {
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)
}
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)
})

test_that("can find existing application on server & not use it", {
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)
}
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)
})

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

0 comments on commit 78ddd1d

Please sign in to comment.