Exemplo n.º 1
0
def test_check_password_gt_38():
    """
    Test if it checks a user's password for RabbitMQ greater than v3.8.
    """
    mock_run = MagicMock(return_value="RabbitMQ version: 3.8.3")
    mock_run2 = MagicMock(
        return_value={
            "retcode": 0,
            "stdout": 'Authenticating user "saltstack" ...\nSuccess',
            "stderr": "",
        })
    with patch.dict(rabbitmq.__salt__, {
            "cmd.run": mock_run,
            "cmd.run_all": mock_run2
    }):
        assert rabbitmq.check_password("saltstack", "salt@123")
Exemplo n.º 2
0
 def test_check_password_lt_38(self):
     """
     Test if it checks a user's password for RabbitMQ less than v3.8.
     """
     mock_run = MagicMock(return_value='{rabbit,"RabbitMQ","3.5.7"}')
     mock_run2 = MagicMock(
         return_value={
             "retcode": 0,
             "stdout": 'Authenticating user "saltstack" ...\nSuccess',
             "stderr": "",
         }
     )
     with patch.dict(
         rabbitmq.__salt__, {"cmd.run": mock_run, "cmd.run_all": mock_run2}
     ):
         self.assertEqual(rabbitmq.check_password("saltstack", "salt@123"), True)