Do not test detail of oslo::cors
This change makes unit test cases for mistral::cors, so that these tests do not test behavir of oslo::cors but how oslo::cors resource type is called by mistral::cors. Change-Id: I25afe42205ede6d836625505315da8bd50207a1f
This commit is contained in:
parent
bcfd47644f
commit
413a0cafef
@ -2,14 +2,16 @@ require 'spec_helper'
|
|||||||
|
|
||||||
describe 'mistral::cors' do
|
describe 'mistral::cors' do
|
||||||
|
|
||||||
shared_examples_for 'mistral cors' do
|
shared_examples_for 'mistral::cors' do
|
||||||
it 'configure cors default params' do
|
it 'configure cors default params' do
|
||||||
is_expected.to contain_mistral_config('cors/allowed_origin').with_value('<SERVICE DEFAULT>')
|
is_expected.to contain_oslo__cors('mistral_config').with(
|
||||||
is_expected.to contain_mistral_config('cors/allow_credentials').with_value('<SERVICE DEFAULT>')
|
:allowed_origin => '<SERVICE DEFAULT>',
|
||||||
is_expected.to contain_mistral_config('cors/expose_headers').with_value('<SERVICE DEFAULT>')
|
:allow_credentials => '<SERVICE DEFAULT>',
|
||||||
is_expected.to contain_mistral_config('cors/max_age').with_value('<SERVICE DEFAULT>')
|
:expose_headers => '<SERVICE DEFAULT>',
|
||||||
is_expected.to contain_mistral_config('cors/allow_methods').with_value('<SERVICE DEFAULT>')
|
:max_age => '<SERVICE DEFAULT>',
|
||||||
is_expected.to contain_mistral_config('cors/allow_headers').with_value('<SERVICE DEFAULT>')
|
:allow_methods => '<SERVICE DEFAULT>',
|
||||||
|
:allow_headers => '<SERVICE DEFAULT>',
|
||||||
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'with specific parameters' do
|
context 'with specific parameters' do
|
||||||
@ -24,12 +26,14 @@ describe 'mistral::cors' do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it 'configure cors params' do
|
it 'configure cors params' do
|
||||||
is_expected.to contain_mistral_config('cors/allowed_origin').with_value('*')
|
is_expected.to contain_oslo__cors('mistral_config').with(
|
||||||
is_expected.to contain_mistral_config('cors/allow_credentials').with_value(true)
|
:allowed_origin => '*',
|
||||||
is_expected.to contain_mistral_config('cors/expose_headers').with_value('Content-Language,Expires')
|
:allow_credentials => true,
|
||||||
is_expected.to contain_mistral_config('cors/max_age').with_value(3600)
|
:expose_headers => 'Content-Language,Expires',
|
||||||
is_expected.to contain_mistral_config('cors/allow_methods').with_value('GET,POST,PUT,DELETE,OPTIONS')
|
:max_age => 3600,
|
||||||
is_expected.to contain_mistral_config('cors/allow_headers').with_value('Content-Type,Cache-Control')
|
:allow_methods => 'GET,POST,PUT,DELETE,OPTIONS',
|
||||||
|
:allow_headers => 'Content-Type,Cache-Control',
|
||||||
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -42,7 +46,7 @@ describe 'mistral::cors' do
|
|||||||
facts.merge!(OSDefaults.get_facts())
|
facts.merge!(OSDefaults.get_facts())
|
||||||
end
|
end
|
||||||
|
|
||||||
it_configures 'mistral cors'
|
it_behaves_like 'mistral::cors'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user