mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 08:58:59 +00:00
54 lines
1.3 KiB
Python
54 lines
1.3 KiB
Python
# -*- coding: utf-8 -*-
|
|
|
|
'''
|
|
Tests for the rabbitmq state
|
|
'''
|
|
# Import python libs
|
|
from __future__ import absolute_import
|
|
import os
|
|
|
|
# Import Salt Testing libs
|
|
from salttesting.helpers import ensure_in_syspath
|
|
ensure_in_syspath('../../')
|
|
|
|
# Import salt libs
|
|
import integration
|
|
|
|
|
|
class RabbitVHostTestCase(integration.ModuleCase,
|
|
integration.SaltReturnAssertsMixIn):
|
|
'''
|
|
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')
|
|
if os.geteuid() != 0:
|
|
self.skipTest('You must be root to run this test')
|
|
|
|
def test_present(self):
|
|
'''
|
|
rabbitmq_vhost.present null_host
|
|
'''
|
|
ret = self.run_state(
|
|
'rabbitmq_vhost.present', name='null_host', test=True
|
|
)
|
|
self.assertSaltFalseReturn(ret)
|
|
|
|
def absent(self):
|
|
'''
|
|
rabbitmq_vhost.absent null_host
|
|
'''
|
|
ret = self.run_state(
|
|
'rabbitmq_vhost.absent', name='null_host', test=True
|
|
)
|
|
self.assertSaltFalseReturn(ret)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
from integration import run_tests
|
|
run_tests(RabbitVHostTestCase)
|