tests/README.md

Testing Framework

This uses testthat for testing; maintainers and contributors should read these notes carefully. This package is largely an API package, and testing a real API is tricky. The implementation here takes some ideas from framework for APIs/secrets described here and here. Basically, the above suggests:

  1. We encrypt the appropriate SYNAPSE_AUTH_TOKEN secret with PKG_PWD as key. Commit the encrypted secret as e.g. ins/secret.rds. See https://github.com/r-lib/gargle/tree/main/inst/secret.

  2. Then depending on the test environment: a) For testing locally, store in .Renviron the variable PKG_PWD used to decrypt SYNAPSE_AUTH_TOKEN. b) For testing with Github CI, store PKG_PWD as secret in the test environment.

  3. Only if PKG_PWD is accessible to get decrypted SYNAPSE_AUTH_TOKEN are tests run.

However, there are some limitations to this approach; see especially the first reference. To make this easier, the main adaptations are:

Known issues:



nf-osi/nfportalutils documentation built on Feb. 26, 2024, 1:05 p.m.