Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blank search results and not error when password changed but not in Renviron file #110

Open
2 tasks done
jfy133 opened this issue Aug 6, 2019 · 3 comments
Open
2 tasks done

Comments

@jfy133
Copy link

jfy133 commented Aug 6, 2019

I noticed the following problem: changing your BacDive API password, but (forgetting...) not updating the Renviron file accordingly, results in empty search results in no error.

To reproduce: firstly change your password in the Renviron file to an incorrect password.

> taxon_1 <- "Bacillus halodurans"
> Bac_data <- bd_retrieve_taxon(name = taxon_1) 
 
> Bac_data
 NULL
> taxon_2 <- "Aneurinibacillus thermoaerophilus"
> At_data <- bd_retrieve_taxon(name = taxon_2)

> At_data
  NULL

The search result is just a blank line. Assignment and printing of variable displays NULL. No error is displayed.

Updating to the correct password fixed the issue.

I identified that it was an invalid credentials error after I manually copied and pasted relevant functions of the BacDiveR source code, and ran the following

download(construct_url("Tannerella"))
 $detail
[1] "Invalid username/password"

This error does not appear to be passed to the higher level functions.

Additional information:

> sessionInfo()
R version 3.6.1 (2019-07-05)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.2 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.7.1
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.7.1

locale:
 [1] LC_CTYPE=en_GB.UTF-8       LC_NUMERIC=C               LC_TIME=en_GB.UTF-8        LC_COLLATE=en_GB.UTF-8     LC_MONETARY=en_GB.UTF-8    LC_MESSAGES=en_GB.UTF-8    LC_PAPER=en_GB.UTF-8      
 [8] LC_NAME=C                  LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] BacDiveR_0.9.0

loaded via a namespace (and not attached):
[1] httr_1.4.1        compiler_3.6.1    R6_2.4.0          tools_3.6.1       curl_4.0          jsonlite_1.6.9000
I have...
@katrinleinweber
Copy link
Collaborator

katrinleinweber commented Aug 6, 2019

Thanks for this report, @jfy133 :-)

It's an edge-case I forgot to consider, sorry! To do that, the detail you mentioned should probably be checked, and raise a warning or error, passing along BacDive's detail.

@katrinleinweber
Copy link
Collaborator

Note to self: I think this would be a good case to start learning to arrange test-download.R with a mock .Renviron file, instead of adapting the code to fit the test.

@katrinleinweber
Copy link
Collaborator

Alternatively, I could read up on the ... argument. Maybe it could be used to refactor d7a2526`s test-insertion of user & password.

katrinleinweber added a commit that referenced this issue Aug 11, 2019
Reverts 4ca7f5d. Insert `…user:pw@…` into the download URL
to enable testing via this old-school authentication.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants