-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
29 changed files
with
324 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,5 +8,4 @@ | |
/spec/reports/ | ||
/tmp/ | ||
*.gem | ||
config.yml | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{ | ||
"errcode":0, | ||
"errmsg": "ok", | ||
"agentid": "1", | ||
"name": "NAME", | ||
"square_logo_url": "xxxxxxxx", | ||
"description": "desc", | ||
"allow_userinfos": { | ||
"user":[ | ||
{ | ||
"userid":"id2" | ||
}, | ||
{ | ||
"userid":"id3" | ||
} | ||
] | ||
}, | ||
"allow_partys":{ | ||
"partyid": [1] | ||
}, | ||
"allow_tags":{ | ||
"tagid": [1,2,3] | ||
}, | ||
"close": 0, | ||
"redirect_domain": "www.qq.com", | ||
"report_location_flag": 0, | ||
"isreportenter": 0, | ||
"home_url": "http://www.qq.com" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"errcode":0, | ||
"errmsg":"ok" , | ||
"agentlist":[ | ||
{ | ||
"agentid":1, | ||
"name":"NAME", | ||
"square_logo_url":"xxxxxxxx" | ||
}, | ||
{ | ||
"agentid":2, | ||
"name":"NAME", | ||
"square_logo_url":"xxxxxxxx" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"errcode":0, | ||
"errmsg":"ok" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"errcode": 0, | ||
"errmsg": "ok", | ||
"status": 1, | ||
"type": "replace_user", | ||
"total": 3, | ||
"percentage": 33, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"errcode": -1, | ||
"errmsg": "Invalid input" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"errcode":0, | ||
"errmsg":"ok", | ||
"ticket":"bxLdikRXVbTPdHSM05e5u5sUoXNKd8-41ZO3MhKoyN5OfkWITDGgnr2fwJ0m9E8NYzWKVZvdVtaUgWvsdshFKA", | ||
"expires_in":7200 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"errcode":0, | ||
"errmsg":"", | ||
"access_token": "accesstoken000001", | ||
"expires_in": 7200 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"button":[ | ||
{ | ||
"type":"click", | ||
"name":"今日歌曲", | ||
"key":"V1001_TODAY_MUSIC" | ||
}, | ||
{ | ||
"name":"菜单", | ||
"sub_button":[ | ||
{ | ||
"type":"view", | ||
"name":"搜索", | ||
"url":"http://www.soso.com/" | ||
}, | ||
{ | ||
"type":"click", | ||
"name":"赞一下我们", | ||
"key":"V1001_GOOD" | ||
} | ||
] | ||
} | ||
] | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"access_token": "xxxxxx", | ||
"expires_in": 7200 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
{ | ||
"access_token": "xxxxxx", | ||
"expires_in": 7200, | ||
"permanent_code": "xxxx", | ||
"auth_corp_info": | ||
{ | ||
"corpid": "xxxx", | ||
"corp_name": "name", | ||
"corp_type": "verified", | ||
"corp_square_logo_url": "yyyyy", | ||
"corp_user_max": 50, | ||
"corp_agent_max": 30, | ||
"corp_full_name":"full_name", | ||
"verified_end_time":1431775834, | ||
"subject_type": 1, | ||
"corp_wxqrcode": "zzzzz" | ||
}, | ||
"auth_info": | ||
{ | ||
"agent" : | ||
[ | ||
{ | ||
"agentid":1, | ||
"name":"NAME", | ||
"round_logo_url":"xxxxxx", | ||
"square_logo_url":"yyyyyy", | ||
"appid":1, | ||
"privilege": | ||
{ | ||
"level":1, | ||
"allow_party":[1,2,3], | ||
"allow_user":["zhansan","lisi"], | ||
"allow_tag":[1,2,3], | ||
"extra_party":[4,5,6], | ||
"extra_user":["wangwu"], | ||
"extra_tag":[4,5,6] | ||
} | ||
}, | ||
{ | ||
"agentid":2, | ||
"name":"NAME2", | ||
"round_logo_url":"xxxxxx", | ||
"square_logo_url":"yyyyyy", | ||
"appid":5 | ||
} | ||
] | ||
}, | ||
"auth_user_info": | ||
{ | ||
"email":"[email protected]", | ||
"mobile":"1234567890", | ||
"userid":"aa" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"errcode":0 , | ||
"errmsg":"ok" , | ||
"pre_auth_code":"xxxx", | ||
"expires_in":1200 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"suite_access_token":"61W3mEpU66027wgNZ_MhGHNQDHnFATkDa9-2llqrMBjUwxRSNPbVsMmyD-yq8wZETSoE5NQgecigDrSHkPtIYA", | ||
"expires_in":7200 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"errcode": 0, | ||
"errmsg": "ok" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"errcode": 0, | ||
"errmsg": "ok", | ||
"openid": "oDOGms-6yCnGrRovBj2yHij5JL6E", | ||
"appid":"wxf874e15f78cc84a7" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"errcode": 0, | ||
"errmsg": "ok", | ||
"userid": "zhangsan" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"errcode": 0, | ||
"errmsg": "ok", | ||
"userid": "zhangsan", | ||
"name": "李四", | ||
"department": [1, 2], | ||
"order": [1, 2], | ||
"position": "后台工程师", | ||
"mobile": "15913215421", | ||
"gender": "1", | ||
"email": "[email protected]", | ||
"isleader": 1, | ||
"avatar": "http://wx.qlogo.cn/mmopen/ajNVdqHZLLA3WJ6DSZUfiakYe37PKnQhBIeOQBO4czqrnZDS79FH5Wm5m4X69TBicnHFlhiafvDwklOpZeXYQQ2icg/0", | ||
"telephone": "020-123456", | ||
"english_name": "jackzhang", | ||
"extattr": {"attrs":[{"name":"爱好","value":"旅游"},{"name":"卡号","value":"1234567234"}]}, | ||
"status": 1 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"userid":"lisi", | ||
"name":"李四", | ||
"department":[3], | ||
"position": "后台工程师", | ||
"mobile":"15050495892", | ||
"gender":1, | ||
"email":"[email protected]", | ||
"avatar":"http://shp.qpic.cn/bizmp/xxxxxxxxxxx/0" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"errcode": 0, | ||
"errmsg": "ok", | ||
"UserId":"USERID", | ||
"DeviceId":"DEVICEID", | ||
"user_ticket": "USER_TICKET", | ||
"expires_in":7200 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"errcode": 0, | ||
"errmsg": "ok", | ||
"userlist": [ | ||
{ | ||
"userid": "zhangsan", | ||
"name": "李四", | ||
"department": [1, 2], | ||
"order": [1, 2], | ||
"position": "后台工程师", | ||
"mobile": "15913215421", | ||
"gender": "1", | ||
"email": "[email protected]", | ||
"isleader": 0, | ||
"avatar": "http://wx.qlogo.cn/mmopen/ajNVdqHZLLA3WJ6DSZUfiakYe37PKnQhBIeOQBO4czqrnZDS79FH5Wm5m4X69TBicnHFlhiafvDwklOpZeXYQQ2icg/0", | ||
"telephone": "020-123456", | ||
"english_name": "jackzhang", | ||
"status": 1, | ||
"extattr": {"attrs":[{"name":"爱好","value":"旅游"},{"name":"卡号","value":"1234567234"}]} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"errcode": 0, | ||
"errmsg": "ok", | ||
"userlist": [ | ||
{ | ||
"userid": "zhangsan", | ||
"name": "李四", | ||
"department": [1, 2] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
CORP_ID: 'ww79c13c8a6183aac6' | ||
CORP_SECRET: 'gLZfbW8ZKIi9JYmL_Ox3t8xQH0GklCaZAL8-L3jzJ0s' | ||
APP_ID: '1000006' | ||
APP_SECRET: 'Fih7jCrS6Fee3OQ4QpIfkwjwvBPJS3gWkkdYpDGyh68' | ||
|
||
SUITE_CORPID: 'wx0c2fbd31ee9b9611' | ||
SUITE_ID: 'tja33baec0c0d207e2' | ||
SUITE_ENCODING_AES_KEY: '657bca245569d26385ec5134cf83e59110ea7715eba' | ||
SUITE_TOKEN: 'e96f2a5d0b05a69ec20e9325ae8d34' | ||
SUITE_SECRET: 'd0S0OQv-QzW7IMhX9WXK46jUqxtHQcIIrWksJ2n2fQDc-wMKHNhCT9E-yOiVN77b' | ||
SUITE_TICKET: 'kBCgyTpUHJTCll-eFdaiCuK70hsgakeKcESr1X350kYB0yF76Ih2oxgFnfEKmlus' |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
require 'json' | ||
require 'sinatra/base' | ||
|
||
class FakeWework < Sinatra::Base | ||
|
||
get '/cgi-bin/media/get' do | ||
send_file fixture_file_path('zhiren.png'), :type => :jpg | ||
end | ||
|
||
get '/cgi-bin/*' do |api| | ||
json_response "api/#{api}.json" | ||
end | ||
|
||
%i(get post).each do |http_method| | ||
send http_method, '/cgi-bin/*/*' do |category, api| | ||
json_response "api/#{category}/#{api}.json" | ||
end | ||
end | ||
|
||
private | ||
|
||
def json_response file_name | ||
content_type :json | ||
status 200 | ||
file_path = fixture_file_path(file_name) | ||
file_path = fixture_file_path('api/success.json') unless File.exist?(file_path) | ||
File.open(file_path, 'rb').read | ||
end | ||
|
||
def fixture_file_path path | ||
File.join(File.expand_path('../../fixtures/', __FILE__), path) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,29 @@ | ||
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__) | ||
require 'wework' | ||
require 'mock_redis' | ||
require "minitest/pride" | ||
require 'minitest/autorun' | ||
require 'minitest/unit' | ||
|
||
require 'yaml' | ||
|
||
|
||
ENV['CORP_ID'] = 'corpid' | ||
ENV['CONTACT_SECRET'] = 'corp secret' | ||
ENV['APP_ID'] = 'appid' | ||
ENV['APP_SECRET'] = 'app secret' | ||
|
||
|
||
#load seeds file | ||
seeds_path = File.join(File.dirname(__FILE__), 'fixtures/config.yml') | ||
if File.exist? seeds_path | ||
YAML.load_file(seeds_path).each do |k, v| | ||
ENV[k] = "#{v}" | ||
end | ||
end | ||
|
||
unless ENV['IGNORE_WEWORK_MOCK'] | ||
require 'webmock/minitest' | ||
Dir[File.join(File.dirname(__FILE__), 'support/**/*.rb')].each {|f| require f} | ||
end | ||
|
||
class Minitest::Test | ||
Wework.configure do |config| | ||
config.redis = Redis.new(host: '127.0.0.1', port: 6379, db: 1) | ||
def before_setup | ||
stub_request(:any, /qyapi.weixin.qq.com/).to_rack(FakeWework) unless ENV['IGNORE_WEWORK_MOCK'] | ||
|
||
Wework.configure do |config| | ||
config.redis = MockRedis.new | ||
end | ||
end | ||
end |
Oops, something went wrong.