Exemplo n.º 1
0
 def test_user_exists(self):
     '''
     Test if it return whether the user exists based
     on rabbitmqctl list_users.
     '''
     mock_run = MagicMock(return_value='saltstack')
     with patch.dict(rabbitmq.__salt__, {'cmd.run': mock_run}):
         self.assertFalse(rabbitmq.user_exists('rabbit_user'))
Exemplo n.º 2
0
 def test_user_exists(self):
     '''
     Test if it return whether the user exists based
     on rabbitmqctl list_users.
     '''
     mock_run = MagicMock(return_value='saltstack')
     with patch.dict(rabbitmq.__salt__, {'cmd.run': mock_run}):
         self.assertFalse(rabbitmq.user_exists('rabbit_user'))
Exemplo n.º 3
0
 def test_user_exists_negative(self):
     '''
     Negative test of whether rabbitmq-internal user exists based
     on rabbitmqctl list_users.
     '''
     mock_run = MagicMock(return_value='Listing users ...\nsaltstack\t[administrator]\n...done')
     with patch.dict(rabbitmq.__salt__, {'cmd.run': mock_run}):
         self.assertFalse(rabbitmq.user_exists('rabbit_user'))
Exemplo n.º 4
0
 def test_user_exists(self):
     '''
     Test whether a given rabbitmq-internal user exists based
     on rabbitmqctl list_users.
     '''
     mock_run = MagicMock(return_value='Listing users ...\nsaltstack\t[administrator]\n...done')
     with patch.dict(rabbitmq.__salt__, {'cmd.run': mock_run}):
         self.assertTrue(rabbitmq.user_exists('saltstack'))
Exemplo n.º 5
0
 def test_user_exists(self):
     '''
     Test whether a given rabbitmq-internal user exists based
     on rabbitmqctl list_users.
     '''
     mock_run = MagicMock(return_value='Listing users ...\nsaltstack\t[administrator]\n...done')
     with patch.dict(rabbitmq.__salt__, {'cmd.run': mock_run}):
         self.assertTrue(rabbitmq.user_exists('saltstack'))
Exemplo n.º 6
0
 def test_user_exists_negative(self):
     '''
     Negative test of whether rabbitmq-internal user exists based
     on rabbitmqctl list_users.
     '''
     mock_run = MagicMock(return_value='Listing users ...\nsaltstack\t[administrator]\n...done')
     with patch.dict(rabbitmq.__salt__, {'cmd.run': mock_run}):
         self.assertFalse(rabbitmq.user_exists('rabbit_user'))
Exemplo n.º 7
0
def test_user_exists_negative():
    """
    Negative test of whether rabbitmq-internal user exists based
    on rabbitmqctl list_users.
    """
    mock_run = MagicMock(
        return_value={
            "retcode": 0,
            "stdout": "Listing users ...\nsaltstack\t[administrator]\n...done",
            "stderr": "",
        })
    with patch.dict(rabbitmq.__salt__, {"cmd.run_all": mock_run}):
        assert not rabbitmq.user_exists("salt")
Exemplo n.º 8
0
 def test_user_exists_negative(self):
     '''
     Negative test of whether rabbitmq-internal user exists based
     on rabbitmqctl list_users.
     '''
     mock_run = MagicMock(
         return_value={
             'retcode': 0,
             'stdout': 'Listing users ...\n'
             'saltstack\t[administrator]\n...done',
             'stderr': ''
         })
     with patch.dict(rabbitmq.__salt__, {'cmd.run_all': mock_run}):
         self.assertFalse(rabbitmq.user_exists('salt'))
Exemplo n.º 9
0
 def test_user_exists(self):
     """
     Test whether a given rabbitmq-internal user exists based
     on rabbitmqctl list_users.
     """
     mock_run = MagicMock(
         return_value={
             "retcode": 0,
             "stdout": "Listing users ...\n"
             "saltstack\t[administrator]\n...done",
             "stderr": "",
         })
     with patch.dict(rabbitmq.__salt__, {"cmd.run_all": mock_run}):
         self.assertTrue(rabbitmq.user_exists("saltstack"))