Allow for only a [configurable] tag set

This commit is contained in:
Scott Schneider 2015-06-30 10:57:49 -07:00
parent 3aa8389749
commit 6523062b62
3 changed files with 27 additions and 0 deletions

View file

@ -341,6 +341,23 @@ describe Vmpooler::API::V1 do
expect(last_response.status).to eq(400)
end
context '(allowed_tags configured)' do
let(:config) { {
config: {
'allowed_tags' => ['created_by', 'project', 'url']
}
} }
it 'fails if specified tag is not in allowed_tags array' do
put "#{prefix}/vm/testhost", '{"tags":{"created_by":"rspec","tested_by":"rspec"}}'
expect(last_response).to_not be_ok
expect(last_response.header['Content-Type']).to eq('application/json')
expect(last_response.body).to eq(JSON.pretty_generate({'ok' => false}))
expect(last_response.status).to eq(400)
end
end
context '(tagfilter configured)' do
let(:config) { {
tagfilter: { 'url' => '(.*)\/' },