Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
weixin_authorize
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ikcrm_common
weixin_authorize
Commits
935976ab
Commit
935976ab
authored
May 02, 2014
by
lanrion
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added mass spec
parent
67ebe161
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
61 additions
and
0 deletions
+61
-0
spec/api/mass_spec.rb
+61
-0
No files found.
spec/api/mass_spec.rb
0 → 100644
View file @
935976ab
require
"spec_helper"
describe
WeixinAuthorize
::
Api
::
Mass
do
let
(
:image_jpg_path
)
do
"
#{
File
.
dirname
(
__FILE__
)
}
/medias/ruby-logo.jpg"
end
let
(
:news_media_1
)
do
{
"thumb_media_id"
=>
""
,
"author"
=>
"lanrion"
,
"title"
=>
"Happy Day"
,
"content_source_url"
=>
"www.qq.com"
,
"content"
=>
"content"
,
"digest"
=>
"digest"
}
end
let
(
:image_media_id
)
do
# Get image media_id
image_media
=
$client
.
upload_media
(
image_jpg_path
,
"image"
)
media_id
=
image_media
.
result
[
"media_id"
]
media_id
end
let
(
:mass_media_id
)
do
media
=
{
"thumb_media_id"
=>
image_media_id
}
news_media
=
news_media_1
.
merge
(
media
)
# upload news media
response
=
$client
.
upload_mass_news
([
news_media
])
mass_media_id
=
response
.
result
[
"media_id"
]
mass_media_id
end
it
"#upload_mass_news"
do
media
=
{
"thumb_media_id"
=>
image_media_id
}
news_media
=
news_media_1
.
merge
(
media
)
# upload news media
response
=
$client
.
upload_mass_news
([
news_media
])
expect
(
response
.
code
).
to
eq
(
WeixinAuthorize
::
OK_CODE
)
expect
(
response
.
result
.
keys
).
to
eq
([
"type"
,
"media_id"
,
"created_at"
])
end
it
"#mass_with_group with mpnews"
do
response
=
$client
.
mass_with_group
(
"1"
,
mass_media_id
)
expect
(
response
.
code
).
to
eq
(
WeixinAuthorize
::
OK_CODE
)
expect
(
response
.
result
[
"type"
]).
to
eq
(
"mpnews"
)
expect
(
response
.
result
.
keys
).
to
eq
([
"type"
,
"msg_id"
,
"errmsg"
,
"errcode"
])
end
it
"#mass_with_openids with mpnews"
do
response
=
$client
.
mass_with_openids
([
ENV
[
"OPENID"
]],
mass_media_id
)
expect
(
response
.
code
).
to
eq
(
WeixinAuthorize
::
OK_CODE
)
expect
(
response
.
result
[
"type"
]).
to
eq
(
"mpnews"
)
expect
(
response
.
result
.
keys
).
to
eq
([
"type"
,
"msg_id"
,
"errmsg"
,
"errcode"
])
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment