Skip to content

Commit a78ccad

Browse files
committed
Fix response filepath when contains directory
1 parent 7436af9 commit a78ccad

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

R/plotly.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ For more help, see https://plot.ly/R or contact <[email protected]>.")
105105
}
106106

107107
resp <- fromJSON(respst, simplify = FALSE)
108-
if (!is.null(resp$filename))
109-
pub$filename <- resp$filename
108+
if (!is.null(kwargs$filename))
109+
resp$filename <- kwargs$filename
110110
if (!is.null(resp$error))
111111
cat(resp$err)
112112
if (!is.null(resp$warning))
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
context("Filename")
2+
3+
test_that("Filepath with directories is returned as passed", {
4+
x <- c(-1.50548425849621, 0.023267831354017, -1.38460390550496,
5+
-0.805552814226363, 1.59651736643461, 0.936302685370894,
6+
0.512729504994891, -0.24492573745161, -0.465348603632604,
7+
0.173523456651353, 0.389491211182137, -0.275308705542518,
8+
-0.132866228059449, -0.336255877656944, 0.916535489109209,
9+
-0.936870130264329, 0.363137478307925, -1.26433467241078,
10+
-0.388804188531171, 0.785842426281935)
11+
data = list(x=x,
12+
type="histogramx")
13+
l <- list(autosize=FALSE, width=600, height=400, showlegend=FALSE)
14+
15+
py <- plotly("get_test_user_2", "0f9es4r6tm")
16+
response <- py$plotly(data, kwargs=list(layout=l, filename="directory/hist",
17+
fileopt="overwrite"))
18+
19+
expect_identical(response$filename, "directory/hist")
20+
21+
})

0 commit comments

Comments
 (0)