diff --git a/test/test_champions_module.rb b/test/test_champions_module.rb index 1399ec7..e0001b9 100644 --- a/test/test_champions_module.rb +++ b/test/test_champions_module.rb @@ -6,7 +6,13 @@ require 'sightstone' class ChampionModuleTest < BaseTest def test_champions - champions = @@sightstone.champion.champions + begin + champions = @@sightstone.champion.champions + rescue Sightstone::RateLimitExceededException + puts "Rate limit exeeded, waiting 1 sec" + sleep 1 + retry + end assert_instance_of(Array, champions) if(champions.size > 0) _check_champion(champions[0]) @@ -14,7 +20,13 @@ class ChampionModuleTest < BaseTest end def test_free_to_play - champions = @@sightstone.champion.champions :free_to_play => true + begin + champions = @@sightstone.champion.champions :free_to_play => true + rescue Sightstone::RateLimitExceededException + puts "Rate limit exeeded, waiting 1 sec" + sleep 1 + retry + end champions.each do |champ| assert_equal(true, champ.freeToPlay) end diff --git a/test/test_game_module.rb b/test/test_game_module.rb index bf56f4e..e845a73 100644 --- a/test/test_game_module.rb +++ b/test/test_game_module.rb @@ -5,10 +5,14 @@ require 'sightstone' class GameModuleTest < BaseTest - @@req_id = 30447079 - def test_recent_games - matchHistory = @@sightstone.game.recent(@@req_id) + begin + matchHistory = @@sightstone.game.recent(@@req_id) + rescue Sightstone::RateLimitExceededException + puts "Rate limit exeeded, waiting 1 sec" + sleep 1 + retry + end assert_instance_of(MatchHistory, matchHistory) assert_instance_of(Fixnum, matchHistory.summonerId) assert_instance_of(Array, matchHistory.games) diff --git a/test/test_league_module.rb b/test/test_league_module.rb index 66a7777..268803e 100644 --- a/test/test_league_module.rb +++ b/test/test_league_module.rb @@ -5,10 +5,14 @@ require 'sightstone' class LeagueModuleTest < BaseTest - @@req_id = 30447079 - def test_league - leagues = @@sightstone.league.league(@@req_id) + begin + leagues = @@sightstone.league.league(@@req_id) + rescue Sightstone::RateLimitExceededException + puts "Rate limit exeeded, waiting 1 sec" + sleep 1 + retry + end leagues.each do |league| assert_instance_of(League, league) diff --git a/test/test_stats.rb b/test/test_stats.rb index e0f8c01..b84e93e 100644 --- a/test/test_stats.rb +++ b/test/test_stats.rb @@ -3,10 +3,14 @@ require 'sightstone' class StatsModuleTest < BaseTest - @@req_id = 30447079 - def test_summary - summary = @@sightstone.stats.summary @@req_id + begin + summary = @@sightstone.stats.summary @@req_id + rescue Sightstone::RateLimitExceededException + puts "Rate limit exeeded, waiting 1 sec" + sleep 1 + retry + end assert_instance_of(PlayerStatsSummaryList, summary) assert_instance_of(Fixnum, summary.summonerId) assert_instance_of(Array, summary.playerStatSummaries) @@ -29,7 +33,13 @@ class StatsModuleTest < BaseTest end def test_ranked_stats - stats = @@sightstone.stats.ranked @@req_id + begin + stats = @@sightstone.stats.ranked @@req_id + rescue Sightstone::RateLimitExceededException + puts "Rate limit exeeded, waiting 1 sec" + sleep 1 + retry + end assert_instance_of(Fixnum, stats.summonerId) assert_instance_of(Fixnum, stats.modifyDate) assert_instance_of(Hash, stats.champions) diff --git a/test/test_summoner_module.rb b/test/test_summoner_module.rb index a6bacf7..b6e39d4 100644 --- a/test/test_summoner_module.rb +++ b/test/test_summoner_module.rb @@ -4,10 +4,7 @@ require 'sightstone' class SummonerModuleTest < BaseTest - - @@test_name = "danijoo" - @@test_id_array = [30447079,30447079,30447079] - + def _check_summoner_validity(s) assert_instance_of(String, s.name) assert_instance_of(Fixnum, s.id) @@ -17,17 +14,35 @@ class SummonerModuleTest < BaseTest end def test_summoner_by_name + begin s = @@sightstone.summoner.summoner(@@test_name) + rescue Sightstone::RateLimitExceededException + puts "Rate limit exeeded, waiting 1 sec" + sleep 1 + retry + end _check_summoner_validity(s) end def test_summoner_by_id - s = @@sightstone.summoner.summoner(@@test_id_array[0]) + begin + s = @@sightstone.summoner.summoner(@@test_id_array[0]) + rescue Sightstone::RateLimitExceededException + puts "Rate limit exeeded, waiting 1 sec" + sleep 1 + retry + end _check_summoner_validity(s) end def test_summoner_names - names = @@sightstone.summoner.names(@@test_id_array) + begin + names = @@sightstone.summoner.names(@@test_id_array) + rescue Sightstone::RateLimitExceededException + puts "Rate limit exeeded, waiting 1 sec" + sleep 1 + retry + end assert_instance_of(Hash, names) @@test_id_array.each do |id| assert_equal(names.has_key?(id), true) @@ -36,7 +51,13 @@ class SummonerModuleTest < BaseTest end def test_summoner_runebook - runebook = @@sightstone.summoner.runes(@@test_id_array[0]) + begin + runebook = @@sightstone.summoner.runes(@@test_id_array[0]) + rescue Sightstone::RateLimitExceededException + puts "Rate limit exeeded, waiting 1 sec" + sleep 1 + retry + end assert_equal(@@test_id_array[0], runebook.summonerId) assert_instance_of(Array, runebook.pages) if runebook.pages.size > 0 @@ -63,7 +84,13 @@ class SummonerModuleTest < BaseTest end def test_summoner_masterybook - masterybook = @@sightstone.summoner.masteries(@@test_id_array[0]) + begin + masterybook = @@sightstone.summoner.masteries(@@test_id_array[0]) + rescue Sightstone::RateLimitExceededException + puts "Rate limit exeeded, waiting 1 sec" + sleep 1 + retry + end assert_equal(@@test_id_array[0], masterybook.summonerId) assert_instance_of(Array, masterybook.pages) if masterybook.pages.size > 0