Commit b9d4b1a9 by lanrion

#get_access_token should raise error if app_secret or appid is invalid

parent f1b63a54
......@@ -57,6 +57,7 @@ module WeixinAuthorize
# authenticate access_token
def authenticate
raise "APPID or APPSECRET is invalid" if !is_valid?
if is_weixin_redis_blank?
set_access_token_for_client
else
......
......@@ -23,5 +23,10 @@ describe WeixinAuthorize::Client do
valid_info = $client_1.is_valid?
expect(valid_info).to eq(false)
end
it "#get_access_token should raise error if app_secret or appid is invalid" do
$client_2 = WeixinAuthorize::Client.new("appid_2", "app_secret_2")
expect{$client_2.get_access_token}.to raise_error(RuntimeError)
end
end
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment