Пример #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
 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
    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
    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")