Commit 9a502c60 by lanrion

添加模板消息单元测试

parent 289b645d
require "weixin_authorize/api/user" Dir["#{File.dirname(__FILE__)}/api/*.rb"].each do |path|
require "weixin_authorize/api/menu" require path
require "weixin_authorize/api/custom" end
require "weixin_authorize/api/groups"
require "weixin_authorize/api/qrcode"
require "weixin_authorize/api/media"
require "weixin_authorize/api/mass"
require "weixin_authorize/api/oauth"
require "weixin_authorize/api/template"
describe WeixinAuthorize::Api::Template do
# {{first.DATA}}
# 项目名称:{{class.DATA}}
# 时间:{{time.DATA}}
# 地点:{{add.DATA}}
# {{remark.DATA}}
it "can send template msg" do
url = "http://www.baidu.com"
data = {
first: {
value: "报名结果通知",
color: "#173277"
},
class: {
value: "领导与管理课程培训/人格测评",
color: "#173177"
},
time: {
value: "11月6日—11月7日(周三—周五)",
color: "#274177"
},
add: {
value: "F302室",
color: "#274377"
},
remark: {
value: "您可点击【详情】查看详细信息。",
color: "#274377"
}
}
msg_result = $client.send_template_msg(
ENV["OPENID"],
ENV["TEMPLATE_ID"],
url,
"#173177",
data
)
expect(msg_result.code).to eq(WeixinAuthorize::OK_CODE)
end
end
...@@ -41,6 +41,7 @@ CodeClimate::TestReporter.start ...@@ -41,6 +41,7 @@ CodeClimate::TestReporter.start
ENV["APPID"]="wx986f04063d341d04" ENV["APPID"]="wx986f04063d341d04"
ENV["APPSECRET"]="1a941cd88cb4579ba98ec06b6813af03" ENV["APPSECRET"]="1a941cd88cb4579ba98ec06b6813af03"
ENV["OPENID"]="o9k6BuB0kydAcPTc7sPxppB1GQqA" ENV["OPENID"]="o9k6BuB0kydAcPTc7sPxppB1GQqA"
ENV["TEMPLATE_ID"]="-8ooXrOK3VD3HuSS8--nH154PO9Lw2E7T-RV1uTaGLc"
# Comment to test for ClientStorage # Comment to test for ClientStorage
redis = Redis.new(host: "127.0.0.1", port: "6379", db: 15) redis = Redis.new(host: "127.0.0.1", port: "6379", db: 15)
......
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