Skip to content

Mock wrapper  #98

Description

@jonthegeek

Create a wrapper around httptest2::with_mock_dir() and a replacement for httptest2:::mock_request() to add the request to the mocked response. Also add a ticket to beekeeper to use this wrapper in tests. Unfortunately, since mock_request() isn't exported, I'm not sure yet what's viable here. with_mock_dir() calls with_mock_api() which calls use_mock_api() (sets options(httr2_mock = mock_request)) and on.exit(stop_mocking()) (sets options(httr2_mock = NULL)). We can't change the option in-between when with_mock_api() sets it and when it calls eval.parent(expr), so I think we'll need to create our own variation on with_mock_api() (and with_moc_dir() to call ours), and then our own mock function. We could wrap httptest2's mock_request() if it were exported, but, unfortunately, it isn't. That's at least one avenue to pursue.

Metadata

Metadata

Assignees

Labels

qcthat-nocov{qcthat}: Do not include in issue-test coverage reports

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions