This test case suggests that there is unhandled validation case for this endpoint:
|
test_that("request with patient that is assigned an arm at entry", { |
|
response <- request(api_url) |> |
|
req_url_path("study", "minimisation_pocock") |> |
|
req_method("POST") |> |
|
req_body_json( |
|
data = list( |
|
identifier = "ABC-X", |
|
name = "Study ABC-X", |
|
method = "var", |
|
p = 0.85, |
|
arms = list( |
|
"placebo" = 1, |
|
"active" = 1 |
|
), |
|
covariates = list( |
|
sex = list( |
|
weight = 1, |
|
levels = c("female", "male") |
|
), |
|
weight = list( |
|
weight = 1, |
|
levels = c("up to 60kg", "61-80 kg", "81 kg or more") |
|
) |
|
) |
|
) |
|
) |> |
|
req_perform() |
|
|
|
response_body <- |
|
response |> |
|
resp_body_json() |
|
|
|
response_current_state <- |
|
tryCatch( |
|
{ |
|
request(api_url) |> |
|
req_url_path("study", response_body$study$id, "patient") |> |
|
req_method("POST") |> |
|
req_body_json( |
|
data = list( |
|
current_state = |
|
tibble::tibble( |
|
"sex" = c("female", "male"), |
|
"weight" = c("61-80 kg", "81 kg or more"), |
|
"arm" = c("placebo", "control") |
|
) |
|
) |
|
) |> |
|
req_perform() |
|
}, |
|
error = function(e) e |
|
) |
|
|
|
testthat::expect_equal( |
|
response_current_state$status, 500, |
|
label = "HTTP status code" |
|
) |
|
}) |
We should always validate input data in a way that will prevent the app from returning Internal Server Errors.
This test case suggests that there is unhandled validation case for this endpoint:
unbiased/tests/testthat/test-E2E-study-minimisation-pocock.R
Lines 169 to 226 in 6cd8b92
We should always validate input data in a way that will prevent the app from returning Internal Server Errors.