Skip to content
This repository has been archived by the owner on Jan 3, 2021. It is now read-only.

Commit

Permalink
Skip tests if API key is missing
Browse files Browse the repository at this point in the history
  • Loading branch information
ellisvalentiner committed Mar 22, 2018
1 parent 3fe56f2 commit b021562
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
using DarkSky
using Base.Test

response = forecast(42.3601, -71.0589);
@test typeof(response) === DarkSky.DarkSkyResponse
response = forecast(42.3601, -71.0589, exclude=["currently"], extend="hourly");
@test typeof(response) === DarkSky.DarkSkyResponse
response = forecast(42.3601, -71.0589, DateTime(2018, 1, 1, 0, 0, 0));
@test typeof(response) === DarkSky.DarkSkyResponse
response = forecast(42.3601, -71.0589, DateTime(2018, 1, 1, 0, 0, 0), lang="es", units="si", exclude=["minutely"]);
@test typeof(response) === DarkSky.DarkSkyResponse
if haskey(ENV, "DARKSKY_API_KEY")
info("Dark Sky API key was found in your system environment variables, running tests...")
response = forecast(42.3601, -71.0589);
@test typeof(response) === DarkSky.DarkSkyResponse
response = forecast(42.3601, -71.0589, exclude=["currently"], extend="hourly");
@test typeof(response) === DarkSky.DarkSkyResponse
response = forecast(42.3601, -71.0589, DateTime(2018, 1, 1, 0, 0, 0));
@test typeof(response) === DarkSky.DarkSkyResponse
response = forecast(42.3601, -71.0589, DateTime(2018, 1, 1, 0, 0, 0), lang="es", units="si", exclude=["minutely"]);
@test typeof(response) === DarkSky.DarkSkyResponse
else
warn("Dark Sky API key was not found in your system environment variables, skipping tests...")
end

0 comments on commit b021562

Please sign in to comment.