From 9f9f0deccf9517f6edfa0eea3a0a056790a8cd65 Mon Sep 17 00:00:00 2001 From: Sam Albers Date: Tue, 12 Dec 2023 11:36:53 -0800 Subject: [PATCH] try ping again --- .../localhost/api/{users.R => ping.R} | 2 +- tests/testthat/test-session.R | 22 +++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) rename tests/testthat/not-logged-in/localhost/api/{users.R => ping.R} (95%) diff --git a/tests/testthat/not-logged-in/localhost/api/users.R b/tests/testthat/not-logged-in/localhost/api/ping.R similarity index 95% rename from tests/testthat/not-logged-in/localhost/api/users.R rename to tests/testthat/not-logged-in/localhost/api/ping.R index f3e1bc1..da602eb 100644 --- a/tests/testthat/not-logged-in/localhost/api/users.R +++ b/tests/testthat/not-logged-in/localhost/api/ping.R @@ -1,4 +1,4 @@ -structure(list(method = "GET", url = "https://conbench.ursa.dev:443/api/users/", +structure(list(method = "GET", url = "https://conbench.ursa.dev:443/api/ping/", status_code = 401L, headers = structure(list(date = "Fri, 18 Feb 2022 23:11:54 GMT", `content-type` = "application/json", `content-length` = "37", server = "gunicorn"), class = "httr2_headers"), body = charToRaw("{\"code\": 401, \"name\": \"Unauthorized\"}")), class = "httr2_response") diff --git a/tests/testthat/test-session.R b/tests/testthat/test-session.R index fe49413..f9d7cdf 100644 --- a/tests/testthat/test-session.R +++ b/tests/testthat/test-session.R @@ -31,17 +31,17 @@ test_that("get_config errors when it has no environment variables",{ ) }) -# with_mock_dir(test_path("not-logged-in"), { -# test_that("Can log in", { -# expect_null(.conbench_session$cookie) -# resp <- request("http://localhost/api") |> -# req_url_path_append("users") |> -# conbench_perform() -# # This is still a 401 becuase httptest2 only has one possible response for users -# expect_identical(resp_status(resp), 401L) -# expect_identical(.conbench_session$cookie, "REDACTED") -# }) -# }) +with_mock_dir(test_path("not-logged-in"), { + test_that("Can log in", { + expect_null(.conbench_session$cookie) + resp <- request("http://localhost/api") |> + req_url_path_append("ping") |> + conbench_perform() + # This is still a 401 becuase httptest2 only has one possible response for users + expect_identical(resp_status(resp), 401L) + expect_identical(.conbench_session$cookie, "REDACTED") + }) +}) with_mock_dir(test_path("logged-in"), { test_that("Can log in", {