Do not test detail of oslo::cors

This change makes unit test cases for keystone::cors, so that these
tests do not test behavir of oslo::cors but how oslo::cors resource
type is called by keystone::cors.

Change-Id: I3cc08b121435168ecfcf127bd87d570f394fb009
changes/18/799018/1
Takashi Kajinami 1 year ago
parent fea3ef551c
commit cb6f19237f
  1. 34
      spec/classes/keystone_cors_spec.rb

@ -1,14 +1,17 @@
require 'spec_helper'
describe 'keystone::cors' do
shared_examples 'keystone::cors' do
shared_examples_for 'keystone::cors' do
it 'configure cors default params' do
is_expected.to contain_keystone_config('cors/allowed_origin').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('cors/allow_credentials').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('cors/expose_headers').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('cors/max_age').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('cors/allow_methods').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('cors/allow_headers').with_value('<SERVICE DEFAULT>')
is_expected.to contain_oslo__cors('keystone_config').with(
:allowed_origin => '<SERVICE DEFAULT>',
:allow_credentials => '<SERVICE DEFAULT>',
:expose_headers => '<SERVICE DEFAULT>',
:max_age => '<SERVICE DEFAULT>',
:allow_methods => '<SERVICE DEFAULT>',
:allow_headers => '<SERVICE DEFAULT>',
)
end
context 'with specific parameters' do
@ -23,18 +26,20 @@ describe 'keystone::cors' do
end
it 'configure cors params' do
is_expected.to contain_keystone_config('cors/allowed_origin').with_value('*')
is_expected.to contain_keystone_config('cors/allow_credentials').with_value(true)
is_expected.to contain_keystone_config('cors/expose_headers').with_value('Content-Language,Expires')
is_expected.to contain_keystone_config('cors/max_age').with_value(3600)
is_expected.to contain_keystone_config('cors/allow_methods').with_value('GET,POST,PUT,DELETE,OPTIONS')
is_expected.to contain_keystone_config('cors/allow_headers').with_value('Content-Type,Cache-Control')
is_expected.to contain_oslo__cors('keystone_config').with(
:allowed_origin => '*',
:allow_credentials => true,
:expose_headers => 'Content-Language,Expires',
:max_age => 3600,
:allow_methods => 'GET,POST,PUT,DELETE,OPTIONS',
:allow_headers => 'Content-Type,Cache-Control',
)
end
end
end
on_supported_os({
:supported_os => OSDefaults.get_supported_os
:supported_os => OSDefaults.get_supported_os
}).each do |os,facts|
context "on #{os}" do
let (:facts) do
@ -44,4 +49,5 @@ describe 'keystone::cors' do
it_behaves_like 'keystone::cors'
end
end
end

Loading…
Cancel
Save