context("test-sql_db")
#
# # try and start up testing db
# if (!postgres_present()) {
# system(system.file("exec", "sql-up.sh", package="hisreportr"))
# }
#
# # Allow pause while container spins up
# Sys.sleep(3)
#
# if(postgres_present()) {
# # load SQL test data
# sql_tb_month <- system.file("testdata", "sql_tb_month.rds",
# package = "hisreportr") %>%
# readRDS()
#
# # Write SQL test data to testing db
# write_to_postgres_tester(upload = sql_tb_month)
# }
#
#
# # define skip function
# skip_if_no_db <- function() {
# if (!postgres_present()) {
# skip("Testing PostgreSQL server not running")
# }
# }
#
# test_that("PostgreSQL connection and queries", {
# skip_if_no_db()
#
# raw <- access_postgresql(host = "0.0.0.0",
# username = "postgres",
# password = "pgtest",
# db_name = "postgres",
# report_name = "tb_month")
#
# expect_true(is.list(raw))
# # same number of data frames in list
# expect_equal(length(raw), length(sql_tb_month))
# expect_true(is.data.frame(raw[[1]]))
# expect_true(all(c("patient_id", "starttre", "regimen") %in%
# names(raw[[1]])))
# expect_true(all(c("patient_id", "end_date", "out_regimen", "outcome") %in%
# names(raw[[2]])))
# expect_equal(class(raw[[1]]$starttre), "Date")
# })
#
#
#
#
# # stop testing db if up
# if (postgres_present()) {
# system(system.file("exec", "sql-down.sh", package="hisreportr"))
# }
#
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.