def test__on_taskend(self):
        # write backup hosts file which is used to replace blocked one
        open(self.backup_hosts_file, 'w', 0).write(_HOST_FILE_DATA)

        # write "blocked" hosts file
        open(self.plugin.hosts_file, 'w', 0).write(_BLKD_HOST_FILE_DATA)

        domains = [
            'google.com', 'm.google.com', 'www.google.com',
            'mobile.google.com', 'twitter.com', 'm.twitter.com',
            'www.twitter.com', 'mobile.twitter.com'
        ]

        self.plugin.domains = set(domains)
        self.plugin.on_taskend(self.task)

        self.assertEqual(open(self.plugin.hosts_file, 'r').read(),
                          _HOST_FILE_DATA)

        # backup removed
        self.assertFalse(os.path.isfile(self.backup_hosts_file))
SiteBlock.on_taskend: removes domain blocks from hosts file.
dataset/ETHPy150Open xtrementl/focus/tests/unit/plugin/modules/test_sites.py/TestSiteBlock.test__on_taskend