def test_get_hwclock(self):
        mock_t = MagicMock(return_value=True)
        mock_f = MagicMock(return_value=False)

        with patch.object(salt.utils, 'which', return_value=True):
            with patch.object(timezone, '_timedatectl',
                             MagicMock(return_value={'stdout': 'rtc in local tz:yes\n'})):
                self.assertEqual(timezone.get_hwclock(), 'localtime')

            with patch.object(timezone, '_timedatectl',
                             MagicMock(return_value={'stdout': 'rtc in local tz:No\n'})):
                self.assertEqual(timezone.get_hwclock(), 'UTC')

            with patch.object(timezone, '_timedatectl',
                              MagicMock(return_value={'stdout': 'rtc'})):
                self.assertRaises(CommandExecutionError, timezone.get_hwclock)

        with patch.object(salt.utils, 'which', return_value=False):
            with patch.dict(timezone.__grains__, {'os_family': 'RedHat'}):
                with patch.dict(timezone.__salt__,
                                {'cmd.run':
                                 MagicMock(return_value='A')}):
                    self.assertEqual(timezone.get_hwclock(), 'A')

            with patch.dict(timezone.__grains__, {'os_family': 'Suse'}):
                with patch.dict(timezone.__salt__,
                                {'cmd.run':
                                 MagicMock(return_value='A')}):
                    self.assertEqual(timezone.get_hwclock(), 'A')

            with patch.dict(timezone.__grains__, {'os_family': 'Debian'}):
                fl_data = 'UTC=yes\n'
                with patch('salt.utils.fopen',
                           mock_open(read_data=fl_data)) as mfile:
                    mfile.return_value.__iter__.return_value = [fl_data]
                    self.assertEqual(timezone.get_hwclock(), 'UTC')

                fl_data = 'UTC=no\n'
                with patch('salt.utils.fopen',
                           mock_open(read_data=fl_data)) as mfile:
                    mfile.return_value.__iter__.return_value = [fl_data]
                    self.assertEqual(timezone.get_hwclock(), 'localtime')

            with patch.dict(timezone.__grains__, {'os_family': 'Gentoo'}):
                fl_data = 'clock=UTC\n'
                with patch('salt.utils.fopen',
                           mock_open(read_data=fl_data)) as mfile:
                    mfile.return_value.__iter__.return_value = [fl_data]
                    self.assertEqual(timezone.get_hwclock(), 'UTC')

        with patch.object(os.path, 'isfile', mock_t):
            fl_data = 'zone_info=GMT'
            with patch('salt.utils.fopen',
                       mock_open(read_data=fl_data),
                       create=True) as mfile:
                mfile.return_value.__iter__.return_value = fl_data.splitlines()
                with patch.object(salt.utils, 'which', return_value=False):
                    with patch.dict(timezone.__grains__,
                                    {'os_family': 'Solaris'}):
                        self.assertEqual(timezone.get_hwclock(), 'UTC')

        with patch.object(os.path, 'isfile', mock_t):
            fl_data = 'A=GMT'
            with patch('salt.utils.fopen',
                       mock_open(read_data=fl_data),
                       create=True) as mfile:
                mfile.return_value.__iter__.return_value = fl_data.splitlines()
                with patch.object(salt.utils, 'which', return_value=False):
                    with patch.dict(timezone.__grains__,
                                    {'os_family': 'Solaris'}):
                        self.assertEqual(timezone.get_hwclock(), 'localtime')

        with patch.object(salt.utils, 'which', return_value=False):
            with patch.dict(timezone.__grains__, {'os_family': 'Solaris'}):
                with patch.object(os.path, 'isfile', mock_f):
                    self.assertEqual(timezone.get_hwclock(), 'UTC')
simply gets the server banner 
dataset/ETHPy150Open saltstack/salt/tests/unit/modules/timezone_test.py/TimezoneTestCase.test_get_hwclock--crossover with--dataset/ETHPy150Open x3omdax/PenBox/Versions/V1.3/penbox.py/TNscan.getServerBanner