test now wait 1 sec and retry if ratelimit is exceeded
This commit is contained in:
@@ -6,7 +6,13 @@ require 'sightstone'
|
|||||||
class ChampionModuleTest < BaseTest
|
class ChampionModuleTest < BaseTest
|
||||||
|
|
||||||
def test_champions
|
def test_champions
|
||||||
|
begin
|
||||||
champions = @@sightstone.champion.champions
|
champions = @@sightstone.champion.champions
|
||||||
|
rescue Sightstone::RateLimitExceededException
|
||||||
|
puts "Rate limit exeeded, waiting 1 sec"
|
||||||
|
sleep 1
|
||||||
|
retry
|
||||||
|
end
|
||||||
assert_instance_of(Array, champions)
|
assert_instance_of(Array, champions)
|
||||||
if(champions.size > 0)
|
if(champions.size > 0)
|
||||||
_check_champion(champions[0])
|
_check_champion(champions[0])
|
||||||
@@ -14,7 +20,13 @@ class ChampionModuleTest < BaseTest
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_free_to_play
|
def test_free_to_play
|
||||||
|
begin
|
||||||
champions = @@sightstone.champion.champions :free_to_play => true
|
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|
|
champions.each do |champ|
|
||||||
assert_equal(true, champ.freeToPlay)
|
assert_equal(true, champ.freeToPlay)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -5,10 +5,14 @@ require 'sightstone'
|
|||||||
|
|
||||||
class GameModuleTest < BaseTest
|
class GameModuleTest < BaseTest
|
||||||
|
|
||||||
@@req_id = 30447079
|
|
||||||
|
|
||||||
def test_recent_games
|
def test_recent_games
|
||||||
|
begin
|
||||||
matchHistory = @@sightstone.game.recent(@@req_id)
|
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(MatchHistory, matchHistory)
|
||||||
assert_instance_of(Fixnum, matchHistory.summonerId)
|
assert_instance_of(Fixnum, matchHistory.summonerId)
|
||||||
assert_instance_of(Array, matchHistory.games)
|
assert_instance_of(Array, matchHistory.games)
|
||||||
|
|||||||
@@ -5,10 +5,14 @@ require 'sightstone'
|
|||||||
|
|
||||||
class LeagueModuleTest < BaseTest
|
class LeagueModuleTest < BaseTest
|
||||||
|
|
||||||
@@req_id = 30447079
|
|
||||||
|
|
||||||
def test_league
|
def test_league
|
||||||
|
begin
|
||||||
leagues = @@sightstone.league.league(@@req_id)
|
leagues = @@sightstone.league.league(@@req_id)
|
||||||
|
rescue Sightstone::RateLimitExceededException
|
||||||
|
puts "Rate limit exeeded, waiting 1 sec"
|
||||||
|
sleep 1
|
||||||
|
retry
|
||||||
|
end
|
||||||
leagues.each do |league|
|
leagues.each do |league|
|
||||||
assert_instance_of(League, league)
|
assert_instance_of(League, league)
|
||||||
|
|
||||||
|
|||||||
@@ -3,10 +3,14 @@ require 'sightstone'
|
|||||||
|
|
||||||
class StatsModuleTest < BaseTest
|
class StatsModuleTest < BaseTest
|
||||||
|
|
||||||
@@req_id = 30447079
|
|
||||||
|
|
||||||
def test_summary
|
def test_summary
|
||||||
|
begin
|
||||||
summary = @@sightstone.stats.summary @@req_id
|
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(PlayerStatsSummaryList, summary)
|
||||||
assert_instance_of(Fixnum, summary.summonerId)
|
assert_instance_of(Fixnum, summary.summonerId)
|
||||||
assert_instance_of(Array, summary.playerStatSummaries)
|
assert_instance_of(Array, summary.playerStatSummaries)
|
||||||
@@ -29,7 +33,13 @@ class StatsModuleTest < BaseTest
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_ranked_stats
|
def test_ranked_stats
|
||||||
|
begin
|
||||||
stats = @@sightstone.stats.ranked @@req_id
|
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.summonerId)
|
||||||
assert_instance_of(Fixnum, stats.modifyDate)
|
assert_instance_of(Fixnum, stats.modifyDate)
|
||||||
assert_instance_of(Hash, stats.champions)
|
assert_instance_of(Hash, stats.champions)
|
||||||
|
|||||||
@@ -5,9 +5,6 @@ require 'sightstone'
|
|||||||
|
|
||||||
class SummonerModuleTest < BaseTest
|
class SummonerModuleTest < BaseTest
|
||||||
|
|
||||||
@@test_name = "danijoo"
|
|
||||||
@@test_id_array = [30447079,30447079,30447079]
|
|
||||||
|
|
||||||
def _check_summoner_validity(s)
|
def _check_summoner_validity(s)
|
||||||
assert_instance_of(String, s.name)
|
assert_instance_of(String, s.name)
|
||||||
assert_instance_of(Fixnum, s.id)
|
assert_instance_of(Fixnum, s.id)
|
||||||
@@ -17,17 +14,35 @@ class SummonerModuleTest < BaseTest
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_summoner_by_name
|
def test_summoner_by_name
|
||||||
|
begin
|
||||||
s = @@sightstone.summoner.summoner(@@test_name)
|
s = @@sightstone.summoner.summoner(@@test_name)
|
||||||
|
rescue Sightstone::RateLimitExceededException
|
||||||
|
puts "Rate limit exeeded, waiting 1 sec"
|
||||||
|
sleep 1
|
||||||
|
retry
|
||||||
|
end
|
||||||
_check_summoner_validity(s)
|
_check_summoner_validity(s)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_summoner_by_id
|
def test_summoner_by_id
|
||||||
|
begin
|
||||||
s = @@sightstone.summoner.summoner(@@test_id_array[0])
|
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)
|
_check_summoner_validity(s)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_summoner_names
|
def test_summoner_names
|
||||||
|
begin
|
||||||
names = @@sightstone.summoner.names(@@test_id_array)
|
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)
|
assert_instance_of(Hash, names)
|
||||||
@@test_id_array.each do |id|
|
@@test_id_array.each do |id|
|
||||||
assert_equal(names.has_key?(id), true)
|
assert_equal(names.has_key?(id), true)
|
||||||
@@ -36,7 +51,13 @@ class SummonerModuleTest < BaseTest
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_summoner_runebook
|
def test_summoner_runebook
|
||||||
|
begin
|
||||||
runebook = @@sightstone.summoner.runes(@@test_id_array[0])
|
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_equal(@@test_id_array[0], runebook.summonerId)
|
||||||
assert_instance_of(Array, runebook.pages)
|
assert_instance_of(Array, runebook.pages)
|
||||||
if runebook.pages.size > 0
|
if runebook.pages.size > 0
|
||||||
@@ -63,7 +84,13 @@ class SummonerModuleTest < BaseTest
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_summoner_masterybook
|
def test_summoner_masterybook
|
||||||
|
begin
|
||||||
masterybook = @@sightstone.summoner.masteries(@@test_id_array[0])
|
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_equal(@@test_id_array[0], masterybook.summonerId)
|
||||||
assert_instance_of(Array, masterybook.pages)
|
assert_instance_of(Array, masterybook.pages)
|
||||||
if masterybook.pages.size > 0
|
if masterybook.pages.size > 0
|
||||||
|
|||||||
Reference in New Issue
Block a user