test_that("account_login returns expected structure when rvest calls succeed (stubbed)", { testthat::with_mocked_bindings( session = function(url) structure(list(url = url), class = "session"), html_form = function(x) list(list()), # one empty form html_form_set = function(form, login, pwd) form, # return the form unchanged session_submit = function(x, form, submit, add_headers) { list(url = "https://data.lobsterdata.com/requestdata.php") }, add_headers = function(...) NULL, .env = asNamespace("lobsteR"), { acct <- account_login("fake@example.com", "pw") expect_type(acct, "list") expect_true(is.logical(acct$valid)) expect_true(acct$valid) expect_named(acct, c("valid", "session", "submission")) } ) }) test_that("account_archive parses archive table and filters zero-size rows", { testthat::skip_if_not_installed("xml2") html_fixture <- '
| Name | Download | Start Date | End Date | Level | Size | Delete |
|---|---|---|---|---|---|---|
| file0 | SYM0 | 2020-01-01 | 2020-01-01 | 1 | 0 | del |
| file1 | AAPL | 2020-01-02 | 2020-01-02 | 1 | 100 | del |