| 1 |
require 'spec_helper' |
| 2 |
|
| 3 |
describe 'nova::cors' do |
| 4 |
|
| 5 |
shared_examples_for 'nova::cors' do |
| 6 |
it 'configure cors default params' do |
| 7 |
is_expected.to contain_oslo__cors('nova_config').with( |
| 8 |
:allowed_origin => '<SERVICE DEFAULT>', |
| 9 |
:allow_credentials => '<SERVICE DEFAULT>', |
| 10 |
:expose_headers => '<SERVICE DEFAULT>', |
| 11 |
:max_age => '<SERVICE DEFAULT>', |
| 12 |
:allow_methods => '<SERVICE DEFAULT>', |
| 13 |
:allow_headers => '<SERVICE DEFAULT>', |
| 14 |
) |
| 15 |
end |
| 16 |
|
| 17 |
context 'with specific parameters' do |
| 18 |
let :params do |
| 19 |
{ :allowed_origin => '*', |
| 20 |
:allow_credentials => true, |
| 21 |
:expose_headers => 'Content-Language,Expires', |
| 22 |
:max_age => 3600, |
| 23 |
:allow_methods => 'GET,POST,PUT,DELETE,OPTIONS', |
| 24 |
:allow_headers => 'Content-Type,Cache-Control', |
| 25 |
} |
| 26 |
end |
| 27 |
|
| 28 |
it 'configure cors params' do |
| 29 |
is_expected.to contain_oslo__cors('nova_config').with( |
| 30 |
:allowed_origin => '*', |
| 31 |
:allow_credentials => true, |
| 32 |
:expose_headers => 'Content-Language,Expires', |
| 33 |
:max_age => 3600, |
| 34 |
:allow_methods => 'GET,POST,PUT,DELETE,OPTIONS', |
| 35 |
:allow_headers => 'Content-Type,Cache-Control', |
| 36 |
) |
| 37 |
end |
| 38 |
end |
| 39 |
end |
| 40 |
|
| 41 |
on_supported_os({ |
| 42 |
:supported_os => OSDefaults.get_supported_os |
| 43 |
}).each do |os,facts| |
| 44 |
context "on #{os}" do |
| 45 |
let (:facts) do |
| 46 |
facts.merge!(OSDefaults.get_facts()) |
| 47 |
end |
| 48 |
|
| 49 |
it_behaves_like 'nova::cors' |
| 50 |
end |
| 51 |
end |
| 52 |
|
| 53 |
end |