-
Notifications
You must be signed in to change notification settings - Fork 21
/
royalty_test.rb
43 lines (34 loc) · 1.1 KB
/
royalty_test.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
require File.expand_path('../test_assistant', __FILE__)
module Pingpp
class RoyaltyTest < Test::Unit::TestCase
# 批量更新分润对象
should "return a royalty list object when passed correct ids" do
params = {
# 分润 ID 列表 required|array
:ids => get_royalty_ids_to_update,
# 描述信息 optional|string
:description => "DESCRIPTION",
# optional|string
# :method => "manual",
}
o = Pingpp::Royalty.batch_update(params)
assert o.kind_of?(Pingpp::ListObject)
assert o.data[0].kind_of?(Pingpp::Royalty)
end
# 查询分润对象
should "return an existed royalty object when passed a correct id" do
o = Pingpp::Royalty.retrieve(existed_royalty_id)
assert o.kind_of?(Pingpp::Royalty)
end
# 查询分润对象列表
should "return a list object of royalties" do
o = Pingpp::Royalty.list(
{ :per_page => 3, :page => 1 }
)
assert o.kind_of?(Pingpp::ListObject)
if o.data.count > 0
assert o.data[0].kind_of?(Pingpp::Royalty)
end
end
end
end