1
0

test_rabbitmq_vhost.py 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. # -*- coding: utf-8 -*-
  2. '''
  3. Tests for the rabbitmq state
  4. '''
  5. # Import python libs
  6. from __future__ import absolute_import, unicode_literals, print_function
  7. # Import Salt Testing libs
  8. from tests.support.case import ModuleCase
  9. from tests.support.helpers import skip_if_not_root
  10. from tests.support.mixins import SaltReturnAssertsMixin
  11. @skip_if_not_root
  12. class RabbitVHostTestCase(ModuleCase, SaltReturnAssertsMixin):
  13. '''
  14. Validate the rabbitmq virtual host states.
  15. '''
  16. def setUp(self):
  17. super(RabbitVHostTestCase, self).setUp()
  18. rabbit_installed = self.run_function('cmd.has_exec', ['rabbitmqctl'])
  19. if not rabbit_installed:
  20. self.skipTest('rabbitmq-server not installed')
  21. def test_present(self):
  22. '''
  23. rabbitmq_vhost.present null_host
  24. '''
  25. ret = self.run_state(
  26. 'rabbitmq_vhost.present', name='null_host', test=True
  27. )
  28. self.assertSaltFalseReturn(ret)
  29. def absent(self):
  30. '''
  31. rabbitmq_vhost.absent null_host
  32. '''
  33. ret = self.run_state(
  34. 'rabbitmq_vhost.absent', name='null_host', test=True
  35. )
  36. self.assertSaltFalseReturn(ret)