mirror of
https://github.com/puppetlabs/vmpooler.git
synced 2026-01-26 10:08:40 -05:00
Spec tests for tagfilter
This commit is contained in:
parent
1ba1e0fc9b
commit
60819b9a7e
1 changed files with 17 additions and 0 deletions
|
|
@ -332,6 +332,23 @@ describe Vmpooler::API::V1 do
|
||||||
expect(last_response.status).to eq(400)
|
expect(last_response.status).to eq(400)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context '(tagfilter configured)' do
|
||||||
|
let(:config) { {
|
||||||
|
tagfilter: { 'url' => '(.*)\/' },
|
||||||
|
} }
|
||||||
|
|
||||||
|
it 'correctly filters tags' do
|
||||||
|
expect(redis).to receive(:hset).with("vmpooler__vm__testhost", "tag:url", "foo.com")
|
||||||
|
|
||||||
|
put "#{prefix}/vm/testhost", '{"tags":{"url":"foo.com/something.html"}}'
|
||||||
|
|
||||||
|
expect(last_response).to be_ok
|
||||||
|
expect(last_response.header['Content-Type']).to eq('application/json')
|
||||||
|
expect(last_response.body).to eq(JSON.pretty_generate({'ok' => true}))
|
||||||
|
expect(last_response.status).to eq(200)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
context '(auth not configured)' do
|
context '(auth not configured)' do
|
||||||
let(:config) { { auth: false } }
|
let(:config) { { auth: false } }
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue