'simulate behaviour of group b member
group_d_ACCESS_PAGE to page_d
nostaff user'

def test_node_staff_access_page_group_5_nostaff(self):

    self._setup_user_groups()
    all_pages = self._setup_tree_pages()
    self._setup_view_restrictions()
    granted = ['page_d']
    self.assertGrantedVisibility(all_pages, granted, username='user_5_nostaff')
    if (get_user_model().USERNAME_FIELD == 'email'):
        user = get_user_model().objects.get(email='user_5_nostaff@django-cms.org')
    else:
        user = get_user_model().objects.get(username='user_5_nostaff')
    urls = self.get_url_dict(all_pages)
    url = self.get_pages_root()
    self.assertViewNotAllowed(urls[url], user)
    self.assertViewAllowed(urls['/en/page_d/'], user)
    self.assertViewNotAllowed(urls['/en/page_b/'], user)
    self.assertViewNotAllowed(urls['/en/page_b/page_b_a/'], user)
    self.assertViewNotAllowed(urls['/en/page_b/page_b_b/'], user)
    self.assertViewNotAllowed(urls['/en/page_b/page_b_c/'], user)
    self.assertViewNotAllowed(urls['/en/page_b/page_b_d/'], user)
    self.assertViewNotAllowed(urls['/en/page_b/page_b_b/page_b_b_a/'], user)
    self.assertViewNotAllowed(urls['/en/page_c/'], user)
    self.assertViewAllowed(urls['/en/page_d/'], user)
    self.assertViewNotAllowed(urls['/en/page_d/page_d_a/'], user)
    self.assertViewNotAllowed(urls['/en/page_d/page_d_b/'], user)
    self.assertViewNotAllowed(urls['/en/page_d/page_d_c/'], user)
    self.assertViewNotAllowed(urls['/en/page_d/page_d_d/'], user)
