コード例 #1
0
    def test_version(self):
        '''
        Test for return rsync version
        '''
        mock = MagicMock(side_effect=[OSError(1, 'f'), 'A B C\n'])
        with patch.dict(rsync.__salt__, {'cmd.run_stdout': mock}):
            self.assertRaises(CommandExecutionError, rsync.version)

            self.assertEqual(rsync.version(), 'C')
コード例 #2
0
ファイル: rsync_test.py プロジェクト: HowardMei/saltstack
    def test_version(self):
        '''
        Test for return rsync version
        '''
        mock = MagicMock(side_effect=[IOError('f'), 'A B C\n'])
        with patch.dict(rsync.__salt__, {'cmd.run_stdout': mock}):
            self.assertRaises(CommandExecutionError, rsync.version)

            self.assertEqual(rsync.version(), 'C')
コード例 #3
0
    def test_version(self):
        """
        Test for return rsync version
        """
        mock = MagicMock(side_effect=[OSError(1, "f"), "A B C\n"])
        with patch.dict(rsync.__salt__, {"cmd.run_stdout": mock}):
            self.assertRaises(CommandExecutionError, rsync.version)

            self.assertEqual(rsync.version(), "C")