<s> from importlib import import_module <EOL> from django . conf import settings <EOL> from django . test . utils import override_settings <EOL> from django . utils . translation import LANGUAGE_SESSION_KEY <EOL> from cms import api <EOL> from cms . test_utils . testcases import CMSTestCase <EOL> from cms . utils import i18n <EOL> @ override_settings ( <EOL> LANGUAGE_CODE = '<STR_LIT>' , <EOL> LANGUAGES = ( ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) ) , <EOL> CMS_LANGUAGES = { <EOL> <NUM_LIT:1> : [ { '<STR_LIT:code>' : '<STR_LIT>' , <EOL> '<STR_LIT:name>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : True } , <EOL> { '<STR_LIT:code>' : '<STR_LIT>' , <EOL> '<STR_LIT:name>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : False } , <EOL> ] , <EOL> '<STR_LIT:default>' : { <EOL> '<STR_LIT>' : True , <EOL> '<STR_LIT>' : False , <EOL> } , <EOL> } , <EOL> SITE_ID = <NUM_LIT:1> , <EOL> ) <EOL> class TestLanguages ( CMSTestCase ) : <EOL> def test_language_code ( self ) : <EOL> self . assertEqual ( i18n . get_language_code ( '<STR_LIT>' ) , '<STR_LIT>' ) <EOL> self . assertEqual ( i18n . get_current_language ( ) , '<STR_LIT>' ) <EOL> def test_get_languages_default_site ( self ) : <EOL> result = i18n . get_languages ( ) <EOL> self . assertEqual ( <NUM_LIT:2> , len ( result ) ) <EOL> lang = result [ <NUM_LIT:0> ] <EOL> self . assertEqual ( lang [ '<STR_LIT:code>' ] , '<STR_LIT>' ) <EOL> self . assertEqual ( i18n . get_language_code ( lang [ '<STR_LIT:code>' ] ) , '<STR_LIT>' ) <EOL> self . assertEqual ( lang [ '<STR_LIT>' ] , True ) <EOL> lang = result [ <NUM_LIT:1> ] <EOL> self . assertEqual ( lang [ '<STR_LIT:code>' ] , '<STR_LIT>' ) <EOL> self . assertEqual ( i18n . get_language_code ( lang [ '<STR_LIT:code>' ] ) , '<STR_LIT>' ) <EOL> self . assertEqual ( lang [ '<STR_LIT>' ] , False ) <EOL> def test_get_languages_defined_site ( self ) : <EOL> result = i18n . get_languages ( <NUM_LIT:1> ) <EOL> self . assertEqual ( <NUM_LIT:2> , len ( result ) ) <EOL> lang = result [ <NUM_LIT:0> ] <EOL> self . assertEqual ( lang [ '<STR_LIT:code>' ] , '<STR_LIT>' ) <EOL> self . assertEqual ( i18n . get_language_code ( lang [ '<STR_LIT:code>' ] ) , '<STR_LIT>' ) <EOL> self . assertEqual ( lang [ '<STR_LIT>' ] , True ) <EOL> lang = result [ <NUM_LIT:1> ] <EOL> self . assertEqual ( lang [ '<STR_LIT:code>' ] , '<STR_LIT>' ) <EOL> self . assertEqual ( i18n . get_language_code ( lang [ '<STR_LIT:code>' ] ) , '<STR_LIT>' ) <EOL> self . assertEqual ( lang [ '<STR_LIT>' ] , False ) <EOL> def test_get_languages_undefined_site ( self ) : <EOL> result = i18n . get_languages ( <NUM_LIT> ) <EOL> self . assertEqual ( <NUM_LIT:4> , len ( result ) ) <EOL> self . assertEqual ( result [ <NUM_LIT:0> ] [ '<STR_LIT:code>' ] , '<STR_LIT>' ) <EOL> self . assertEqual ( i18n . get_language_code ( result [ <NUM_LIT:0> ] [ '<STR_LIT:code>' ] ) , '<STR_LIT>' ) <EOL> self . assertEqual ( result [ <NUM_LIT:1> ] [ '<STR_LIT:code>' ] , '<STR_LIT>' ) <EOL> self . assertEqual ( i18n . get_language_code ( result [ <NUM_LIT:1> ] [ '<STR_LIT:code>' ] ) , '<STR_LIT>' ) <EOL> self . assertEqual ( result [ <NUM_LIT:2> ] [ '<STR_LIT:code>' ] , '<STR_LIT>' ) <EOL> self . assertEqual ( i18n . get_language_code ( result [ <NUM_LIT:2> ] [ '<STR_LIT:code>' ] ) , '<STR_LIT>' ) <EOL> self . assertEqual ( result [ <NUM_LIT:3> ] [ '<STR_LIT:code>' ] , '<STR_LIT>' ) <EOL> self . assertEqual ( i18n . get_language_code ( result [ <NUM_LIT:3> ] [ '<STR_LIT:code>' ] ) , '<STR_LIT>' ) <EOL> for lang in result : <EOL> self . assertEqual ( lang [ '<STR_LIT>' ] , True ) <EOL> self . assertEqual ( lang [ '<STR_LIT>' ] , False ) <EOL> @ override_settings ( <EOL> LANGUAGE_CODE = '<STR_LIT>' , <EOL> LANGUAGES = ( ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) ) , <EOL> CMS_LANGUAGES = { <EOL> <NUM_LIT:1> : [ { '<STR_LIT:code>' : '<STR_LIT>' , <EOL> '<STR_LIT:name>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : True } , <EOL> { '<STR_LIT:code>' : '<STR_LIT>' , <EOL> '<STR_LIT:name>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : False } , <EOL> ] , <EOL> } , <EOL> SITE_ID = <NUM_LIT:1> , <EOL> ) <EOL> class TestLanguagesNoDefault ( CMSTestCase ) : <EOL> def test_get_languages_default_site ( self ) : <EOL> result = i18n . get_languages ( ) <EOL> self . assertEqual ( <NUM_LIT:2> , len ( result ) ) <EOL> lang = result [ <NUM_LIT:0> ] <EOL> self . assertEqual ( lang [ '<STR_LIT:code>' ] , '<STR_LIT>' ) <EOL> self . assertEqual ( i18n . get_language_code ( lang [ '<STR_LIT:code>' ] ) , '<STR_LIT>' ) <EOL> self . assertEqual ( lang [ '<STR_LIT>' ] , True ) <EOL> lang = result [ <NUM_LIT:1> ] <EOL> self . assertEqual ( lang [ '<STR_LIT:code>' ] , '<STR_LIT>' ) <EOL> self . assertEqual ( i18n . get_language_code ( lang [ '<STR_LIT:code>' ] ) , '<STR_LIT>' ) <EOL> self . assertEqual ( lang [ '<STR_LIT>' ] , False ) <EOL> def test_get_languages_defined_site ( self ) : <EOL> result = i18n . get_languages ( <NUM_LIT:1> ) <EOL> self . assertEqual ( <NUM_LIT:2> , len ( result ) ) <EOL> lang = result [ <NUM_LIT:0> ] <EOL> self . assertEqual ( lang [ '<STR_LIT:code>' ] , '<STR_LIT>' ) <EOL> self . assertEqual ( i18n . get_language_code ( lang [ '<STR_LIT:code>' ] ) , '<STR_LIT>' ) <EOL> self . assertEqual ( lang [ '<STR_LIT>' ] , True ) <EOL> lang = result [ <NUM_LIT:1> ] <EOL> self . assertEqual ( lang [ '<STR_LIT:code>' ] , '<STR_LIT>' ) <EOL> self . assertEqual ( i18n . get_language_code ( lang [ '<STR_LIT:code>' ] ) , '<STR_LIT>' ) <EOL> self . assertEqual ( lang [ '<STR_LIT>' ] , False ) <EOL> def test_get_languages_undefined_site ( self ) : <EOL> result = i18n . get_languages ( <NUM_LIT> ) <EOL> self . assertEqual ( <NUM_LIT:4> , len ( result ) ) <EOL> self . assertEqual ( result [ <NUM_LIT:0> ] [ '<STR_LIT:code>' ] , '<STR_LIT>' ) <EOL> self . assertEqual ( i18n . get_language_code ( result [ <NUM_LIT:0> ] [ '<STR_LIT:code>' ] ) , '<STR_LIT>' ) <EOL> self . assertEqual ( result [ <NUM_LIT:1> ] [ '<STR_LIT:code>' ] , '<STR_LIT>' ) <EOL> self . assertEqual ( i18n . get_language_code ( result [ <NUM_LIT:1> ] [ '<STR_LIT:code>' ] ) , '<STR_LIT>' ) <EOL> self . assertEqual ( result [ <NUM_LIT:2> ] [ '<STR_LIT:code>' ] , '<STR_LIT>' ) <EOL> self . assertEqual ( i18n . get_language_code ( result [ <NUM_LIT:2> ] [ '<STR_LIT:code>' ] ) , '<STR_LIT>' ) <EOL> self . assertEqual ( result [ <NUM_LIT:3> ] [ '<STR_LIT:code>' ] , '<STR_LIT>' ) <EOL> self . assertEqual ( i18n . get_language_code ( result [ <NUM_LIT:3> ] [ '<STR_LIT:code>' ] ) , '<STR_LIT>' ) <EOL> for lang in result : <EOL> self . assertEqual ( lang [ '<STR_LIT>' ] , True ) <EOL> self . assertEqual ( lang [ '<STR_LIT>' ] , True ) <EOL> @ override_settings ( <EOL> LANGUAGE_CODE = '<STR_LIT>' , <EOL> LANGUAGES = ( ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) ) , <EOL> CMS_LANGUAGES = { <EOL> <NUM_LIT:1> : [ { '<STR_LIT:code>' : '<STR_LIT>' , <EOL> '<STR_LIT:name>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : True } , <EOL> { '<STR_LIT:code>' : '<STR_LIT>' , <EOL> '<STR_LIT:name>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : False } , <EOL> ] , <EOL> '<STR_LIT:default>' : { <EOL> '<STR_LIT>' : True , <EOL> '<STR_LIT>' : False , <EOL> } , <EOL> } , <EOL> SITE_ID = <NUM_LIT:1> , <EOL> ) <EOL> class TestLanguageCodesEnUS ( CMSTestCase ) : <EOL> def test_language_code ( self ) : <EOL> self . assertEqual ( i18n . get_language_code ( '<STR_LIT>' ) , '<STR_LIT>' ) <EOL> self . assertEqual ( i18n . get_current_language ( ) , '<STR_LIT>' ) <EOL> def test_get_languages_default_site ( self ) : <EOL> result = i18n . get_languages ( ) <EOL> self . assertEqual ( <NUM_LIT:2> , len ( result ) ) <EOL> lang = result [ <NUM_LIT:0> ] <EOL> self . assertEqual ( lang [ '<STR_LIT:code>' ] , '<STR_LIT>' ) <EOL> self . assertEqual ( i18n . get_language_code ( lang [ '<STR_LIT:code>' ] ) , '<STR_LIT>' ) <EOL> self . assertEqual ( lang [ '<STR_LIT>' ] , True ) <EOL> lang = result [ <NUM_LIT:1> ] <EOL> self . assertEqual ( lang [ '<STR_LIT:code>' ] , '<STR_LIT>' ) <EOL> self . assertEqual ( i18n . get_language_code ( lang [ '<STR_LIT:code>' ] ) , '<STR_LIT>' ) <EOL> self . assertEqual ( lang [ '<STR_LIT>' ] , False ) <EOL> def test_get_languages_defined_site ( self ) : <EOL> result = i18n . get_languages ( <NUM_LIT:1> ) <EOL> self . assertEqual ( <NUM_LIT:2> , len ( result ) ) <EOL> lang = result [ <NUM_LIT:0> ] <EOL> self . assertEqual ( lang [ '<STR_LIT:code>' ] , '<STR_LIT>' ) <EOL> self . assertEqual ( i18n . get_language_code ( lang [ '<STR_LIT:code>' ] ) , '<STR_LIT>' ) <EOL> self . assertEqual ( lang [ '<STR_LIT>' ] , True ) <EOL> lang = result [ <NUM_LIT:1> ] <EOL> self . assertEqual ( lang [ '<STR_LIT:code>' ] , '<STR_LIT>' ) <EOL> self . assertEqual ( i18n . get_language_code ( lang [ '<STR_LIT:code>' ] ) , '<STR_LIT>' ) <EOL> self . assertEqual ( lang [ '<STR_LIT>' ] , False ) <EOL> def test_get_languages_undefined_site ( self ) : <EOL> result = i18n . get_languages ( <NUM_LIT> ) <EOL> self . assertEqual ( <NUM_LIT:5> , len ( result ) ) <EOL> self . assertEqual ( result [ <NUM_LIT:0> ] [ '<STR_LIT:code>' ] , '<STR_LIT>' ) <EOL> self . assertEqual ( i18n . get_language_code ( result [ <NUM_LIT:0> ] [ '<STR_LIT:code>' ] ) , '<STR_LIT>' ) <EOL> self . assertEqual ( result [ <NUM_LIT:1> ] [ '<STR_LIT:code>' ] , '<STR_LIT>' ) <EOL> self . assertEqual ( i18n . get_language_code ( result [ <NUM_LIT:1> ] [ '<STR_LIT:code>' ] ) , '<STR_LIT>' ) <EOL> self . assertEqual ( result [ <NUM_LIT:2> ] [ '<STR_LIT:code>' ] , '<STR_LIT>' ) <EOL> self . assertEqual ( i18n . get_language_code ( result [ <NUM_LIT:2> ] [ '<STR_LIT:code>' ] ) , '<STR_LIT>' ) <EOL> self . assertEqual ( result [ <NUM_LIT:3> ] [ '<STR_LIT:code>' ] , '<STR_LIT>' ) <EOL> self . assertEqual ( i18n . get_language_code ( result [ <NUM_LIT:3> ] [ '<STR_LIT:code>' ] ) , '<STR_LIT>' ) <EOL> self . assertEqual ( result [ <NUM_LIT:4> ] [ '<STR_LIT:code>' ] , '<STR_LIT>' ) <EOL> self . assertEqual ( i18n . get_language_code ( result [ <NUM_LIT:4> ] [ '<STR_LIT:code>' ] ) , '<STR_LIT>' ) <EOL> for lang in result : <EOL> self . assertEqual ( lang [ '<STR_LIT>' ] , True ) <EOL> self . assertEqual ( lang [ '<STR_LIT>' ] , False ) <EOL> @ override_settings ( <EOL> LANGUAGE_CODE = '<STR_LIT>' , <EOL> LANGUAGES = ( ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) ) , <EOL> CMS_LANGUAGES = { <EOL> <NUM_LIT:1> : [ { '<STR_LIT:code>' : '<STR_LIT>' , <EOL> '<STR_LIT:name>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : True } , <EOL> { '<STR_LIT:code>' : '<STR_LIT>' , <EOL> '<STR_LIT:name>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : False } , <EOL> ] , <EOL> '<STR_LIT:default>' : { <EOL> '<STR_LIT>' : True , <EOL> '<STR_LIT>' : False , <EOL> } , <EOL> } , <EOL> SITE_ID = <NUM_LIT:1> , <EOL> ) <EOL> class TestLanguageCodesEnGB ( CMSTestCase ) : <EOL> def test_language_code ( self ) : <EOL> self . assertEqual ( i18n . get_language_code ( '<STR_LIT>' ) , '<STR_LIT>' ) <EOL> self . assertEqual ( i18n . get_current_language ( ) , '<STR_LIT>' ) <EOL> def test_get_languages_default_site ( self ) : <EOL> result = i18n . get_languages ( ) <EOL> self . assertEqual ( <NUM_LIT:2> , len ( result ) ) <EOL> lang = result [ <NUM_LIT:0> ] <EOL> self . assertEqual ( lang [ '<STR_LIT:code>' ] , '<STR_LIT>' ) <EOL> self . assertEqual ( i18n . get_language_code ( lang [ '<STR_LIT:code>' ] ) , '<STR_LIT>' ) <EOL> self . assertEqual ( lang [ '<STR_LIT>' ] , True ) <EOL> lang = result [ <NUM_LIT:1> ] <EOL> self . assertEqual ( lang [ '<STR_LIT:code>' ] , '<STR_LIT>' ) <EOL> self . assertEqual ( i18n . get_language_code ( lang [ '<STR_LIT:code>' ] ) , '<STR_LIT>' ) <EOL> self . assertEqual ( lang [ '<STR_LIT>' ] , False ) <EOL> def test_get_languages_defined_site ( self ) : <EOL> result = i18n . get_languages ( <NUM_LIT:1> ) <EOL> self . assertEqual ( <NUM_LIT:2> , len ( result ) ) <EOL> lang = result [ <NUM_LIT:0> ] <EOL> self . assertEqual ( lang [ '<STR_LIT:code>' ] , '<STR_LIT>' ) <EOL> self . assertEqual ( i18n . get_language_code ( lang [ '<STR_LIT:code>' ] ) , '<STR_LIT>' ) <EOL> self . assertEqual ( lang [ '<STR_LIT>' ] , True ) <EOL> lang = result [ <NUM_LIT:1> ] <EOL> self . assertEqual ( lang [ '<STR_LIT:code>' ] , '<STR_LIT>' ) <EOL> self . assertEqual ( i18n . get_language_code ( lang [ '<STR_LIT:code>' ] ) , '<STR_LIT>' ) <EOL> self . assertEqual ( lang [ '<STR_LIT>' ] , False ) <EOL> def test_get_languages_undefined_site ( self ) : <EOL> result = i18n . get_languages ( <NUM_LIT> ) <EOL> self . assertEqual ( <NUM_LIT:5> , len ( result ) ) <EOL> self . assertEqual ( result [ <NUM_LIT:0> ] [ '<STR_LIT:code>' ] , '<STR_LIT>' ) <EOL> self . assertEqual ( i18n . get_language_code ( result [ <NUM_LIT:0> ] [ '<STR_LIT:code>' ] ) , '<STR_LIT>' ) <EOL> self . assertEqual ( result [ <NUM_LIT:1> ] [ '<STR_LIT:code>' ] , '<STR_LIT>' ) <EOL> self . assertEqual ( i18n . get_language_code ( result [ <NUM_LIT:1> ] [ '<STR_LIT:code>' ] ) , '<STR_LIT>' ) <EOL> self . assertEqual ( result [ <NUM_LIT:2> ] [ '<STR_LIT:code>' ] , '<STR_LIT>' ) <EOL> self . assertEqual ( i18n . get_language_code ( result [ <NUM_LIT:2> ] [ '<STR_LIT:code>' ] ) , '<STR_LIT>' ) <EOL> self . assertEqual ( result [ <NUM_LIT:3> ] [ '<STR_LIT:code>' ] , '<STR_LIT>' ) <EOL> self . assertEqual ( i18n . get_language_code ( result [ <NUM_LIT:3> ] [ '<STR_LIT:code>' ] ) , '<STR_LIT>' ) <EOL> self . assertEqual ( result [ <NUM_LIT:4> ] [ '<STR_LIT:code>' ] , '<STR_LIT>' ) <EOL> self . assertEqual ( i18n . get_language_code ( result [ <NUM_LIT:4> ] [ '<STR_LIT:code>' ] ) , '<STR_LIT>' ) <EOL> for lang in result : <EOL> self . assertEqual ( lang [ '<STR_LIT>' ] , True ) <EOL> self . assertEqual ( lang [ '<STR_LIT>' ] , False ) <EOL> @ override_settings ( <EOL> LANGUAGE_CODE = '<STR_LIT>' , <EOL> LANGUAGES = [ <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> ] , <EOL> CMS_LANGUAGES = { <EOL> <NUM_LIT:1> : [ { '<STR_LIT:code>' : '<STR_LIT>' , <EOL> '<STR_LIT:name>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : True } , <EOL> { '<STR_LIT:code>' : '<STR_LIT>' , <EOL> '<STR_LIT:name>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : True } ] , <EOL> '<STR_LIT:default>' : { <EOL> '<STR_LIT>' : [ '<STR_LIT>' , '<STR_LIT>' ] , <EOL> } , <EOL> } , <EOL> SITE_ID = <NUM_LIT:1> , <EOL> ) <EOL> class TestLanguagesNotInCMSLanguages ( CMSTestCase ) : <EOL> def test_get_fallback_languages ( self ) : <EOL> languages = i18n . get_fallback_languages ( '<STR_LIT>' , <NUM_LIT:1> ) <EOL> self . assertEqual ( languages , [ '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> @ override_settings ( <EOL> LANGUAGE_CODE = '<STR_LIT>' , <EOL> LANGUAGES = ( ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) ) , <EOL> CMS_LANGUAGES = { <EOL> <NUM_LIT:1> : [ { '<STR_LIT:code>' : '<STR_LIT>' , <EOL> '<STR_LIT:name>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : False } , <EOL> { '<STR_LIT:code>' : '<STR_LIT>' , <EOL> '<STR_LIT:name>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : True } , <EOL> ] , <EOL> '<STR_LIT:default>' : { <EOL> '<STR_LIT>' : [ '<STR_LIT>' , '<STR_LIT>' ] , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : True , <EOL> '<STR_LIT>' : False , <EOL> } <EOL> } , <EOL> SITE_ID = <NUM_LIT:1> , <EOL> ) <EOL> class TestLanguageFallbacks ( CMSTestCase ) : <EOL> def test_language_code ( self ) : <EOL> api . create_page ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , published = True ) <EOL> response = self . client . get ( '<STR_LIT:/>' ) <EOL> self . assertEqual ( response . status_code , <NUM_LIT> ) <EOL> response = self . client . get ( '<STR_LIT>' ) <EOL> self . assertEqual ( response . status_code , <NUM_LIT> ) <EOL> self . assertRedirects ( response , '<STR_LIT>' ) <EOL> @ override_settings ( <EOL> CMS_LANGUAGES = { <EOL> <NUM_LIT:1> : [ { '<STR_LIT:code>' : '<STR_LIT>' , <EOL> '<STR_LIT:name>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : True } , <EOL> { '<STR_LIT:code>' : '<STR_LIT>' , <EOL> '<STR_LIT:name>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : True } , <EOL> ] <EOL> } , <EOL> ) <EOL> def test_session_language ( self ) : <EOL> page = api . create_page ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , published = True ) <EOL> api . create_title ( '<STR_LIT>' , "<STR_LIT>" , page ) <EOL> page . publish ( '<STR_LIT>' ) <EOL> page . publish ( '<STR_LIT>' ) <EOL> response = self . client . get ( '<STR_LIT:/>' ) <EOL> self . assertEqual ( response . status_code , <NUM_LIT> ) <EOL> self . assertRedirects ( response , '<STR_LIT>' ) <EOL> engine = import_module ( settings . SESSION_ENGINE ) <EOL> store = engine . SessionStore ( ) <EOL> store . save ( ) <EOL> self . client . cookies [ settings . SESSION_COOKIE_NAME ] = store . session_key <EOL> session = self . client . session <EOL> session [ LANGUAGE_SESSION_KEY ] = '<STR_LIT>' <EOL> session . save ( ) <EOL> response = self . client . get ( '<STR_LIT:/>' ) <EOL> self . assertEqual ( response . status_code , <NUM_LIT> ) <EOL> self . assertRedirects ( response , '<STR_LIT>' ) <EOL> self . client . get ( '<STR_LIT>' ) <EOL> self . assertEqual ( self . client . session [ LANGUAGE_SESSION_KEY ] , '<STR_LIT>' ) <EOL> response = self . client . get ( '<STR_LIT:/>' ) <EOL> self . assertEqual ( response . status_code , <NUM_LIT> ) <EOL> self . assertRedirects ( response , '<STR_LIT>' ) </s>
