Esempio n. 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())
Esempio n. 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())
Esempio n. 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')
Esempio n. 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")
Esempio n. 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')
Esempio n. 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")