2013-11-27 11:19:24 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
2012-10-19 15:07:31 +00:00
|
|
|
'''
|
|
|
|
Tests for the rabbitmq state
|
|
|
|
'''
|
2013-06-27 12:48:18 +00:00
|
|
|
# Import python libs
|
2018-01-21 22:35:52 +00:00
|
|
|
from __future__ import absolute_import, unicode_literals, print_function
|
2013-06-25 08:24:45 +00:00
|
|
|
|
2013-06-27 12:48:18 +00:00
|
|
|
# Import Salt Testing libs
|
2017-04-03 16:04:09 +00:00
|
|
|
from tests.support.case import ModuleCase
|
2017-04-04 17:57:27 +00:00
|
|
|
from tests.support.helpers import skip_if_not_root
|
2017-04-02 16:09:47 +00:00
|
|
|
from tests.support.mixins import SaltReturnAssertsMixin
|
2012-10-19 15:07:31 +00:00
|
|
|
|
|
|
|
|
2017-04-04 17:57:27 +00:00
|
|
|
@skip_if_not_root
|
2017-04-03 16:04:09 +00:00
|
|
|
class RabbitVHostTestCase(ModuleCase, SaltReturnAssertsMixin):
|
2012-10-19 15:07:31 +00:00
|
|
|
'''
|
|
|
|
Validate the rabbitmq virtual host states.
|
|
|
|
'''
|
|
|
|
def setUp(self):
|
|
|
|
super(RabbitVHostTestCase, self).setUp()
|
|
|
|
rabbit_installed = self.run_function('cmd.has_exec', ['rabbitmqctl'])
|
|
|
|
|
|
|
|
if not rabbit_installed:
|
|
|
|
self.skipTest('rabbitmq-server not installed')
|
|
|
|
|
|
|
|
def test_present(self):
|
|
|
|
'''
|
|
|
|
rabbitmq_vhost.present null_host
|
|
|
|
'''
|
2012-10-19 15:28:38 +00:00
|
|
|
ret = self.run_state(
|
2012-12-07 17:01:31 +00:00
|
|
|
'rabbitmq_vhost.present', name='null_host', test=True
|
|
|
|
)
|
|
|
|
self.assertSaltFalseReturn(ret)
|
2012-10-19 15:07:31 +00:00
|
|
|
|
|
|
|
def absent(self):
|
|
|
|
'''
|
|
|
|
rabbitmq_vhost.absent null_host
|
|
|
|
'''
|
2012-10-19 15:28:38 +00:00
|
|
|
ret = self.run_state(
|
2012-12-07 17:01:31 +00:00
|
|
|
'rabbitmq_vhost.absent', name='null_host', test=True
|
|
|
|
)
|
|
|
|
self.assertSaltFalseReturn(ret)
|