コード例 #1
0
 def test_set_zone(self):
     '''
     Test if it unlinks, then symlinks /etc/localtime to the set timezone.
     '''
     mock_cmd = MagicMock(return_value=0)
     with patch.dict(win_timezone.__salt__, {'cmd.retcode': mock_cmd}):
         self.assertTrue(win_timezone.set_zone('Asia/Calcutta'))
コード例 #2
0
ファイル: win_timezone_test.py プロジェクト: DaveQB/salt
 def test_set_zone(self):
     '''
     Test if it unlinks, then symlinks /etc/localtime to the set timezone.
     '''
     mock_cmd = MagicMock(return_value=0)
     with patch.dict(win_timezone.__salt__, {'cmd.retcode': mock_cmd}):
         self.assertTrue(win_timezone.set_zone('Asia/Calcutta'))
コード例 #3
0
ファイル: test_win_timezone.py プロジェクト: morinap/salt-1
    def test_set_zone(self):
        '''
        Test if it unlinks, then symlinks /etc/localtime to the set timezone.
        '''
        mock_cmd = MagicMock(return_value={'pid': 78,
                                           'retcode': 0,
                                           'stderr': '',
                                           'stdout': ''})
        mock_read = MagicMock(return_value={'vdata': 'India Standard Time'})

        with patch.dict(win_timezone.__salt__, {'cmd.run_all': mock_cmd}), \
                patch.dict(win_timezone.__utils__, {'reg.read_value': mock_read}):

            self.assertTrue(win_timezone.set_zone('Asia/Calcutta'))
コード例 #4
0
ファイル: test_win_timezone.py プロジェクト: zxstar/salt
    def test_set_zone(self):
        """
        Test if it unlinks, then symlinks /etc/localtime to the set timezone.
        """
        mock_cmd = MagicMock(return_value={
            "pid": 78,
            "retcode": 0,
            "stderr": "",
            "stdout": ""
        })
        mock_read = MagicMock(return_value={"vdata": "India Standard Time"})

        with patch.dict(win_timezone.__salt__,
                        {"cmd.run_all": mock_cmd}), patch.dict(
                            win_timezone.__utils__,
                            {"reg.read_value": mock_read}):

            self.assertTrue(win_timezone.set_zone("Asia/Calcutta"))
コード例 #5
0
def test_set_zone():
    """
    Test if it unlinks, then symlinks /etc/localtime to the set timezone.
    """
    mock_write = MagicMock(
        return_value={"pid": 78, "retcode": 0, "stderr": "", "stdout": ""}
    )
    mock_read = MagicMock(
        return_value={
            "pid": 78,
            "retcode": 0,
            "stderr": "",
            "stdout": "India Standard Time",
        }
    )

    with patch.dict(win_timezone.__salt__, {"cmd.run_all": mock_write}), patch.dict(
        win_timezone.__salt__, {"cmd.run_all": mock_read}
    ):
        assert win_timezone.set_zone("Asia/Calcutta")