X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=3rdparty%2Fmodules%2Fkeystone%2Fspec%2Fclasses%2Fkeystone_ldap_spec.rb;h=0d36624c456166129656902d40b37913dba6daa0;hb=56e59e695d67665c4983de22b8a3864a192817d9;hp=088526e8697940a6a3956f7d1dbf66a030f3cb39;hpb=4631045ebb77ee8622f6fa09277a50c372bcc02e;p=mirror%2Fdsa-puppet.git diff --git a/3rdparty/modules/keystone/spec/classes/keystone_ldap_spec.rb b/3rdparty/modules/keystone/spec/classes/keystone_ldap_spec.rb index 088526e86..0d36624c4 100644 --- a/3rdparty/modules/keystone/spec/classes/keystone_ldap_spec.rb +++ b/3rdparty/modules/keystone/spec/classes/keystone_ldap_spec.rb @@ -73,6 +73,7 @@ describe 'keystone::ldap' do :tls_cacertfile => '/etc/ssl/certs/ca-certificates.crt', :tls_req_cert => 'demand', :identity_driver => 'keystone.identity.backends.ldap.Identity', + :credential_driver => 'keystone.credential.backends.ldap.Credential', :assignment_driver => 'keystone.assignment.backends.ldap.Assignment', :use_pool => 'True', :pool_size => 20, @@ -85,104 +86,105 @@ describe 'keystone::ldap' do :auth_pool_connection_lifetime => 200, } end - it { should contain_package('python-ldap') } - it { should contain_package('python-ldappool') } + it { is_expected.to contain_package('python-ldap') } + it { is_expected.to contain_package('python-ldappool') } it 'should have basic params' do # basic params - should contain_keystone_config('ldap/url').with_value('ldap://foo') - should contain_keystone_config('ldap/user').with_value('cn=foo,dc=example,dc=com') - should contain_keystone_config('ldap/password').with_value('abcdefg').with_secret(true) - should contain_keystone_config('ldap/suffix').with_value('dc=example,dc=com') - should contain_keystone_config('ldap/query_scope').with_value('sub') - should contain_keystone_config('ldap/page_size').with_value('50') + is_expected.to contain_keystone_config('ldap/url').with_value('ldap://foo') + is_expected.to contain_keystone_config('ldap/user').with_value('cn=foo,dc=example,dc=com') + is_expected.to contain_keystone_config('ldap/password').with_value('abcdefg').with_secret(true) + is_expected.to contain_keystone_config('ldap/suffix').with_value('dc=example,dc=com') + is_expected.to contain_keystone_config('ldap/query_scope').with_value('sub') + is_expected.to contain_keystone_config('ldap/page_size').with_value('50') # users - should contain_keystone_config('ldap/user_tree_dn').with_value('cn=users,dc=example,dc=com') - should contain_keystone_config('ldap/user_filter').with_value('(memberOf=cn=openstack,cn=groups,cn=accounts,dc=example,dc=com)') - should contain_keystone_config('ldap/user_objectclass').with_value('inetUser') - should contain_keystone_config('ldap/user_id_attribute').with_value('uid') - should contain_keystone_config('ldap/user_name_attribute').with_value('cn') - should contain_keystone_config('ldap/user_mail_attribute').with_value('mail') - should contain_keystone_config('ldap/user_enabled_attribute').with_value('UserAccountControl') - should contain_keystone_config('ldap/user_enabled_mask').with_value('2') - should contain_keystone_config('ldap/user_enabled_default').with_value('512') - should contain_keystone_config('ldap/user_enabled_invert').with_value('False') - should contain_keystone_config('ldap/user_attribute_ignore').with_value('') - should contain_keystone_config('ldap/user_default_project_id_attribute').with_value('defaultProject') - should contain_keystone_config('ldap/user_tree_dn').with_value('cn=users,dc=example,dc=com') - should contain_keystone_config('ldap/user_allow_create').with_value('False') - should contain_keystone_config('ldap/user_allow_update').with_value('False') - should contain_keystone_config('ldap/user_allow_delete').with_value('False') - should contain_keystone_config('ldap/user_pass_attribute').with_value('krbPassword') - should contain_keystone_config('ldap/user_enabled_emulation').with_value('True') - should contain_keystone_config('ldap/user_enabled_emulation_dn').with_value('cn=openstack-enabled,cn=groups,cn=accounts,dc=example,dc=com') - should contain_keystone_config('ldap/user_additional_attribute_mapping').with_value('description:name, gecos:name') + is_expected.to contain_keystone_config('ldap/user_tree_dn').with_value('cn=users,dc=example,dc=com') + is_expected.to contain_keystone_config('ldap/user_filter').with_value('(memberOf=cn=openstack,cn=groups,cn=accounts,dc=example,dc=com)') + is_expected.to contain_keystone_config('ldap/user_objectclass').with_value('inetUser') + is_expected.to contain_keystone_config('ldap/user_id_attribute').with_value('uid') + is_expected.to contain_keystone_config('ldap/user_name_attribute').with_value('cn') + is_expected.to contain_keystone_config('ldap/user_mail_attribute').with_value('mail') + is_expected.to contain_keystone_config('ldap/user_enabled_attribute').with_value('UserAccountControl') + is_expected.to contain_keystone_config('ldap/user_enabled_mask').with_value('2') + is_expected.to contain_keystone_config('ldap/user_enabled_default').with_value('512') + is_expected.to contain_keystone_config('ldap/user_enabled_invert').with_value('False') + is_expected.to contain_keystone_config('ldap/user_attribute_ignore').with_value('') + is_expected.to contain_keystone_config('ldap/user_default_project_id_attribute').with_value('defaultProject') + is_expected.to contain_keystone_config('ldap/user_tree_dn').with_value('cn=users,dc=example,dc=com') + is_expected.to contain_keystone_config('ldap/user_allow_create').with_value('False') + is_expected.to contain_keystone_config('ldap/user_allow_update').with_value('False') + is_expected.to contain_keystone_config('ldap/user_allow_delete').with_value('False') + is_expected.to contain_keystone_config('ldap/user_pass_attribute').with_value('krbPassword') + is_expected.to contain_keystone_config('ldap/user_enabled_emulation').with_value('True') + is_expected.to contain_keystone_config('ldap/user_enabled_emulation_dn').with_value('cn=openstack-enabled,cn=groups,cn=accounts,dc=example,dc=com') + is_expected.to contain_keystone_config('ldap/user_additional_attribute_mapping').with_value('description:name, gecos:name') # projects/tenants - should contain_keystone_config('ldap/project_tree_dn').with_value('ou=projects,ou=openstack,dc=example,dc=com') - should contain_keystone_config('ldap/project_filter').with_value('') - should contain_keystone_config('ldap/project_objectclass').with_value('organizationalUnit') - should contain_keystone_config('ldap/project_id_attribute').with_value('ou') - should contain_keystone_config('ldap/project_member_attribute').with_value('member') - should contain_keystone_config('ldap/project_desc_attribute').with_value('description') - should contain_keystone_config('ldap/project_name_attribute').with_value('ou') - should contain_keystone_config('ldap/project_enabled_attribute').with_value('enabled') - should contain_keystone_config('ldap/project_domain_id_attribute').with_value('businessCategory') - should contain_keystone_config('ldap/project_attribute_ignore').with_value('') - should contain_keystone_config('ldap/project_allow_create').with_value('True') - should contain_keystone_config('ldap/project_allow_update').with_value('True') - should contain_keystone_config('ldap/project_allow_delete').with_value('True') - should contain_keystone_config('ldap/project_enabled_emulation').with_value('False') - should contain_keystone_config('ldap/project_enabled_emulation_dn').with_value('True') - should contain_keystone_config('ldap/project_additional_attribute_mapping').with_value('cn=enabled,ou=openstack,dc=example,dc=com') + is_expected.to contain_keystone_config('ldap/project_tree_dn').with_value('ou=projects,ou=openstack,dc=example,dc=com') + is_expected.to contain_keystone_config('ldap/project_filter').with_value('') + is_expected.to contain_keystone_config('ldap/project_objectclass').with_value('organizationalUnit') + is_expected.to contain_keystone_config('ldap/project_id_attribute').with_value('ou') + is_expected.to contain_keystone_config('ldap/project_member_attribute').with_value('member') + is_expected.to contain_keystone_config('ldap/project_desc_attribute').with_value('description') + is_expected.to contain_keystone_config('ldap/project_name_attribute').with_value('ou') + is_expected.to contain_keystone_config('ldap/project_enabled_attribute').with_value('enabled') + is_expected.to contain_keystone_config('ldap/project_domain_id_attribute').with_value('businessCategory') + is_expected.to contain_keystone_config('ldap/project_attribute_ignore').with_value('') + is_expected.to contain_keystone_config('ldap/project_allow_create').with_value('True') + is_expected.to contain_keystone_config('ldap/project_allow_update').with_value('True') + is_expected.to contain_keystone_config('ldap/project_allow_delete').with_value('True') + is_expected.to contain_keystone_config('ldap/project_enabled_emulation').with_value('False') + is_expected.to contain_keystone_config('ldap/project_enabled_emulation_dn').with_value('True') + is_expected.to contain_keystone_config('ldap/project_additional_attribute_mapping').with_value('cn=enabled,ou=openstack,dc=example,dc=com') # roles - should contain_keystone_config('ldap/role_tree_dn').with_value('ou=roles,ou=openstack,dc=example,dc=com') - should contain_keystone_config('ldap/role_filter').with_value('') - should contain_keystone_config('ldap/role_objectclass').with_value('organizationalRole') - should contain_keystone_config('ldap/role_id_attribute').with_value('cn') - should contain_keystone_config('ldap/role_name_attribute').with_value('ou') - should contain_keystone_config('ldap/role_member_attribute').with_value('roleOccupant') - should contain_keystone_config('ldap/role_attribute_ignore').with_value('description') - should contain_keystone_config('ldap/role_allow_create').with_value('True') - should contain_keystone_config('ldap/role_allow_update').with_value('True') - should contain_keystone_config('ldap/role_allow_delete').with_value('True') - should contain_keystone_config('ldap/role_additional_attribute_mapping').with_value('') + is_expected.to contain_keystone_config('ldap/role_tree_dn').with_value('ou=roles,ou=openstack,dc=example,dc=com') + is_expected.to contain_keystone_config('ldap/role_filter').with_value('') + is_expected.to contain_keystone_config('ldap/role_objectclass').with_value('organizationalRole') + is_expected.to contain_keystone_config('ldap/role_id_attribute').with_value('cn') + is_expected.to contain_keystone_config('ldap/role_name_attribute').with_value('ou') + is_expected.to contain_keystone_config('ldap/role_member_attribute').with_value('roleOccupant') + is_expected.to contain_keystone_config('ldap/role_attribute_ignore').with_value('description') + is_expected.to contain_keystone_config('ldap/role_allow_create').with_value('True') + is_expected.to contain_keystone_config('ldap/role_allow_update').with_value('True') + is_expected.to contain_keystone_config('ldap/role_allow_delete').with_value('True') + is_expected.to contain_keystone_config('ldap/role_additional_attribute_mapping').with_value('') # groups - should contain_keystone_config('ldap/group_tree_dn').with_value('ou=groups,ou=openstack,dc=example,dc=com') - should contain_keystone_config('ldap/group_filter').with_value('cn=enabled-groups,cn=groups,cn=accounts,dc=example,dc=com') - should contain_keystone_config('ldap/group_objectclass').with_value('organizationalRole') - should contain_keystone_config('ldap/group_id_attribute').with_value('cn') - should contain_keystone_config('ldap/group_member_attribute').with_value('roleOccupant') - should contain_keystone_config('ldap/group_desc_attribute').with_value('description') - should contain_keystone_config('ldap/group_name_attribute').with_value('cn') - should contain_keystone_config('ldap/group_attribute_ignore').with_value('') - should contain_keystone_config('ldap/group_allow_create').with_value('False') - should contain_keystone_config('ldap/group_allow_update').with_value('False') - should contain_keystone_config('ldap/group_allow_delete').with_value('False') - should contain_keystone_config('ldap/group_additional_attribute_mapping').with_value('') + is_expected.to contain_keystone_config('ldap/group_tree_dn').with_value('ou=groups,ou=openstack,dc=example,dc=com') + is_expected.to contain_keystone_config('ldap/group_filter').with_value('cn=enabled-groups,cn=groups,cn=accounts,dc=example,dc=com') + is_expected.to contain_keystone_config('ldap/group_objectclass').with_value('organizationalRole') + is_expected.to contain_keystone_config('ldap/group_id_attribute').with_value('cn') + is_expected.to contain_keystone_config('ldap/group_member_attribute').with_value('roleOccupant') + is_expected.to contain_keystone_config('ldap/group_desc_attribute').with_value('description') + is_expected.to contain_keystone_config('ldap/group_name_attribute').with_value('cn') + is_expected.to contain_keystone_config('ldap/group_attribute_ignore').with_value('') + is_expected.to contain_keystone_config('ldap/group_allow_create').with_value('False') + is_expected.to contain_keystone_config('ldap/group_allow_update').with_value('False') + is_expected.to contain_keystone_config('ldap/group_allow_delete').with_value('False') + is_expected.to contain_keystone_config('ldap/group_additional_attribute_mapping').with_value('') # tls - should contain_keystone_config('ldap/use_tls').with_value('False') - should contain_keystone_config('ldap/tls_cacertdir').with_value('/etc/ssl/certs/') - should contain_keystone_config('ldap/tls_cacertfile').with_value('/etc/ssl/certs/ca-certificates.crt') - should contain_keystone_config('ldap/tls_req_cert').with_value('demand') + is_expected.to contain_keystone_config('ldap/use_tls').with_value('False') + is_expected.to contain_keystone_config('ldap/tls_cacertdir').with_value('/etc/ssl/certs/') + is_expected.to contain_keystone_config('ldap/tls_cacertfile').with_value('/etc/ssl/certs/ca-certificates.crt') + is_expected.to contain_keystone_config('ldap/tls_req_cert').with_value('demand') # ldap pooling - should contain_keystone_config('ldap/use_pool').with_value('True') - should contain_keystone_config('ldap/pool_size').with_value('20') - should contain_keystone_config('ldap/pool_retry_max').with_value('2') - should contain_keystone_config('ldap/pool_retry_delay').with_value('0.2') - should contain_keystone_config('ldap/pool_connection_timeout').with_value('222') - should contain_keystone_config('ldap/pool_connection_lifetime').with_value('222') - should contain_keystone_config('ldap/use_auth_pool').with_value('True') - should contain_keystone_config('ldap/auth_pool_size').with_value('20') - should contain_keystone_config('ldap/auth_pool_connection_lifetime').with_value('200') + is_expected.to contain_keystone_config('ldap/use_pool').with_value('True') + is_expected.to contain_keystone_config('ldap/pool_size').with_value('20') + is_expected.to contain_keystone_config('ldap/pool_retry_max').with_value('2') + is_expected.to contain_keystone_config('ldap/pool_retry_delay').with_value('0.2') + is_expected.to contain_keystone_config('ldap/pool_connection_timeout').with_value('222') + is_expected.to contain_keystone_config('ldap/pool_connection_lifetime').with_value('222') + is_expected.to contain_keystone_config('ldap/use_auth_pool').with_value('True') + is_expected.to contain_keystone_config('ldap/auth_pool_size').with_value('20') + is_expected.to contain_keystone_config('ldap/auth_pool_connection_lifetime').with_value('200') # drivers - should contain_keystone_config('identity/driver').with_value('keystone.identity.backends.ldap.Identity') - should contain_keystone_config('assignment/driver').with_value('keystone.assignment.backends.ldap.Assignment') + is_expected.to contain_keystone_config('identity/driver').with_value('keystone.identity.backends.ldap.Identity') + is_expected.to contain_keystone_config('credential/driver').with_value('keystone.credential.backends.ldap.Credential') + is_expected.to contain_keystone_config('assignment/driver').with_value('keystone.assignment.backends.ldap.Assignment') end end @@ -208,22 +210,22 @@ describe 'keystone::ldap' do } end it 'should work with deprecated params' do - should contain_keystone_config('ldap/project_tree_dn').with_value('ou=projects,ou=openstack,dc=example,dc=com') - should contain_keystone_config('ldap/project_filter').with_value('') - should contain_keystone_config('ldap/project_objectclass').with_value('organizationalUnit') - should contain_keystone_config('ldap/project_id_attribute').with_value('ou') - should contain_keystone_config('ldap/project_member_attribute').with_value('member') - should contain_keystone_config('ldap/project_desc_attribute').with_value('description') - should contain_keystone_config('ldap/project_name_attribute').with_value('ou') - should contain_keystone_config('ldap/project_enabled_attribute').with_value('enabled') - should contain_keystone_config('ldap/project_domain_id_attribute').with_value('businessCategory') - should contain_keystone_config('ldap/project_attribute_ignore').with_value('') - should contain_keystone_config('ldap/project_allow_create').with_value('True') - should contain_keystone_config('ldap/project_allow_update').with_value('True') - should contain_keystone_config('ldap/project_allow_delete').with_value('True') - should contain_keystone_config('ldap/project_enabled_emulation').with_value('False') - should contain_keystone_config('ldap/project_enabled_emulation_dn').with_value('True') - should contain_keystone_config('ldap/project_additional_attribute_mapping').with_value('cn=enabled,ou=openstack,dc=example,dc=com') + is_expected.to contain_keystone_config('ldap/project_tree_dn').with_value('ou=projects,ou=openstack,dc=example,dc=com') + is_expected.to contain_keystone_config('ldap/project_filter') + is_expected.to contain_keystone_config('ldap/project_objectclass').with_value('organizationalUnit') + is_expected.to contain_keystone_config('ldap/project_id_attribute').with_value('ou') + is_expected.to contain_keystone_config('ldap/project_member_attribute').with_value('member') + is_expected.to contain_keystone_config('ldap/project_desc_attribute').with_value('description') + is_expected.to contain_keystone_config('ldap/project_name_attribute').with_value('ou') + is_expected.to contain_keystone_config('ldap/project_enabled_attribute').with_value('enabled') + is_expected.to contain_keystone_config('ldap/project_domain_id_attribute').with_value('businessCategory') + is_expected.to contain_keystone_config('ldap/project_attribute_ignore') + is_expected.to contain_keystone_config('ldap/project_allow_create').with_value('True') + is_expected.to contain_keystone_config('ldap/project_allow_update').with_value('True') + is_expected.to contain_keystone_config('ldap/project_allow_delete').with_value('True') + is_expected.to contain_keystone_config('ldap/project_enabled_emulation').with_value('False') + is_expected.to contain_keystone_config('ldap/project_enabled_emulation_dn').with_value('True') + is_expected.to contain_keystone_config('ldap/project_additional_attribute_mapping').with_value('cn=enabled,ou=openstack,dc=example,dc=com') end end @@ -234,10 +236,7 @@ describe 'keystone::ldap' do :project_tree_dn => 'ou=projects,ou=new-openstack,dc=example,dc=com', } end - it 'should fail with deprecated and new params both set' do - expect { - should compile - }.to raise_error Puppet::Error, /tenant_tree_dn and project_tree_dn are both set. results may be unexpected/ - end + + it_raises 'a Puppet::Error', /tenant_tree_dn and project_tree_dn are both set. results may be unexpected/ end end