def test_get_enabled(self):
        """
        Test to return a list of all enabled services
        """
        cmd_mock = MagicMock(return_value=_LIST_UNIT_FILES)
        listdir_mock = MagicMock(return_value=["foo", "bar", "baz", "README"])
        sd_mock = MagicMock(
            return_value={x.replace(".service", "") for x in _SYSTEMCTL_STATUS}
        )
        access_mock = MagicMock(
            side_effect=lambda x, y: x
            != os.path.join(systemd.INITSCRIPT_PATH, "README")
        )
        sysv_enabled_mock = MagicMock(side_effect=lambda x, _: x == "baz")

        with patch.dict(systemd.__salt__, {"cmd.run": cmd_mock}):
            with patch.object(os, "listdir", listdir_mock):
                with patch.object(systemd, "_get_systemd_services", sd_mock):
                    with patch.object(os, "access", side_effect=access_mock):
                        with patch.object(systemd, "_sysv_enabled", sysv_enabled_mock):
                            self.assertListEqual(
                                systemd.get_enabled(),
                                [
                                    "baz",
                                    "service1",
                                    "service10",
                                    "service4",
                                    "service7",
                                    "timer1.timer",
                                    "timer10.timer",
                                    "timer4.timer",
                                    "timer7.timer",
                                ],
                            )
    def test_get_enabled(self):
        '''
        Test to return a list of all enabled services
        '''
        cmd_mock = MagicMock(return_value=_LIST_UNIT_FILES)
        listdir_mock = MagicMock(return_value=['foo', 'bar', 'baz', 'README'])
        sd_mock = MagicMock(
            return_value=set(
                [x.replace('.service', '') for x in _SYSTEMCTL_STATUS]
            )
        )
        access_mock = MagicMock(
            side_effect=lambda x, y: x != os.path.join(
                systemd.INITSCRIPT_PATH,
                'README'
            )
        )
        sysv_enabled_mock = MagicMock(side_effect=lambda x, _: x == 'baz')

        with patch.dict(systemd.__salt__, {'cmd.run': cmd_mock}):
            with patch.object(os, 'listdir', listdir_mock):
                with patch.object(systemd, '_get_systemd_services', sd_mock):
                    with patch.object(os, 'access', side_effect=access_mock):
                        with patch.object(systemd, '_sysv_enabled',
                                          sysv_enabled_mock):
                            self.assertListEqual(
                                systemd.get_enabled(),
                                ['baz', 'service1', 'timer1.timer']
                            )
    def test_get_enabled(self):
        """
        Test to return a list of all enabled services
        """
        cmd_mock = MagicMock(return_value=_LIST_UNIT_FILES)
        listdir_mock = MagicMock(return_value=["foo", "bar", "baz", "README"])
        sd_mock = MagicMock(return_value=set(
            [x.replace(".service", "") for x in _SYSTEMCTL_STATUS]))
        access_mock = MagicMock(side_effect=lambda x, y: x != os.path.join(
            systemd.INITSCRIPT_PATH, "README"))
        sysv_enabled_mock = MagicMock(side_effect=lambda x, _: x == 'baz')

        with patch.dict(systemd.__salt__, {'cmd.run': cmd_mock}):
            with patch.object(os, 'listdir', listdir_mock):
                with patch.object(systemd, '_get_systemd_services', sd_mock):
                    with patch.object(os, 'access', side_effect=access_mock):
                        with patch.object(systemd, '_sysv_enabled',
                                          sysv_enabled_mock):
                            self.assertListEqual(
                                systemd.get_enabled(),
                                ["baz", "service1", "timer1.timer"],
                            )