<s> from django . template import Template <EOL> from cms . api import create_page <EOL> from cms . models import Page <EOL> from cms . test_utils . testcases import CMSTestCase <EOL> from cms . templatetags . cms_admin import preview_link <EOL> from cms . utils . i18n import force_language <EOL> from django . test . utils import override_settings <EOL> from menus . base import NavigationNode <EOL> @ override_settings ( ROOT_URLCONF = '<STR_LIT>' ) <EOL> class NonRootCase ( CMSTestCase ) : <EOL> def setUp ( self ) : <EOL> u = self . _create_user ( "<STR_LIT:test>" , True , True ) <EOL> with self . login_user_context ( u ) : <EOL> self . create_some_pages ( ) <EOL> def create_some_pages ( self ) : <EOL> """<STR_LIT>""" <EOL> self . page1 = create_page ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , <EOL> published = True , in_navigation = True ) <EOL> self . page2 = create_page ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , <EOL> parent = self . page1 , published = True , in_navigation = True ) <EOL> self . page3 = create_page ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , <EOL> parent = self . page2 , published = True , in_navigation = True ) <EOL> self . page4 = create_page ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , <EOL> published = True , in_navigation = True ) <EOL> self . all_pages = [ self . page1 , self . page2 , self . page3 , self . page4 ] <EOL> self . top_level_pages = [ self . page1 , self . page4 ] <EOL> self . level1_pages = [ self . page2 ] <EOL> self . level2_pages = [ self . page3 ] <EOL> def test_get_page_root ( self ) : <EOL> self . assertEqual ( self . get_pages_root ( ) , '<STR_LIT>' ) <EOL> def test_basic_cms_menu ( self ) : <EOL> response = self . client . get ( self . get_pages_root ( ) ) <EOL> self . assertEqual ( response . status_code , <NUM_LIT:200> ) <EOL> self . assertEqual ( self . get_pages_root ( ) , "<STR_LIT>" ) <EOL> def test_show_menu ( self ) : <EOL> context = self . get_context ( ) <EOL> tpl = Template ( "<STR_LIT>" ) <EOL> tpl . render ( context ) <EOL> nodes = context [ '<STR_LIT>' ] <EOL> self . assertEqual ( nodes [ <NUM_LIT:0> ] . get_absolute_url ( ) , self . get_pages_root ( ) ) <EOL> self . assertEqual ( nodes [ <NUM_LIT:0> ] . get_absolute_url ( ) , "<STR_LIT>" ) <EOL> def test_show_breadcrumb ( self ) : <EOL> page2 = Page . objects . get ( pk = self . page2 . pk ) <EOL> context = self . get_context ( path = self . page2 . get_absolute_url ( ) ) <EOL> tpl = Template ( "<STR_LIT>" ) <EOL> tpl . render ( context ) <EOL> nodes = context [ '<STR_LIT>' ] <EOL> self . assertEqual ( nodes [ <NUM_LIT:0> ] . get_absolute_url ( ) , self . get_pages_root ( ) ) <EOL> self . assertEqual ( nodes [ <NUM_LIT:0> ] . get_absolute_url ( ) , "<STR_LIT>" ) <EOL> self . assertEqual ( isinstance ( nodes [ <NUM_LIT:0> ] , NavigationNode ) , True ) <EOL> self . assertEqual ( nodes [ <NUM_LIT:1> ] . get_absolute_url ( ) , page2 . get_absolute_url ( ) ) <EOL> def test_form_multilingual_admin ( self ) : <EOL> """<STR_LIT>""" <EOL> language = '<STR_LIT>' <EOL> with force_language ( "<STR_LIT>" ) : <EOL> pages_root = self . get_pages_root ( ) <EOL> link = preview_link ( self . page2 , language = language ) <EOL> self . assertEqual ( link , '<STR_LIT>' % ( pages_root , self . page2 . get_slug ( ) ) ) <EOL> self . assertEqual ( link , '<STR_LIT>' ) </s>
