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'))
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'))
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"))
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")