def test_set_zone(self):
        def zone_checking_and_unlinking():
            ret = ('Zone does not exist: /usr/share/lib/zoneinfo/timezone')
            mock_exists = MagicMock(side_effect=[False, True, True])
            with patch.object(os.path, 'exists', mock_exists):
                self.assertEqual(timezone.set_zone('timezone'), ret)

                with patch.object(os, 'unlink', return_value=None):
                    with patch.dict(timezone.__salt__,
                                    {'file.sed':
                                     MagicMock(return_value=None)}):
                        self.assertTrue(timezone.set_zone('timezone'))

        with patch.dict(timezone.__grains__, {'os_family': 'Solaris'}):
            with patch.object(salt.utils, 'which', return_value=False):
                zone_checking_and_unlinking()

            with patch.object(salt.utils, 'which', return_value=True):
                with patch.dict(timezone.__salt__, {'cmd.run': MagicMock(return_value='')}):
                    zone_checking_and_unlinking()
Test to unlinks, then symlinks /etc/localtime to the set timezone.
dataset/ETHPy150Open saltstack/salt/tests/unit/modules/timezone_test.py/TimezoneTestCase.test_set_zone