Пример #1
0
    def test_does_not_show_subsites_of_other_language_groups(self, browser):
        german = create(
            Builder('subsite').titled(u'Subsite DE').with_language('de'))
        french = create(
            Builder('subsite').titled(u'Subsite FR').with_language('fr'))
        italian = create(
            Builder('subsite').titled(u'Subsite IT').with_language('it'))
        spanish = create(
            Builder('subsite').titled(u'Subsite ES').with_language('es'))

        introduce_language_subsites(german, french)
        introduce_language_subsites(italian, spanish)

        browser.login()

        self.assertEquals(
            {
                'german': [u'Fran\xe7ais'],
                'french': [u'Deutsch'],
                'italian': [u'Espa\xf1ol'],
                'spanish': [u'Italiano']
            }, {
                'german': LanguageSwitcher().visit(german).languages,
                'french': LanguageSwitcher().visit(french).languages,
                'italian': LanguageSwitcher().visit(italian).languages,
                'spanish': LanguageSwitcher().visit(spanish).languages
            })
Пример #2
0
    def test_switch_is_invisible_unless_languages_hooked_up(self, browser):
        german = create(
            Builder('subsite').titled(u'Subsite DE').with_language('de'))
        french = create(
            Builder('subsite').titled(u'Subsite FR').with_language('fr'))

        browser.login().visit(german)
        self.assertFalse(LanguageSwitcher().available)
        introduce_language_subsites(german, french)
        browser.login().visit(german)
        self.assertTrue(LanguageSwitcher().available)
Пример #3
0
    def test_going_to_another_language(self, browser):
        german = create(
            Builder('subsite').titled(u'Subsite DE').with_language('de'))
        french = create(
            Builder('subsite').titled(u'Subsite FR').with_language('fr'))
        introduce_language_subsites(german, french)

        browser.login().visit(german)
        LanguageSwitcher().click_language(u'Fran\xe7ais')
        self.assertEquals(french.absolute_url(), browser.url)
        LanguageSwitcher().click_language(u'Deutsch')
        self.assertEquals(german.absolute_url(), browser.url)
Пример #4
0
    def test_current_link_is_language_on_plone_site_root(self, browser):
        create(
            Builder('subsite').titled(u'Subsite').with_language('de').having(
                link_site_in_languagechooser=True))

        browser.login().visit()
        self.assertEquals(u'English', LanguageSwitcher().current)
Пример #5
0
    def test_listing_only_site_root_works(self, browser):
        german = create(
            Builder('subsite').titled(u'Subsite').with_language('de').having(
                link_site_in_languagechooser=True))

        browser.login().visit(german)
        self.assertEquals([u'English'], LanguageSwitcher().languages)
Пример #6
0
    def test_other_site_not_visible_when_no_subsite_language_defined(
            self, browser):
        german = create(
            Builder('subsite').titled(u'Subsite DE').with_language('de'))
        unkown = create(Builder('subsite').titled(u'Subsite ...'))
        introduce_language_subsites(german, unkown)

        browser.login().visit(german)
        self.assertEquals([], LanguageSwitcher().languages)
Пример #7
0
    def test_current_link_is_current_language(self, browser):
        german = create(
            Builder('subsite').titled(u'Subsite DE').with_language('de'))
        french = create(
            Builder('subsite').titled(u'Subsite FR').with_language('fr'))
        introduce_language_subsites(german, french)

        browser.login().visit(german)
        self.assertEquals(u'Deutsch', LanguageSwitcher().current)
Пример #8
0
    def test_shows_other_referenced_languages(self, browser):
        german = create(
            Builder('subsite').titled(u'Subsite DE').with_language('de'))
        french = create(
            Builder('subsite').titled(u'Subsite FR').with_language('fr'))
        italian = create(
            Builder('subsite').titled(u'Subsite IT').with_language('it'))
        introduce_language_subsites(german, french, italian)

        browser.login().visit(german)
        self.assertEquals([u'Fran\xe7ais', u'Italiano'],
                          LanguageSwitcher().languages)
Пример #9
0
    def test_hooking_up_language_subsites_with_site_root(self, browser):
        # Assumed that the site root is configured to be english.
        german = create(
            Builder('subsite').titled(u'Subsite').with_language('de').having(
                link_site_in_languagechooser=True))
        french = create(
            Builder('subsite').titled(u'Subsite').with_language('fr').having(
                link_site_in_languagechooser=True))

        introduce_language_subsites(german, french)

        browser.login()

        self.assertEquals(
            {
                'site root': [u'Deutsch', u'Fran\xe7ais'],
                'german': [u'English', u'Fran\xe7ais'],
                'french': [u'Deutsch', u'English']
            }, {
                'site root': LanguageSwitcher().visit_portal().languages,
                'german': LanguageSwitcher().visit(german).languages,
                'french': LanguageSwitcher().visit(french).languages
            })