Ejemplo n.º 1
0
 def test_examine_quiet(self):
     '''
     Test for mdadm_raid.examine
     '''
     mock = MagicMock(return_value='')
     with patch.dict(mdadm.__salt__, {'cmd.run_stdout': mock}):
         self.assertEqual(mdadm.examine('/dev/md0', quiet=True), {})
         mock.assert_called_with('mdadm -Y -E /dev/md0', ignore_retcode=True,
                                 python_shell=False)
Ejemplo n.º 2
0
 def test_examine_quiet(self):
     """
     Test for mdadm_raid.examine
     """
     mock = MagicMock(return_value="")
     with patch.dict(mdadm.__salt__, {"cmd.run_stdout": mock}):
         self.assertEqual(mdadm.examine("/dev/md0", quiet=True), {})
         mock.assert_called_with("mdadm -Y -E /dev/md0",
                                 ignore_retcode=True,
                                 python_shell=False)
Ejemplo n.º 3
0
 def test_examine(self):
     '''
     Test for mdadm_raid.examine
     '''
     mock = MagicMock(return_value='ARRAY /dev/md/pool metadata=1.2 UUID=567da122:fb8e445e:55b853e0:81bd0a3e name=positron:pool')
     with patch.dict(mdadm.__salt__, {'cmd.run_stdout': mock}):
         self.assertEqual(mdadm.examine('/dev/md0'),
                          {
                              'ARRAY /dev/md/pool metadata': '1.2 UUID=567da122:fb8e445e:55b853e0:81bd0a3e name=positron:pool'
                          })
         mock.assert_called_with('mdadm -Y -E /dev/md0', ignore_retcode=False,
                                 python_shell=False)
Ejemplo n.º 4
0
def test_examine():
    """
    Test for mdadm_raid.examine
    """
    mock = MagicMock(return_value=(
        "ARRAY /dev/md/pool metadata=1.2"
        " UUID=567da122:fb8e445e:55b853e0:81bd0a3e name=positron:pool"))
    with patch.dict(mdadm.__salt__, {"cmd.run_stdout": mock}):
        assert mdadm.examine("/dev/md0") == {
            "ARRAY /dev/md/pool metadata":
            ("1.2 UUID=567da122:fb8e445e:55b853e0:81bd0a3e"
             " name=positron:pool")
        }
        mock.assert_called_with("mdadm -Y -E /dev/md0",
                                ignore_retcode=False,
                                python_shell=False)