Skip to content

check_rt_login function #22

@dmullen17

Description

@dmullen17

I'm using a simple helper to check if i'm logged in to RT or not for unit testing in https://github.com/NCEAS/awards-bot. It's useful for skipping unit tests when not logged in to RT.

It might make more sense for it (or a more elegant version) to live here. Thoughts?

check_rt_login <- function(rt_base) {
  base_api <- paste(stringr::str_replace(rt_base, "\\/$", ""),
                    "REST", "1.0", sep = "/")
  content <- httr::GET(base_api) %>%
    httr::content()
  
  if (stringr::str_detect(content, "Credentials required")) {
    return(FALSE)
  } else {
    return(TRUE)
  }
}

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions