Skip to content

Commit

Permalink
simplify test
Browse files Browse the repository at this point in the history
  • Loading branch information
hillalex committed Sep 6, 2024
1 parent c11b038 commit c53f343
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions tests/testthat/test-session.R
Original file line number Diff line number Diff line change
Expand Up @@ -191,27 +191,19 @@ test_that("inactive uploads are purged", {
cookie = new_cookie)
res <- router$call(request)
expect_equal(res$status, 200)
expect_true(dir.exists("uploads/5678"))

# expect old session to have been cleaned up
expect_false(dir.exists("uploads/1234"))

Sys.sleep(1)

# expect both sessions to have expired from cache
expect_equal(length(cache$keys()), 0)

get_request_with_cookie <- make_req("GET",
get_request_with_new_cookie <- make_req("GET",
"/dataset/testdataset/trace/ab/",
HTTP_COOKIE = new_cookie)

res <- router$call(get_request_with_cookie)
res <- router$call(get_request_with_new_cookie)
expect_equal(res$status, 200)

# expect active session to have been re-added to cache
expect_equal(cache$get("5678"), TRUE)
expect_equal(length(cache$keys()), 1)

get_request_with_old_cookie <- make_req("GET",
"/dataset/testdataset/trace/ab/",
HTTP_COOKIE = old_cookie)
Expand Down

0 comments on commit c53f343

Please sign in to comment.