ropensci-archive / rfigshare

:no_entry: ARCHIVED :no_entry: An R Interface to 'figshare'
https://docs.ropensci.org/rfigshare
41 stars 12 forks source link

R CMD check failure with dev httr #86

Closed hadley closed 9 years ago

hadley commented 9 years ago
checking tests ... ERROR
Running the tests in ‘tests/test-all.R’ failed.
Last 13 lines of output:
  'help.start()' for an HTML browser interface to help.
  Type 'q()' to quit R.

  > if (packageVersion("testthat") >= "0.7.1.99") {
  +     library(testthat)
  +   test_check("rfigshare")
  + } else {
  +   library(testthat)
  +   test_package("rfigshare")
  + }
  Loading required package: rfigshare
  Error: is.oauth_endpoint(endpoint) is not TRUE
  Execution halted

Any thoughts?

cboettig commented 9 years ago

Beats me. Using devtools::check() with dev httr I see:

 check()
Updating rfigshare documentation
Loading rfigshare
'/usr/lib/R/bin/R' --vanilla CMD build '/rfigshare' --no-manual  \
  --no-resave-data 

* checking for file ‘/rfigshare/DESCRIPTION’ ... OK
* preparing ‘rfigshare’:
* checking DESCRIPTION meta-information ... OK
* installing the package to build vignettes
* creating vignettes ... ERROR
Quitting from lines 43-47 (README.Rmd) 
Error: processing vignette 'README.Rmd' failed with diagnostics:
is.oauth_endpoint(endpoint) is not TRUE
Execution halted
Error: Command failed (1)

But I run:

 devtools::build_vignettes()
Building rfigshare vignettes
Moving README.html, README.R to inst/doc/
Copying README.Rmd to inst/doc/

And everything is happy. Outside of check() itself I'm having a hard time reproducing this error. You probably know much better than I why check() fails to build vignettes but build_vignettes() doesn't...

hadley commented 9 years ago

Do you get the error with CRAN httr? Maybe I don't need to worry about it

cboettig commented 9 years ago

Nope, check() is happy with httr 0.5 from CRAN.

On Fri Dec 05 2014 at 1:01:20 PM Hadley Wickham notifications@github.com wrote:

Do you get the error with CRAN httr? Maybe I don't need to worry about it

— Reply to this email directly or view it on GitHub https://github.com/ropensci/rfigshare/issues/86#issuecomment-65853827.

hadley commented 9 years ago

Sigh :( This is the worst type of error

hadley commented 9 years ago

I'll take a look next week

hadley commented 9 years ago

It fails for me in the vignette too

hadley commented 9 years ago

And when I run it line-by-line

hadley commented 9 years ago

Hmmm, and it appears to be because, I've broken sign_oauth1.0, but that functions is deprecated anyway. Can you remind me why you're using it? I have a vague memory of some partial OAuth1.0 flow where the app gives you the token and secret directly. Is that what's happening here?

cboettig commented 9 years ago

Yup, that's what is happening. We use a special set of testing token & secret to make sure all the tests actually run on cran, travis, etc.

On Mon, Dec 8, 2014, 6:50 AM Hadley Wickham notifications@github.com wrote:

Hmmm, and it appears to be because, I've broken sign_oauth1.0, but that functions is deprecated anyway. Can you remind me why you're using it? I have a vague memory of some partial OAuth1.0 flow where the app gives you the token and secret directly. Is that what's happening here?

— Reply to this email directly or view it on GitHub https://github.com/ropensci/rfigshare/issues/86#issuecomment-66125548.

hadley commented 9 years ago

I've fixed the httr bug, but this reprex fails with an auth error. Any ideas?

cKey <- "Kazwg91wCdBB9ggypFVVJg"
cSecret <- "izgO06p1ymfgZTsdsZQbcA"
token <- "xdBjcKOiunwjiovwkfTF2QjGhROeLMw0y0nSCSgvg3YQxdBjcKOiunwjiovwkfTF2Q"
token_secret <- "4mdM3pfekNGO16X4hsvZdg"

endpoint <- oauth_endpoint(
  base_url = "http://api.figshare.com/v1/pbl/oauth",
  "request_token", "authorize", "access_token"
)
myapp <- oauth_app("rfigshare", key = cKey, secret = cSecret)

resp1 <- oauth1.0_token(endpoint, myapp)

resp <- sign_oauth1.0(myapp, token = token, token_secret = token_secret)
oauth <- resp$token

response <- GET("http://api.figshare.com/v1/my_data/articles", config(token = oauth))
stop_for_status(response)
content(response)
hadley commented 9 years ago

Don't worry, figured it out

hadley commented 9 years ago

I'm going to add this as a test in httr - is the figshare API pretty stable?

hadley commented 9 years ago

BTW hitting just http://api.figshare.com/v1/my_data seems to be a faster way to determine if auth has succeeded

hadley commented 9 years ago

Ok, all fixed in httr :)