'desktop icon should be hidden if doctype\'s restrict to domain is not in active domains'

def test_desktop_icon_for_domainification(self):

    test_doctype = self.new_doctype(u'Test    Domainification')
    test_doctype.restrict_to_domain = u'_Test    Domain    2'
    test_doctype.insert()
    self.add_active_domain(u'_Test    Domain    2')
    add_user_icon(u'Test    Domainification')
    icons = get_desktop_icons()
    doctypes = [icon.get(u'_doctype') for icon in icons if ((icon.get(u'_doctype') == u'Test    Domainification') and (icon.get(u'blocked') == 0))]
    self.assertTrue((u'Test    Domainification' in doctypes))
    self.remove_from_active_domains(u'_Test    Domain    2')
    clear_desktop_icons_cache()
    icons = get_desktop_icons()
    doctypes = [icon.get(u'_doctype') for icon in icons if ((icon.get(u'_doctype') == u'Test    Domainification') and (icon.get(u'blocked') == 0))]
    self.assertFalse((u'Test    Domainification' in doctypes))
