A Test Environment for Database Requests
Get the current redactor
Get the type of an SQL statement
Make a (short) hash from a string
Extract a hash from a (result) object
make a mock path
Methods for interacting with DB mocks instead of an actual database
Capture and record database transactions and save them as mocks
Check for dittodb environment path
Check if a package is installed
Clean a statement string
Switch illegal characters for legal ones
Get the dittodb debug level and evaluate if it is above a level
an environment for dittodb storing state
Driver-specific mock classes
Detect if a specific SQL statement is sent
Get the dbname
from a connection call
Run DBI queries against a mocked database
Set an alternate directory for mock API fixtures
An SQLite connection to a subset of nycflights13
Create a standardised database for testing
Create an in-memory SQLite database for testing
Redact columns from a dataframe with the default redactors
Sanitize Table id
Make a data.frame with pre-serialized integer64 columns
Set dittodb
's debug level
Use dittodb
in your tests
Run the DBI queries in an alternate mock directory
Testing and documenting code that communicates with remote databases can be painful. Although the interaction with R is usually relatively simple (e.g. data(frames) passed to and from a database), because they rely on a separate service and the data there, testing them can be difficult to set up, unsustainable in a continuous integration environment, or impossible without replicating an entire production cluster. This package addresses that by allowing you to make recordings from your database interactions and then play them back while testing (or in other contexts) all without needing to spin up or have access to the database your code would typically connect to.
Useful links