|
28 | 28 | order_by: 'updated_at',
|
29 | 29 | names: 'foo',
|
30 | 30 | stacks: 'cf',
|
| 31 | + lifecycle: 'buildpack', |
31 | 32 | label_selector: 'foo,bar',
|
32 | 33 | guids: 'foo,bar',
|
33 | 34 | created_ats: "#{Time.now.utc.iso8601},#{Time.now.utc.iso8601}",
|
|
95 | 96 | let!(:buildpack1) { VCAP::CloudController::Buildpack.make(stack: stack1.name, position: 1) }
|
96 | 97 | let!(:buildpack2) { VCAP::CloudController::Buildpack.make(stack: stack2.name, position: 3) }
|
97 | 98 | let!(:buildpack3) { VCAP::CloudController::Buildpack.make(stack: stack3.name, position: 2) }
|
| 99 | + let!(:buildpack4) { VCAP::CloudController::Buildpack.make(stack: stack1.name, position: 1, lifecycle: 'cnb') } |
98 | 100 |
|
99 | 101 | it 'returns a paginated list of buildpacks, sorted by position' do
|
100 | 102 | get '/v3/buildpacks?page=1&per_page=2', nil, headers
|
|
213 | 215 | )
|
214 | 216 | end
|
215 | 217 |
|
| 218 | + it 'returns a list of buildpacks filtered by lifecycle' do |
| 219 | + get '/v3/buildpacks?lifecycle=cnb', nil, headers |
| 220 | + |
| 221 | + expect(parsed_response).to be_a_response_like( |
| 222 | + { |
| 223 | + 'pagination' => { |
| 224 | + 'total_results' => 1, |
| 225 | + 'total_pages' => 1, |
| 226 | + 'first' => { |
| 227 | + 'href' => "#{link_prefix}/v3/buildpacks?lifecycle=cnb&page=1&per_page=50" |
| 228 | + }, |
| 229 | + 'last' => { |
| 230 | + 'href' => "#{link_prefix}/v3/buildpacks?lifecycle=cnb&page=1&per_page=50" |
| 231 | + }, |
| 232 | + 'next' => nil, |
| 233 | + 'previous' => nil |
| 234 | + }, |
| 235 | + 'resources' => [ |
| 236 | + { |
| 237 | + 'guid' => buildpack4.guid, |
| 238 | + 'lifecycle' => 'cnb', |
| 239 | + 'created_at' => iso8601, |
| 240 | + 'updated_at' => iso8601, |
| 241 | + 'name' => buildpack4.name, |
| 242 | + 'state' => buildpack4.state, |
| 243 | + 'filename' => buildpack4.filename, |
| 244 | + 'stack' => buildpack4.stack, |
| 245 | + 'position' => 1, |
| 246 | + 'enabled' => true, |
| 247 | + 'locked' => false, |
| 248 | + 'metadata' => { 'labels' => {}, 'annotations' => {} }, |
| 249 | + 'links' => { |
| 250 | + 'self' => { |
| 251 | + 'href' => "#{link_prefix}/v3/buildpacks/#{buildpack4.guid}" |
| 252 | + }, |
| 253 | + 'upload' => { |
| 254 | + 'href' => "#{link_prefix}/v3/buildpacks/#{buildpack4.guid}/upload", |
| 255 | + 'method' => 'POST' |
| 256 | + } |
| 257 | + } |
| 258 | + } |
| 259 | + ] |
| 260 | + } |
| 261 | + ) |
| 262 | + end |
| 263 | + |
216 | 264 | it 'orders by position' do
|
217 | 265 | get "/v3/buildpacks?names=#{buildpack1.name},#{buildpack3.name}&order_by=-position", nil, headers
|
218 | 266 |
|
|
0 commit comments