2013-06-27 11:40:13 +00:00
|
|
|
# Import python libs
|
2012-10-19 14:05:35 +00:00
|
|
|
import os
|
2013-06-25 08:24:45 +00:00
|
|
|
|
2013-06-27 11:40:13 +00:00
|
|
|
# Import Salt Testing libs
|
|
|
|
from salttesting.helpers import ensure_in_syspath
|
|
|
|
ensure_in_syspath('../../')
|
|
|
|
|
2013-06-25 08:24:45 +00:00
|
|
|
# Import salt libs
|
2013-06-27 11:40:13 +00:00
|
|
|
import integration
|
2012-10-19 14:05:35 +00:00
|
|
|
|
|
|
|
|
|
|
|
class RabbitModuleTest(integration.ModuleCase):
|
|
|
|
'''
|
|
|
|
Validates the rabbitmqctl functions.
|
|
|
|
To run these tests, you will need to be able to access the rabbitmqctl
|
|
|
|
commands.
|
|
|
|
'''
|
|
|
|
def setUp(self):
|
|
|
|
super(RabbitModuleTest, self).setUp()
|
|
|
|
ret = self.run_function('cmd.has_exec', ['rabbitmqctl'])
|
|
|
|
if not ret:
|
|
|
|
self.skipTest('RabbitMQ not installed')
|
|
|
|
if os.geteuid() != 0:
|
2012-12-11 15:37:30 +00:00
|
|
|
self.skipTest('You must be root to run this test')
|
2012-10-19 14:05:35 +00:00
|
|
|
|
|
|
|
def test_user_exists(self):
|
|
|
|
'''
|
|
|
|
Find out whether a user exists.
|
|
|
|
'''
|
|
|
|
ret = self.run_function('rabbitmq.user_exists', ['null_user'])
|
|
|
|
self.assertEqual(ret, False)
|
|
|
|
|
2013-06-25 08:24:45 +00:00
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
from integration import run_tests
|
|
|
|
run_tests(RabbitModuleTest)
|