inst/plumber/test/00_tests.R

library(dplyr)
library(dbplyr)
library(polishedapi)
# run the docker container locally for testing
# $ docker run --rm -p 8080:8080 polished_api

url_ <- "http://localhost:8080"
#url <- "https://api.polished.tech"

schema <- "polished"

test_email <- "andy.merlino@tychobra.com"

app_name_ <- "test_app"

# db connection for interactive queries
db_config <- config::get(file = "inst/plumber/test/config.yml")$db
conn <- tychobratools::db_connect(db_config)

# create a fresh database schema
create_schema(conn)

# add a new account to our newly created schema.
# you must have the "polished_hosted_secret" to create a new account.
polished_hosted_secret <- config::get(file = "inst/plumber/api/config.yml")$polished_hosted_secret

# The account "secret_key" will be returned after a successful `add_account()`
secret_key <- add_account(
  conn,
  email = test_email,
  host_secret = polished_hosted_secret
)

# auth for http methods.  Whis will be sent with every http request to authenticate
# the account sending the request.
auth <- httr::authenticate(
  user = secret_key,
  password = ""
)

source("inst/plumber/test/test_apps.R")

source("inst/plumber/test/test_users.R")
Tychobra/polishedapi documentation built on July 19, 2020, 11:41 p.m.