 c409f6e269
			
		
	
	c409f6e269
	
	
	
		
			
			This change introduces the new cloudkitty::cors class, which manages parameters of the cors middleware from oslo.middleware. Change-Id: Ida34189343e2202b557e71c214bfe5c01c6759fa
		
			
				
	
	
		
			54 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			Ruby
		
	
	
	
	
	
			
		
		
	
	
			54 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			Ruby
		
	
	
	
	
	
| require 'spec_helper'
 | |
| 
 | |
| describe 'cloudkitty::cors' do
 | |
| 
 | |
|   shared_examples_for 'cloudkitty::cors' do
 | |
|     it 'configure cors default params' do
 | |
|       is_expected.to contain_oslo__cors('cloudkitty_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
 | |
|       let :params do
 | |
|         { :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
 | |
| 
 | |
|       it 'configure cors params' do
 | |
|         is_expected.to contain_oslo__cors('cloudkitty_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
 | |
|   }).each do |os,facts|
 | |
|     context "on #{os}" do
 | |
|       let (:facts) do
 | |
|         facts.merge!(OSDefaults.get_facts())
 | |
|       end
 | |
| 
 | |
|       it_behaves_like 'cloudkitty::cors'
 | |
|     end
 | |
|   end
 | |
| 
 | |
| end
 |