|
159 | 159 |
|
160 | 160 | describe 'GET /v2/bot/followers/ids' do |
161 | 161 | let(:client) { Line::Bot::V2::MessagingApi::ApiClient.new(channel_access_token: 'test-channel-access-token') } |
162 | | - let(:response_body) { { "user_ids" => ["U1234567890", "U0987654321"] }.to_json } |
163 | 162 | let(:response_code) { 200 } |
164 | 163 |
|
165 | 164 | it 'returns a list of followers successfully without optional parameters' do |
| 165 | + response_body = { "user_ids" => ["U1234567890", "U0987654321"] }.to_json |
166 | 166 | stub_request(:get, "https://api.line.me/v2/bot/followers/ids") |
167 | 167 | .with( |
168 | 168 | headers: { |
|
176 | 176 | expect(status_code).to eq(200) |
177 | 177 | expect(body.user_ids).to eq(["U1234567890", "U0987654321"]) |
178 | 178 | end |
| 179 | + |
| 180 | + it 'query with only start' do |
| 181 | + response_body = { "user_ids" => ["U1234567890", "U0987654321"], "next" => "nExT Token" }.to_json |
| 182 | + stub_request(:get, "https://api.line.me/v2/bot/followers/ids?start=from%20previous%20NEXT") |
| 183 | + .with( |
| 184 | + headers: { |
| 185 | + 'Authorization' => "Bearer test-channel-access-token" |
| 186 | + } |
| 187 | + ) |
| 188 | + .to_return(status: response_code, body: response_body, headers: { 'Content-Type' => 'application/json' }) |
| 189 | + |
| 190 | + body, status_code, headers = client.get_followers_with_http_info(start: "from previous NEXT") |
| 191 | + |
| 192 | + expect(status_code).to eq(200) |
| 193 | + expect(body.user_ids).to eq(["U1234567890", "U0987654321"]) |
| 194 | + expect(body._next).to eq("nExT Token") |
| 195 | + end |
| 196 | + |
| 197 | + it 'query with limit and start' do |
| 198 | + response_body = { "user_ids" => ["U1234567890", "U0987654321"], "next" => "nExT Token" }.to_json |
| 199 | + stub_request(:get, "https://api.line.me/v2/bot/followers/ids?limit=10&start=from%20previous%20NEXT") |
| 200 | + .with( |
| 201 | + headers: { |
| 202 | + 'Authorization' => "Bearer test-channel-access-token" |
| 203 | + } |
| 204 | + ) |
| 205 | + .to_return(status: response_code, body: response_body, headers: { 'Content-Type' => 'application/json' }) |
| 206 | + |
| 207 | + body, status_code, headers = client.get_followers_with_http_info(start: "from previous NEXT", limit: 10) |
| 208 | + |
| 209 | + expect(status_code).to eq(200) |
| 210 | + expect(body.user_ids).to eq(["U1234567890", "U0987654321"]) |
| 211 | + expect(body._next).to eq("nExT Token") |
| 212 | + end |
| 213 | + |
179 | 214 | end |
180 | 215 |
|
181 | 216 | describe 'GET /v2/bot/message/aggregation/list' do |
|
0 commit comments