File: test_RestContainer.R

package info (click to toggle)
r-cran-restfulr 0.0.15-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 200 kB
  • sloc: ansic: 67; sh: 13; makefile: 2
file content (19 lines) | stat: -rw-r--r-- 582 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
test_RestContainer_CRUD <- function() {
  solr <- rsolr::TestSolr()
  uri <- RestUri(solr$uri)

  id <- "1112211111"
  input <- list(id=id, name="my name!")
  container(uri$update$json)[] <- list(input)

  cont <- container(uri)
  response <- cont[["update", commit="true", wt="json"]]
  checkIdentical(response$responseHeader$status, 0)
  response2 <- cont[["update", commit="true", wt="json"]]
  checkIdentical(response, response2)
  
  doc <- cont[["select", q=paste0("id:", id), wt="json"]]
  checkIdentical(doc$response$docs[[1]][1:2], input)

  checkException(cont$sqlwork)
}