test_rabbitmq_vhost.py 1.0 KB

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