tests/testthat/test-login.R

with_mock_dir("../httptest/login", {
    
    test_that("login", {
        
        expect_error(
            epLogin("username"),
            'argument "password" is missing, with no default',
            fixed = TRUE
        )
        
        expect_error(
            epLogin("wrong_user", "wrong_pass"),
            "Authentication failed. Please check your username and password.",
            fixed = TRUE
        )
        
        expect_message(epLogout())
        
        if( is_active ){
            expect_message(
                epLogin(username, password),
                "Hi nature lover, welcome to enviPath!",
                fixed = TRUE
            )
        }
    })
})

Try the enviPathR package in your browser

Any scripts or data that you put into this service are public.

enviPathR documentation built on Oct. 14, 2026, 5:07 p.m.