icingaweb2__config__roles_spec.rb 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. require 'spec_helper'
  2. describe 'icingaweb2::config::roles' do
  3. context 'with no set values' do
  4. let(:title) { 'admins' }
  5. it 'should absent all settings' do
  6. should contain_ini_setting('icingaweb2 roles admins users').with_ensure('absent')
  7. should contain_ini_setting('icingaweb2 roles admins groups').with_ensure('absent')
  8. should contain_ini_setting('icingaweb2 roles admins permissions').with_ensure('absent')
  9. should contain_ini_setting('icingaweb2 roles admins host filter').with_ensure('absent')
  10. should contain_ini_setting('icingaweb2 roles admins service filter').with_ensure('absent')
  11. end
  12. end
  13. context 'with values' do
  14. let(:title) { 'Test' }
  15. let(:params) do
  16. {
  17. :role_name => 'test',
  18. :role_users => 'icingaadmin,icingauser',
  19. :role_groups => 'icingaadmins',
  20. :role_permissions => '*',
  21. :role_host_filter => '*',
  22. :role_service_filter => '*',
  23. }
  24. end
  25. it 'should add settings' do
  26. should contain_ini_setting('icingaweb2 roles Test users').with({
  27. :ensure => :present,
  28. :section => 'test',
  29. :setting => 'users',
  30. :value => '"icingaadmin,icingauser"',
  31. })
  32. should contain_ini_setting('icingaweb2 roles Test groups').with({
  33. :ensure => :present,
  34. :section => 'test',
  35. :setting => 'groups',
  36. :value => '"icingaadmins"',
  37. })
  38. should contain_ini_setting('icingaweb2 roles Test permissions').with({
  39. :ensure => :present,
  40. :section => 'test',
  41. :setting => 'permissions',
  42. :value => '"*"',
  43. })
  44. should contain_ini_setting('icingaweb2 roles Test host filter').with({
  45. :ensure => :present,
  46. :section => 'test',
  47. :setting => 'monitoring/hosts/filter',
  48. :value => '"*"',
  49. })
  50. should contain_ini_setting('icingaweb2 roles Test service filter').with({
  51. :ensure => :present,
  52. :section => 'test',
  53. :setting => 'monitoring/services/filter',
  54. :value => '"*"',
  55. })
  56. end
  57. end
  58. end