Skip to content

Commit

Permalink
fix styling in tests #5
Browse files Browse the repository at this point in the history
  • Loading branch information
sckott committed Jan 26, 2024
1 parent afa036c commit 3ea7124
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 18 deletions.
30 changes: 20 additions & 10 deletions tests/testthat/test-proof_authenticate.R
Original file line number Diff line number Diff line change
@@ -1,29 +1,39 @@
test_that("proof_authenticate - error behavior", {
# errors if no username supplied
expect_error(proof_authenticate(),
'"username" is missing')
expect_error(
proof_authenticate(),
'"username" is missing'
)

# errors if no password supplied
expect_error(proof_authenticate(username = "apple"),
'"password" is missing')
expect_error(
proof_authenticate(username = "apple"),
'"password" is missing'
)

# username should be character
expect_error(proof_authenticate(5),
'username must be of class character')
expect_error(
proof_authenticate(5),
"username must be of class character"
)

# password should be character
expect_error(proof_authenticate(username = "apple", password = 5),
'password must be of class character')
expect_error(
proof_authenticate(username = "apple", password = 5),
"password must be of class character"
)
})

test_that("proof_start - success", {
stub_registry_clear()
stub_request("post", make_url("authenticate")) %>%
to_return(
body = jsonlite::toJSON(
response_authenticate_success, auto_unbox = TRUE),
response_authenticate_success,
auto_unbox = TRUE
),
status = 200L,
headers = list('Content-type' = "application/json")
headers = list("Content-type" = "application/json")
)
stub_registry()

Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-proof_cancel.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ test_that("proof_cancel - success", {
to_return(
body = jsonlite::toJSON(response_cancel_success, auto_unbox = TRUE),
status = 200L,
headers = list('Content-type' = "application/json")
headers = list("Content-type" = "application/json")
)
stub_registry()

Expand All @@ -28,7 +28,7 @@ test_that("proof_cancel - not running, can not cancel", {
to_return(
body = jsonlite::toJSON(response_cancel_conflict, auto_unbox = TRUE),
status = 409L,
headers = list('Content-type' = "application/json")
headers = list("Content-type" = "application/json")
)

enable(quiet = TRUE)
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-proof_start.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ test_that("proof_start - success", {
to_return(
body = jsonlite::toJSON(response_start_success, auto_unbox = TRUE),
status = 200L,
headers = list('Content-type' = "application/json")
headers = list("Content-type" = "application/json")
)

enable(quiet = TRUE)
Expand All @@ -26,7 +26,7 @@ test_that("proof_start - already running", {
to_return(
body = jsonlite::toJSON(response_start_conflict, auto_unbox = TRUE),
status = 409L,
headers = list('Content-type' = "application/json")
headers = list("Content-type" = "application/json")
)

enable(quiet = TRUE)
Expand Down
12 changes: 8 additions & 4 deletions tests/testthat/test-proof_status.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ test_that("proof_status - server IS running", {
stub_request("get", make_url("cromwell-server")) %>%
to_return(
body = jsonlite::toJSON(
response_status_running, auto_unbox = TRUE, null = "null"),
response_status_running,
auto_unbox = TRUE, null = "null"
),
status = 200L,
headers = list('Content-type' = "application/json")
headers = list("Content-type" = "application/json")
)

enable(quiet = TRUE)
Expand All @@ -31,9 +33,11 @@ test_that("proof_status - server IS NOT running", {
stub_request("get", make_url("cromwell-server")) %>%
to_return(
body = jsonlite::toJSON(
response_status_not_running, auto_unbox = TRUE, null = "null"),
response_status_not_running,
auto_unbox = TRUE, null = "null"
),
status = 200L,
headers = list('Content-type' = "application/json")
headers = list("Content-type" = "application/json")
)

enable(quiet = TRUE)
Expand Down

0 comments on commit 3ea7124

Please sign in to comment.