зеркало из https://github.com/Azure/AzureGraph.git
fix default_generator arg in get_list_pager
This commit is contained in:
Родитель
914f1fc86d
Коммит
1eebbb9fd3
|
@ -1,6 +1,6 @@
|
|||
Package: AzureGraph
|
||||
Title: Simple Interface to 'Microsoft Graph'
|
||||
Version: 1.3.0
|
||||
Version: 1.3.0.9000
|
||||
Authors@R: c(
|
||||
person("Hong", "Ooi", , "hongooi73@gmail.com", role = c("aut", "cre")),
|
||||
person("Microsoft", role="cph")
|
||||
|
|
4
NEWS.md
4
NEWS.md
|
@ -1,3 +1,7 @@
|
|||
# AzureGraph 1.3.0.9000
|
||||
|
||||
- Fix bug in `ms_object$get_list_pager()` where the `default_generator` argument wasn't being used.
|
||||
|
||||
# AzureGraph 1.3.0
|
||||
|
||||
- New API for working with paged result sets:
|
||||
|
|
|
@ -119,7 +119,8 @@ public=list(
|
|||
get_list_pager=function(lst, next_link_name="@odata.nextLink", value_name="value", generate_objects=TRUE,
|
||||
type_filter=NULL, default_generator=ms_object, ...)
|
||||
{
|
||||
ms_graph_pager$new(self$token, lst, next_link_name, value_name, generate_objects, type_filter, ...)
|
||||
ms_graph_pager$new(self$token, lst, next_link_name, value_name,
|
||||
generate_objects, type_filter, default_generator, ...)
|
||||
},
|
||||
|
||||
print=function(...)
|
||||
|
|
|
@ -138,3 +138,43 @@ test_that("extract_list_values works for objects",
|
|||
expect_equal(out, out1)
|
||||
expect_error(extract_list_values(p1))
|
||||
})
|
||||
|
||||
|
||||
test_that("Extra arguments work",
|
||||
{
|
||||
testclass <- R6::R6Class("testclass",
|
||||
public=list(
|
||||
initialize=function(token, tenant, properties, arg1=NULL)
|
||||
{
|
||||
if(is.null(arg1)) stop("arg1 must not be NULL", call.=FALSE)
|
||||
}
|
||||
))
|
||||
|
||||
lst <- list(
|
||||
nextlink=NULL,
|
||||
valuelist=list(
|
||||
list(x=1),
|
||||
list(x=2),
|
||||
list(x=3)
|
||||
)
|
||||
)
|
||||
|
||||
pager <- me$get_list_pager(lst, next_link_name="nextlink", value_name="valuelist", generate_objects=TRUE,
|
||||
default_generator=testclass, arg1=42)
|
||||
|
||||
expect_is(pager, "ms_graph_pager")
|
||||
expect_true(pager$has_data())
|
||||
vals <- pager$value
|
||||
expect_is(vals, "list")
|
||||
expect_true(all(sapply(vals, inherits, "testclass")))
|
||||
|
||||
register_graph_class("testclass", testclass, function(props) !is.null(props$x))
|
||||
pager2 <- me$get_list_pager(lst, next_link_name="nextlink", value_name="valuelist", generate_objects=TRUE,
|
||||
type_filter="testclass", arg1=42)
|
||||
|
||||
expect_is(pager2, "ms_graph_pager")
|
||||
expect_true(pager2$has_data())
|
||||
vals2 <- pager2$value
|
||||
expect_is(vals2, "list")
|
||||
expect_true(all(sapply(vals2, inherits, "testclass")))
|
||||
})
|
||||
|
|
Загрузка…
Ссылка в новой задаче