parse_setup_test: Set up a testing environment with a separate Parse...

Description Usage Arguments Details Examples

Description

This changes Parse's application to a separate application that can be used for testing, then deletes all objects that you request within it. To use this, set up three system variables: PARSE_APPLICATION_ID_TEST, PARSE_API_KEY_TEST, and PARSE_MASTER_KEY_TEST. These should point somewhere besides your production application. If requested, it will leave the test in the master key state, and can back up the environment variables so that the parse_restore_state function will return them.

Usage

1
2
parse_setup_test(to_remove = NULL, master = FALSE, backup = TRUE,
  error = TRUE, message = TRUE)

Arguments

to_remove

a list of class names of objects to be cleared from the test environment

master

whether to leave the master key set

backup

whether to back environment variables up (be careful to set this as FALSE if you are calling this a second time)

error

whether to throw an error if the environment variables aren't set

message

whether to display an message if the environment variables aren't set

Details

error is set to TRUE by default to ensure you don't try to set up a test environment, fail, and run tests on your production database. If you set error = TRUE, be sure you put all your tests in an if statement.

Examples

1
2
3
4
5
6
7
## Not run: 
if (parse_setup_test(error = FALSE)) {
    # run some tests, then
    parse_restore_state()
}

## End(Not run)

dgrtwo/rparse documentation built on May 15, 2019, 7:28 a.m.