コード例 #1
0
ファイル: zpool_test.py プロジェクト: shineforever/ops
 def test_exists_success(self):
     '''
     Tests successful return of exists function
     '''
     ret = "NAME      SIZE  ALLOC   FREE    CAP  DEDUP  HEALTH  ALTROOT\nmyzpool   149G   128K   149G     0%  1.00x  ONLINE  -"
     mock_cmd = MagicMock(return_value=ret)
     with patch.dict(zpool.__salt__, {'cmd.run': mock_cmd}):
         self.assertTrue(zpool.exists('myzpool'))
コード例 #2
0
 def test_exists_success(self):
     '''
     Tests successful return of exists function
     '''
     ret = "NAME      SIZE  ALLOC   FREE    CAP  DEDUP  HEALTH  ALTROOT\nmyzpool   149G   128K   149G     0%  1.00x  ONLINE  -"
     mock_cmd = MagicMock(return_value=ret)
     with patch.dict(zpool.__salt__, {'cmd.run': mock_cmd}):
         self.assertTrue(zpool.exists('myzpool'))
コード例 #3
0
ファイル: test_zpool.py プロジェクト: bsemar/IntCont
 def test_exists_failure(self):
     '''
     Tests failure return of exists function
     '''
     ret = {}
     ret['stdout'] = ""
     ret['stderr'] = "cannot open 'myzpool': no such pool"
     ret['retcode'] = 1
     mock_cmd = MagicMock(return_value=ret)
     with patch.dict(zpool.__salt__, {'cmd.run_all': mock_cmd}):
         self.assertFalse(zpool.exists('myzpool'))
コード例 #4
0
ファイル: zpool_test.py プロジェクト: HowardMei/saltstack
 def test_exists_failure(self):
     '''
     Tests failure return of exists function
     '''
     ret = {}
     ret['stdout'] = ""
     ret['stderr'] = "cannot open 'myzpool': no such pool"
     ret['retcode'] = 1
     mock_cmd = MagicMock(return_value=ret)
     with patch.dict(zpool.__salt__, {'cmd.run_all': mock_cmd}):
         self.assertFalse(zpool.exists('myzpool'))
コード例 #5
0
ファイル: test_zpool.py プロジェクト: nikhiljha/salt
    def test_exists_failure(self):
        """
        Tests failure return of exists function
        """
        ret = {}
        ret["stdout"] = ""
        ret["stderr"] = "cannot open 'myzpool': no such pool"
        ret["retcode"] = 1
        mock_cmd = MagicMock(return_value=ret)

        with patch.dict(zpool.__salt__, {"cmd.run_all": mock_cmd}), patch.dict(
                zpool.__utils__, self.utils_patch):
            self.assertFalse(zpool.exists("myzpool"))
コード例 #6
0
ファイル: test_zpool.py プロジェクト: yutiansut/salt
 def test_exists_success(self):
     '''
     Tests successful return of exists function
     '''
     ret = {}
     ret['stdout'] = "NAME      SIZE  ALLOC   FREE    CAP  DEDUP  HEALTH  ALTROOT\n" \
                     "myzpool   149G   128K   149G     0%  1.00x  ONLINE  -"
     ret['stderr'] = ""
     ret['retcode'] = 0
     mock_cmd = MagicMock(return_value=ret)
     with patch.dict(zpool.__salt__, {'cmd.run_all': mock_cmd}), \
          patch.dict(zpool.__utils__, self.utils_patch):
         self.assertTrue(zpool.exists('myzpool'))
コード例 #7
0
ファイル: test_zpool.py プロジェクト: nikhiljha/salt
 def test_exists_success(self):
     """
     Tests successful return of exists function
     """
     ret = {}
     ret["stdout"] = (
         "NAME      SIZE  ALLOC   FREE    CAP  DEDUP  HEALTH  ALTROOT\n"
         "myzpool   149G   128K   149G     0%  1.00x  ONLINE  -")
     ret["stderr"] = ""
     ret["retcode"] = 0
     mock_cmd = MagicMock(return_value=ret)
     with patch.dict(zpool.__salt__, {"cmd.run_all": mock_cmd}), patch.dict(
             zpool.__utils__, self.utils_patch):
         self.assertTrue(zpool.exists("myzpool"))