Skip to content

Commit

Permalink
Merge pull request #804 from r-dbi/aj-fix-db-tests-under-workbench
Browse files Browse the repository at this point in the history
Fix Databricks unit tests when running in Workbench
  • Loading branch information
atheriel authored May 17, 2024
2 parents 9cdcfb0 + 65fcf6d commit a220f53
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tests/testthat/test-driver-databricks.R
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ test_that("databricks host validates inputs", {
})

test_that("user agent respects envvar", {
withr::local_envvar(SPARK_CONNECT_USER_AGENT = NULL)
local_mocked_bindings(packageVersion = function(...) "1.0.0")
expect_equal(databricks_user_agent(), "r-odbc/1.0.0")

Expand Down Expand Up @@ -73,7 +74,7 @@ test_that("must supply both uid and pwd", {

test_that("supports PAT in env var", {
withr::local_envvar(DATABRICKS_TOKEN = "abc")
expect_equal(databricks_auth_args()$pwd, "abc")
expect_equal(databricks_auth_args("host")$pwd, "abc")
})

test_that("supports OAuth M2M in env var", {
Expand All @@ -83,7 +84,7 @@ test_that("supports OAuth M2M in env var", {
DATABRICKS_CLIENT_SECRET = "def"
)

auth <- databricks_auth_args()
auth <- databricks_auth_args("host")
expect_equal(auth$auth_client_id, "abc")
expect_equal(auth$auth_client_secret, "def")
})
Expand Down

0 comments on commit a220f53

Please sign in to comment.