1- context(" get_figure "  )
1+ context(" api_download_plot "  )
22
33test_that(" requests made by a user who doesn't exist error a 404"  , {
44  skip_on_cran()
55  skip_if_not_master()
66  expect_error({
7-     get_figure( " klmadslfjdfljdsf" ,  0 )
7+     api_download_plot( 0 ,  " klmadslfjdfljdsf"  )
88  }, " .*404.*"  )
99})
1010
1111test_that(" requests made to retrieve a figure that doesn't exist returns a 404"  , {
1212  skip_on_cran()
1313  skip_if_not_master()
1414  expect_error({
15-     get_figure( " get_test_user" ,  18324823 )
15+     api_download_plot( 18324823 ,  " get_test_user"  )
1616  }, " .*404.*"  )
1717})
1818
1919test_that(" requests made to retrieve some elses private file errors"  , {
2020  skip_on_cran()
2121  skip_if_not_master()
22-   expect_error(get_figure( " get_test_user" ,  1 ))
22+   expect_error(api_download_plot( 1 ,  " get_test_user"  ))
2323})
2424
2525test_that(" retrieving a public figure ... works."  , {
2626  skip_on_cran()
2727  skip_if_not_master()
28-   fig  <-  get_figure( " get_test_user" ,  0 )
28+   fig  <-  api_download_plot( 0 ,  " get_test_user"  )
2929  #  get the data behind the hash
3030  p  <-  plotly_build(fig )$ x 
3131  expect_equivalent(p $ data [[1 ]]$ x , c(" 1"  , " 2"  , " 3"  ))
@@ -34,7 +34,7 @@ test_that("retrieving a public figure ... works.", {
3434test_that(" can add traces to a subplot figure"  , {
3535  skip_on_cran()
3636  skip_if_not_master()
37-   fig  <-  get_figure( ' chelsea_lyn' ,  6366 )
37+   fig  <-  api_download_plot( 6366 ,  ' chelsea_lyn'  )
3838  p  <-  add_lines(fig , x  =  c(1 , 2 , 3 ), y  =  c(4 , 2 , 4 ))
3939  expect_equivalent(
4040    length(plotly_build(fig )$ x $ data ) +  1 , 
@@ -45,7 +45,7 @@ test_that("can add traces to a subplot figure", {
4545test_that(" posting a hidden plot returns a secret key"  , {
4646  skip_on_cran()
4747  skip_if_not_master()
48-   res  <-  plotly_POST (plot_ly(), sharing  =  " secret"  )
48+   res  <-  api_create (plot_ly(), sharing  =  " secret"  )
4949  expect_true(res $ share_key_enabled )
5050  expect_true(nchar(res $ share_key ) >  1 )
5151})
0 commit comments