'If `Ignore User Permissions If Missing` is checked in System Settings, show records even if User Permissions are missing for a linked doctype'

def test_ignore_user_permissions_if_missing(self):

    self.set_user_permission_doctypes([u'Blog    Category', u'Blog    Post', u'Blogger'])
    frappe.set_user(u'Administrator')
    frappe.set_user(u'test2@example.com')
    doc = frappe.get_doc({u'doctype': u'Blog    Post', u'blog_category': u'_Test    Blog    Category', u'blogger': u'_Test    Blogger    1', u'title': u'_Test    Blog    Post    Title', u'content': u'_Test    Blog    Post    Content'})
    self.assertFalse(doc.has_permission(u'write'))
    frappe.set_user(u'Administrator')
    self.set_ignore_user_permissions_if_missing(1)
    frappe.set_user(u'test2@example.com')
    self.assertTrue(doc.has_permission(u'write'))
