u'** /2-rootpage/2-1-subpage/', u'** /2-rootpage/2-2-subpage/', # permitViewGroup == test_group1 u'*** /2-rootpage/2-2-subpage/2-2-1-subpage/', # permitViewGroup == test_group2 u'*** /2-rootpage/2-2-subpage/2-2-2-subpage/', u'* /3-pluginpage/' ]) # Put user *only* in "test group2" user.groups.remove(test_group1) tree = PageTree.objects.get_tree(user) #tree.debug() #self._print_flat_tree(tree) self.assertTree( tree, should_data=[ u'* /1-rootpage/', u'** /1-rootpage/1-1-subpage/', u'** /1-rootpage/1-2-subpage/', u'* /2-rootpage/', u'** /2-rootpage/2-1-subpage/', #u'** /2-rootpage/2-2-subpage/', # permitViewGroup == test_group1 #u'*** /2-rootpage/2-2-subpage/2-2-1-subpage/', # permitViewGroup == test_group2 #u'*** /2-rootpage/2-2-subpage/2-2-2-subpage/', u'* /3-pluginpage/' ]) if __name__ == "__main__": # Run this unitest directly unittest_base.direct_run(__file__)
), ) def test_add_headfiles(self): """ Add content into html head with {% extrahead %} block tag in plugin template. """ for site in TestSites(): for language in TestLanguages(): url = "/%s/%s/test_add_headfiles/" % ( language.code, unittest_plugin.PLUGIN_PAGE_URL) response = self.client.get(url, HTTP_ACCEPT_LANGUAGE=language.code) self.assertResponse( response, must_contain=( "Here ist the unittest plugin extra head content ;)", "The unittest plugin content...", '3-pluginpage title (lang:%(language)s, site:%(site_name)s)' % { "language": language.code, "site_name": site.name, }, ), must_not_contain=("Traceback", )) if __name__ == "__main__": # Run this unitest directly unittest_base.direct_run(__file__) # Run all tests in this file
u'** /1-rootpage/1-2-subpage/', u'* /2-rootpage/', u'** /2-rootpage/2-1-subpage/', u'** /2-rootpage/2-2-subpage/', # permitViewGroup == test_group1 u'*** /2-rootpage/2-2-subpage/2-2-1-subpage/', # permitViewGroup == test_group2 u'*** /2-rootpage/2-2-subpage/2-2-2-subpage/', u'* /3-pluginpage/'] ) # Put user *only* in "test group2" user.groups.remove(test_group1) tree = PageTree.objects.get_tree(user) #tree.debug() #self._print_flat_tree(tree) self.assertTree(tree, should_data= [u'* /1-rootpage/', u'** /1-rootpage/1-1-subpage/', u'** /1-rootpage/1-2-subpage/', u'* /2-rootpage/', u'** /2-rootpage/2-1-subpage/', #u'** /2-rootpage/2-2-subpage/', # permitViewGroup == test_group1 #u'*** /2-rootpage/2-2-subpage/2-2-1-subpage/', # permitViewGroup == test_group2 #u'*** /2-rootpage/2-2-subpage/2-2-2-subpage/', u'* /3-pluginpage/'] ) if __name__ == "__main__": # Run this unitest directly unittest_base.direct_run(__file__)
'1-rootpage content', # normal page content ), ) def test_add_headfiles(self): """ Add content into html head with {% extrahead %} block tag in plugin template. """ for site in TestSites(): for language in TestLanguages(): url = "/%s/%s/test_add_headfiles/" % (language.code, unittest_plugin.PLUGIN_PAGE_URL) response = self.client.get(url, HTTP_ACCEPT_LANGUAGE=language.code) self.assertResponse(response, must_contain=( "Here ist the unittest plugin extra head content ;)", "The unittest plugin content...", '3-pluginpage title (lang:%(language)s, site:%(site_name)s)' % { "language": language.code, "site_name": site.name, }, ), must_not_contain=( "Traceback", ) ) if __name__ == "__main__": # Run this unitest directly unittest_base.direct_run(__file__) # Run all tests in this file