with_mocked_connect_responses {connectcreds} | R Documentation |
Mock responses from the Posit Connect server
Description
These functions can be used to temporarily mock responses from the Connect server, which is useful for writing tests that verify the behaviour of viewer-based credentials.
Usage
with_mocked_connect_responses(
code,
mock = NULL,
token = NULL,
error = FALSE,
env = caller_env()
)
local_mocked_connect_responses(
mock = NULL,
token = NULL,
error = FALSE,
env = caller_env()
)
Arguments
code |
Code to execute in the temporary environment. |
mock |
A function, a list, or
|
token |
When not |
error |
When |
env |
Environment to use for scoping changes. |
Value
with_mocked_connect_responses()
returns the result of evaluating
code
.
Examples
with_mocked_connect_responses(
connect_viewer_token(),
token = "test"
)