ropensci / smapr

An R package for acquisition and processing of NASA SMAP data
https://docs.ropensci.org/smapr
79 stars 25 forks source link

Adding set_smap_credentials and checking for 401 response #46

Closed mbjoseph closed 6 years ago

mbjoseph commented 6 years ago

This commit adds a function set_smap_credentials() that users can use to specify their NASA Earthdata credentials. It also implements checks for 401/unauthorized responses from the SMAP data server, which indicate that the credentials used are not authorized (would be expected if users enter the wrong username and/or password).

Big thanks to @marcosci and @ldecicco-USGS for suggesting this functionality. This should solve #43 and #41.

codecov-io commented 6 years ago

Codecov Report

Merging #46 into master will increase coverage by 1.33%. The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master     #46      +/-   ##
=========================================
+ Coverage   98.16%   99.5%   +1.33%     
=========================================
  Files           5       6       +1     
  Lines         273     401     +128     
=========================================
+ Hits          268     399     +131     
+ Misses          5       2       -3
Impacted Files Coverage Δ
R/extract_smap.R 100% <100%> (+2.77%) :arrow_up:
R/zzz.R 100% <100%> (ø) :arrow_up:
R/set_smap_credentials.R 100% <100%> (ø)
R/download_smap.R 100% <0%> (ø) :arrow_up:
R/find_smap.R 98.05% <0%> (+0.49%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update d4e7af6...3738704. Read the comment docs.

mbjoseph commented 6 years ago

Well - this all works locally, but test coverage is now reduced because we are skipping tests that modify the global .Renviron file on Travis. I'm not sure whether this is because the .Renviron file does not exist on Travis, or because it exists but the user associated with the build does not have permissions for the file...