From 81cab9a2df7e14ce29578418777fa7ab95398cef Mon Sep 17 00:00:00 2001 From: Harald Jensas Date: Fri, 13 Jan 2017 20:00:23 +0100 Subject: [PATCH] Federation openidc - spec test wrong filename + typos Closes-Bug: #1655666 Change-Id: I72eca737c392064f3874c103d295db13be354194 --- ...rb => keystone_federation_openidc_spec.rb} | 69 +++++++++++-------- 1 file changed, 41 insertions(+), 28 deletions(-) rename spec/classes/{keystone_federation_openidc.rb => keystone_federation_openidc_spec.rb} (57%) diff --git a/spec/classes/keystone_federation_openidc.rb b/spec/classes/keystone_federation_openidc_spec.rb similarity index 57% rename from spec/classes/keystone_federation_openidc.rb rename to spec/classes/keystone_federation_openidc_spec.rb index 4347c29f9..668bfeb06 100644 --- a/spec/classes/keystone_federation_openidc.rb +++ b/spec/classes/keystone_federation_openidc_spec.rb @@ -2,44 +2,61 @@ require 'spec_helper' describe 'keystone::federation::openidc' do - describe 'with invalid params' do + let(:pre_condition) do + <<-EOS + class { 'keystone': + admin_token => 'service_token', + admin_password => 'special_password', + } + + include apache + + class { 'keystone::wsgi::apache': } + EOS + end + + let :params do + { :methods => 'password, token, openidc', + :idp_name => 'myidp', + :openidc_provider_metadata_url => 'https://accounts.google.com/.well-known/openid-configuration', + :openidc_client_id => 'openid_client_id', + :openidc_client_secret => 'openid_client_secret', + :template_order => 331 + } + end + + context 'with invalid params' do before do params.merge!(:methods => 'external, password, token, oauth1') + it_raises 'a Puppet::Error', /The external method should be dropped to avoid any interference with openidc/ end - it_raises 'a Puppet::Error', /The external method should be dropped to avoid any interference with openidc/ - before do params.merge!(:methods => 'password, token, oauth1') + it_raises 'a Puppet::Error', /Methods should contain openidc as one of the auth methods./ end - it_raises 'a Puppet::Error', /Methods should contain openidc as one of the auth methods./ - before do params.merge!(:methods => 'password, token, oauth1, openidc', :module_plugin => 'keystone.auth.plugins') + it_raises 'a Puppet:Error', /The plugin for openidc should be keystone.auth.plugins.mapped.Mapped/ end - it_raises 'a Puppet:Error', /The plugin for openidc should be keystone.auth.plugins.mapped.Mapped/ - before do params.merge!(:admin_port => false, :main_port => false) + it_raises 'a Puppet:Error', /No VirtualHost port to configure, please choose at least one./ end - it_raises 'a Puppet:Error', /No VirtualHost port to configure, please choose at least one./ - - befode do + before do params.merge!(:template_port => 330) + it_raises 'a Puppet:Error', /The template order should be greater than 330 and less than 999./ end - it_raises 'a Puppet:Error', /The template order should be greater than 330 and less than 999./ - - befode do + before do params.merge!(:template_port => 999) + it_raises 'a Puppet:Error', /The template order should be greater than 330 and less than 999./ end - - it_raises 'a Puppet:Error', /The template order should be greater than 330 and less than 999./ end on_supported_os({ @@ -52,35 +69,32 @@ describe 'keystone::federation::openidc' do case facts[:osfamily] when 'Debian' { - :openidc_package_name => 'libapache2-mod-auth-mellon', + :openidc_package_name => 'libapache2-mod-auth-openidc', } when 'RedHat' { - :openidc_package_name => 'mod_auth_openidc' + :openidc_package_name => 'mod_auth_openidc', } end end context 'with only required parameters' do - let :params do - { :methods => 'password, token, openidc' } - end - it 'should have basic params for mellon in Keystone configuration' do is_expected.to contain_keystone_config('auth/methods').with_value('password, token, openidc') is_expected.to contain_keystone_config('auth/openidc').with_value('keystone.auth.plugins.mapped.Mapped') end it { is_expected.to contain_concat__fragment('configure_openidc_on_port_5000').with({ - :target => "${keystone::wsgi::apache::priority}-keystone_wsgi_main.conf", + :target => "10-keystone_wsgi_main.conf", :order => params[:template_order], })} end context 'with override default parameters' do - let :params do - { :methods => 'password, token, openidc', - :admin_port => true } + before do + params.merge!({ + :admin_port => true, + }) end it 'should have basic params for mellon in Keystone configuration' do @@ -89,12 +103,12 @@ describe 'keystone::federation::openidc' do end it { is_expected.to contain_concat__fragment('configure_openidc_on_port_5000').with({ - :target => "${keystone::wsgi::apache::priority}-keystone_wsgi_main.conf", + :target => "10-keystone_wsgi_main.conf", :order => params[:template_order], })} it { is_expected.to contain_concat__fragment('configure_openidc_on_port_35357').with({ - :target => "${keystone::wsgi::apache::priority}-keystone_wsgi_admin.conf", + :target => "10-keystone_wsgi_admin.conf", :order => params[:template_order], })} end @@ -102,5 +116,4 @@ describe 'keystone::federation::openidc' do it { is_expected.to contain_package(platform_parameters[:openidc_package_name]) } end - end