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