Skip to content

Commit

Permalink
use loopback in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
RyanJField committed Oct 7, 2024
1 parent a8694a0 commit 9758ab3
Show file tree
Hide file tree
Showing 57 changed files with 57 additions and 57 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
rDataPipeline::fair_init(
name = "Sonia Mitchell",
identifier = "https://orcid.org/0000-0003-1536-2066",
endpoint = "http://localhost:8000/api/")
endpoint = "http://127.0.0.1:8000:8000/api/")
shell: Rscript {0}
- name: Test coverage
env:
Expand Down
2 changes: 1 addition & 1 deletion R/check_dataproduct_exists.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ check_dataproduct_exists <- function(write_dataproduct,
namespace = write_namespace_id),
endpoint = endpoint)

write_namespace_url <- file.path("http://localhost:8000", "api",
write_namespace_url <- file.path("http://127.0.0.1:8000:8000", "api",
"namespace", write_namespace_id)
write_namespace <- get_entity(write_namespace_url)$name

Expand Down
2 changes: 1 addition & 1 deletion R/check_exists.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
check_exists <- function(table,
query) {

output <- httr::GET(paste0("http://localhost:8000/api/", table, ""),
output <- httr::GET(paste0("http://127.0.0.1:8000:8000/api/", table, ""),
query = query)

if (any(names(output) == "status_code")) {
Expand Down
2 changes: 1 addition & 1 deletion R/create_config.R
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ create_config <- function(path,

# Generate run_metadata block
run_metadata <- list(description = description,
local_data_registry_url = "http://localhost:8000/api/",
local_data_registry_url = "http://127.0.0.1:8000:8000/api/",
remote_data_registry_url = "https://data.scrc.uk/api/",
default_input_namespace = input_namespace,
default_output_namespace = output_namespace,
Expand Down
2 changes: 1 addition & 1 deletion R/fair_init.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#'
fair_init <- function(name,
identifier,
endpoint = "http://localhost:8000/api/") {
endpoint = "http://127.0.0.1:8000:8000/api/") {

user_url <- get_url(table = "users",
query = list(username = "admin"),
Expand Down
2 changes: 1 addition & 1 deletion R/fair_run.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#' @export
#'
fair_run <- function(path = "config.yaml",
endpoint = "http://localhost:8000/api/",
endpoint = "http://127.0.0.1:8000:8000/api/",
skip = FALSE) {

# Save names in data store
Expand Down
2 changes: 1 addition & 1 deletion R/get_dataproduct.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
get_dataproduct <- function(data_product,
version,
namespace,
endpoint = "http://localhost:8000/api/") {
endpoint = "http://127.0.0.1:8000:8000/api/") {
# Get provenance URL
namespace_entry <- get_entry("namespace",
list(name = namespace),
Expand Down
2 changes: 1 addition & 1 deletion R/get_entity.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ get_entity <- function(url) {

# Sometimes an error is returned from the local registry:
# "Error in curl::curl_fetch_memory(url, handle = handle) :
# Failed to connect to localhost port 8000: Connection refused"
# Failed to connect to 127.0.0.1:8000 port 8000: Connection refused"
# Repeating the action works eventually...
continue <- TRUE
while (continue) {
Expand Down
2 changes: 1 addition & 1 deletion R/get_entry.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#' @export
#' @family get functions
#'
get_entry <- function(table, query, endpoint = "http://localhost:8000/api/") {
get_entry <- function(table, query, endpoint = "http://127.0.0.1:8000:8000/api/") {

key <- get_token()
h <- c(Authorization = paste("token", key))
Expand Down
2 changes: 1 addition & 1 deletion R/get_existing.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
get_existing <- function(table,
limit_results = TRUE,
detail = "all",
endpoint = "http://localhost:8000/api/") {
endpoint = "http://127.0.0.1:8000:8000/api/") {

if (!check_table_exists(table))
usethis::ui_stop(paste(
Expand Down
2 changes: 1 addition & 1 deletion R/get_fields.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#' @return Returns a \code{data.frame} of fields and their attributes set to
#' "none"
#'
get_fields <- function(table, endpoint = "http://localhost:8000/api/") {
get_fields <- function(table, endpoint = "http://127.0.0.1:8000:8000/api/") {

# Add token to options request header
key <- get_token()
Expand Down
2 changes: 1 addition & 1 deletion R/get_id.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#'
get_id <- function(table,
query = list(),
endpoint = "http://localhost:8000/api/") {
endpoint = "http://127.0.0.1:8000:8000/api/") {

output <- get_entry(table, query, endpoint)

Expand Down
2 changes: 1 addition & 1 deletion R/get_tables.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#' @return a character vector of tables
#' @keywords internal
#'
get_tables <- function(endpoint = "http://localhost:8000/api/") {
get_tables <- function(endpoint = "http://127.0.0.1:8000:8000/api/") {

httr::GET(endpoint) %>%
httr::content(as = "text", encoding = "UTF-8") %>%
Expand Down
2 changes: 1 addition & 1 deletion R/get_url.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#'
get_url <- function(table,
query = list(),
endpoint = "http://localhost:8000/api/") {
endpoint = "http://127.0.0.1:8000:8000/api/") {

output <- get_entry(table = table,
query = query,
Expand Down
2 changes: 1 addition & 1 deletion R/new_author.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#'
new_author <- function(name,
identifier,
endpoint = "http://localhost:8000/api/") {
endpoint = "http://127.0.0.1:8000:8000/api/") {

data <- list()

Expand Down
2 changes: 1 addition & 1 deletion R/new_code_repo_release.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ new_code_repo_release <- function(name,
version,
object_url,
website,
endpoint = "http://localhost:8000/api/") {
endpoint = "http://127.0.0.1:8000:8000/api/") {

data <- list(name = name,
version = version,
Expand Down
2 changes: 1 addition & 1 deletion R/new_code_run.R
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ new_code_run <- function(run_date,
submission_script_url,
inputs_urls = list(),
outputs_urls = list(),
endpoint = "http://localhost:8000/api/") {
endpoint = "http://127.0.0.1:8000:8000/api/") {

data <- list(run_date = run_date,
inputs = inputs_urls,
Expand Down
2 changes: 1 addition & 1 deletion R/new_data_product.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ new_data_product <- function(name,
version,
object_url,
namespace_url,
endpoint = "http://localhost:8000/api/") {
endpoint = "http://127.0.0.1:8000:8000/api/") {

post_data(table = "data_product",
data = list(name = name,
Expand Down
2 changes: 1 addition & 1 deletion R/new_external_object.R
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ new_external_object <- function(doi_or_unique_name,
description,
data_product_url,
original_store_url,
endpoint = "http://localhost:8000/api/") {
endpoint = "http://127.0.0.1:8000:8000/api/") {

data <- list(doi_or_unique_name = doi_or_unique_name,
release_date = release_date,
Expand Down
2 changes: 1 addition & 1 deletion R/new_file_type.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#'
new_file_type <- function(name,
extension,
endpoint = "http://localhost:8000/api/") {
endpoint = "http://127.0.0.1:8000:8000/api/") {

post_data(table = "file_type",
data = list(name = name,
Expand Down
2 changes: 1 addition & 1 deletion R/new_issue.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
new_issue <- function(severity,
description,
component_issues,
endpoint = "http://localhost:8000/api/") {
endpoint = "http://127.0.0.1:8000:8000/api/") {

post_data(table = "issue",
data = list(severity = severity,
Expand Down
2 changes: 1 addition & 1 deletion R/new_keyword.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
new_keyword <- function(object_url,
keyphrase,
identifier,
endpoint = "http://localhost:8000/api/") {
endpoint = "http://127.0.0.1:8000:8000/api/") {

data <- list(object = object_url,
keyphrase = keyphrase)
Expand Down
2 changes: 1 addition & 1 deletion R/new_licence.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#'
new_licence <- function(object_url,
licence_info,
endpoint = "http://localhost:8000/api/") {
endpoint = "http://127.0.0.1:8000:8000/api/") {

post_data(table = "licence",
data = list(object = object_url,
Expand Down
2 changes: 1 addition & 1 deletion R/new_namespace.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
new_namespace <- function(name,
full_name,
website,
endpoint = "http://localhost:8000/api/") {
endpoint = "http://127.0.0.1:8000:8000/api/") {

data <- list(name = name)

Expand Down
2 changes: 1 addition & 1 deletion R/new_object.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ new_object <- function(description,
storage_location_url,
authors_url,
file_type_url,
endpoint = "http://localhost:8000/api/") {
endpoint = "http://127.0.0.1:8000:8000/api/") {

data <- list()

Expand Down
2 changes: 1 addition & 1 deletion R/new_object_component.R
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ new_object_component <- function(object_url,
description,
whole_object = FALSE,
issues_urls,
endpoint = "http://localhost:8000/api/") {
endpoint = "http://127.0.0.1:8000:8000/api/") {

data <- list(object = object_url,
name = name,
Expand Down
2 changes: 1 addition & 1 deletion R/new_quality_controlled.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#' @family new functions
#'
new_quality_controlled <- function(object_url,
endpoint = "http://localhost:8000/api/") {
endpoint = "http://127.0.0.1:8000:8000/api/") {

post_data(table = "quality_controlled",
data = list(object = object_url),
Expand Down
2 changes: 1 addition & 1 deletion R/new_storage_location.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ new_storage_location <- function(path,
hash,
public,
storage_root_url,
endpoint = "http://localhost:8000/api/") {
endpoint = "http://127.0.0.1:8000:8000/api/") {
data <- list(path = path,
hash = hash,
storage_root = storage_root_url)
Expand Down
2 changes: 1 addition & 1 deletion R/new_storage_root.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#'
new_storage_root <- function(root,
local,
endpoint = "http://localhost:8000/api/") {
endpoint = "http://127.0.0.1:8000:8000/api/") {

data <- list(root = root)

Expand Down
2 changes: 1 addition & 1 deletion R/new_user_author.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#'
new_user_author <- function(user_url,
author_url,
endpoint = "http://localhost:8000/api/") {
endpoint = "http://127.0.0.1:8000:8000/api/") {

data <- list(user = user_url,
author = author_url)
Expand Down
2 changes: 1 addition & 1 deletion R/post_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ post_data <- function(table, data, endpoint) {

# Sometimes an error is returned from the local registry:
# "Error in curl::curl_fetch_memory(url, handle = handle) :
# Failed to connect to localhost port 8000: Connection refused"
# Failed to connect to 127.0.0.1:8000 port 8000: Connection refused"
# Repeating the action works eventually...
continue <- TRUE
while (continue) {
Expand Down
2 changes: 1 addition & 1 deletion man/fair_init.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/fair_run.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/get_dataproduct.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/get_entry.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/get_existing.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/get_fields.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/get_id.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/get_tables.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/get_url.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/new_author.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/new_code_repo_release.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/new_code_run.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/new_data_product.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 9758ab3

Please sign in to comment.