Skip to content
Snippets Groups Projects
Commit 43482629 authored by Alex Reisner's avatar Alex Reisner
Browse files

Use fake API key for testing Google Premier.

Also move API key config to separate method.
parent 2e4413ca
No related branches found
No related tags found
No related merge requests found
......@@ -6,17 +6,8 @@ class ServicesTest < Test::Unit::TestCase
def test_query_url_contains_values_in_params_hash
Geocoder::Lookup.all_services_except_test.each do |l|
next if l == :google_premier # TODO: need to set keys to test
next if l == :freegeoip # does not use query string
# need to set API key for Yahoo for OAuth encoding
if l == :yahoo
Geocoder::Configuration.api_key = [
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
'bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb'
]
else
Geocoder::Configuration.api_key = nil
end
set_api_key!(l)
url = Geocoder::Lookup.get(l).send(:query_url, Geocoder::Query.new(
"test", :params => {:one_in_the_hand => "two in the bush"}
))
......@@ -194,4 +185,23 @@ class ServicesTest < Test::Unit::TestCase
assert_equal "46 West 31st Street, New York, NY, 10001, US",
result.address
end
private # ------------------------------------------------------------------
def set_api_key!(lookup_name)
if lookup_name == :google_premier
Geocoder::Configuration.api_key = [
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
'bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb',
'cccccccccccccccccccccccccccccc'
]
elsif lookup_name == :yahoo
Geocoder::Configuration.api_key = [
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
'bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb'
]
else
Geocoder::Configuration.api_key = nil
end
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment