tests/testthat/test_get_entities.R

context("Tests for getEntityByBarcode")

tapi<-CoreAPI::coreAPI(CoreAccountInfo = "testfiles/account.json")



test_that("get entity by entity and barcode values",
          {
            source("testfiles/testEntityValues.R")
            r<-CoreAPI::authBasic(tapi)

            item<- CoreAPI::getEntityByBarcode(r$coreApi,entityType,barcode)
            id<-item$entity$entityId
            out<-CoreAPI::logOut(r$coreApi)
            expect_equal(object=id,expected=sampleId)
           })

test_that("get entity by entity and name values",
          {
            source("testfiles/testEntityValues.R")
            r<-CoreAPI::authBasic(tapi)
            #name and barcode are thet same
            item<- CoreAPI::getEntityByName(r$coreApi,entityType,barcode)
            id<-item$entity$entityId
            out<-CoreAPI::logOut(r$coreApi)
            expect_equal(object=id,expected=sampleId)
          })




test_that("get entity by entity and entityID values",
          {
            source("testfiles/testEntityValues.R")
            r<-CoreAPI::authBasic(tapi)

            item<- CoreAPI::getEntityById(r$coreApi,entityType,sampleId)
            id<-item$entity$entityId
            out<-CoreAPI::logOut(r$coreApi)
            expect_equal(object=id,expected=sampleId)
          })
ceparman/CoreAPI documentation built on May 13, 2019, 2:59 p.m.