'test if doctype is hidden if the doctype\'s restrict to domain is not included
in active domains'

def test_doctype_and_role_domainification(self):

    test_doctype = self.new_doctype(u'Test    Domainification')
    test_doctype.insert()
    test_role = frappe.get_doc({u'doctype': u'Role', u'role_name': u'_Test    Role'}).insert()
    results = get_roles_and_doctypes()
    self.assertTrue((u'Test    Domainification' in results.get(u'doctypes')))
    self.assertTrue((u'_Test    Role' in results.get(u'roles')))
    self.add_active_domain(u'_Test    Domain    2')
    test_doctype.restrict_to_domain = u'_Test    Domain    2'
    test_doctype.save()
    test_role.restrict_to_domain = u'_Test    Domain    2'
    test_role.save()
    results = get_roles_and_doctypes()
    self.assertTrue((u'Test    Domainification' in results.get(u'doctypes')))
    self.assertTrue((u'_Test    Role' in results.get(u'roles')))
    self.remove_from_active_domains(u'_Test    Domain    2')
    results = get_roles_and_doctypes()
    self.assertTrue((u'Test    Domainification' not in results.get(u'doctypes')))
    self.assertTrue((u'_Test    Role' not in results.get(u'roles')))
