Skip to content

Commit f306c0f

Browse files
Test fixes 8
1 parent c4a874a commit f306c0f

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

tmcrstudioaddin/tests/testthat/testHTTPQueries.R

+10-2
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@ httptest::with_mock_API({
6565
file.remove(credentials_path)
6666
}
6767
})
68+
withProgress_mocksi <- function(message, value, expr) {
69+
cat("Message:", message)
70+
return(expr)
71+
}
6872

6973
test_that("organizations are fetched from the server", {
7074
credentials_path <- paste(get_tmcr_directory(),
@@ -74,8 +78,12 @@ httptest::with_mock_API({
7478
}
7579

7680
# authenticate("rtest", "asdasdasd", "https://tmc.mooc.fi")
77-
login("a", "b", "c", "d", "tmc.mooc.fi")
78-
organizations <- tmcrstudioaddin::get_all_organizations()
81+
credentials_1 <- login("a", "b", "c", "d", "tmc.mooc.fi")
82+
credentials_1$serverAddress <- "tmc.mooc.fi"
83+
84+
stub(get_all_organizations, "shiny::withProgress", withProgress_mocksi)
85+
stub(get_all_organizations, "shiny::setProgress", "")
86+
organizations <- get_all_organizations(credentials = credentials_1)
7987

8088
expect_true(length(organizations$name) > 0)
8189

0 commit comments

Comments
 (0)