コード例 #1
0
    def test_get_offset(self):
        '''
        Test if it get current numeric timezone offset from UCT (i.e. +0530)
        '''
        time = ('(UTC+05:30) Chennai, Kolkata, Mumbai, \
        New Delhi\nIndia Standard Time')
        mock_cmd = MagicMock(side_effect=['India Standard Time', time])
        with patch.dict(win_timezone.__salt__, {'cmd.run': mock_cmd}):
            self.assertEqual(win_timezone.get_offset(), '+0530')

        mock_cmd = MagicMock(return_value='India Standard Time')
        with patch.dict(win_timezone.__salt__, {'cmd.run': mock_cmd}):
            self.assertFalse(win_timezone.get_offset())
コード例 #2
0
ファイル: win_timezone_test.py プロジェクト: DaveQB/salt
    def test_get_offset(self):
        '''
        Test if it get current numeric timezone offset from UCT (i.e. +0530)
        '''
        time = ('(UTC+05:30) Chennai, Kolkata, Mumbai, \
        New Delhi\nIndia Standard Time')
        mock_cmd = MagicMock(side_effect=['India Standard Time', time])
        with patch.dict(win_timezone.__salt__, {'cmd.run': mock_cmd}):
            self.assertEqual(win_timezone.get_offset(), '+0530')

        mock_cmd = MagicMock(return_value='India Standard Time')
        with patch.dict(win_timezone.__salt__, {'cmd.run': mock_cmd}):
            self.assertFalse(win_timezone.get_offset())
コード例 #3
0
ファイル: test_win_timezone.py プロジェクト: morinap/salt-1
    def test_get_offset(self):
        '''
        Test if it get current numeric timezone offset from UCT (i.e. +0530)
        '''
        mock_read = MagicMock(return_value={'vdata': 'India Standard Time'})

        with patch.dict(win_timezone.__utils__, {'reg.read_value': mock_read}):
            self.assertEqual(win_timezone.get_offset(), '+0530')
コード例 #4
0
ファイル: test_win_timezone.py プロジェクト: zxstar/salt
    def test_get_offset(self):
        """
        Test if it get current numeric timezone offset from UCT (i.e. +0530)
        """
        mock_read = MagicMock(return_value={"vdata": "India Standard Time"})

        with patch.dict(win_timezone.__utils__, {"reg.read_value": mock_read}):
            self.assertEqual(win_timezone.get_offset(), "+0530")
コード例 #5
0
ファイル: test_win_timezone.py プロジェクト: zlfei/salt
    def test_get_offset(self):
        '''
        Test if it get current numeric timezone offset from UCT (i.e. +0530)
        '''
        # time = ('(UTC+05:30) Chennai, Kolkata, Mumbai, \
        # New Delhi\nIndia Standard Time')
        # mock_cmd = MagicMock(side_effect=['India Standard Time', time])
        # with patch.dict(win_timezone.__salt__, {'cmd.run': mock_cmd}):

        mock_read = MagicMock(return_value={'vdata': 'India Standard Time'})

        with patch.dict(win_timezone.__utils__, {'reg.read_value': mock_read}):
            self.assertEqual(win_timezone.get_offset(), '+0530')
コード例 #6
0
    def test_get_offset(self):
        """
        Test if it get current numeric timezone offset from UCT (i.e. +0530)
        """
        mock_read = MagicMock(
            return_value={
                "pid": 78,
                "retcode": 0,
                "stderr": "",
                "stdout": "India Standard Time",
            })

        with patch.dict(win_timezone.__salt__, {"cmd.run_all": mock_read}):
            self.assertEqual(win_timezone.get_offset(), "+0530")