def test_parent_language(self): parent_page = HomePageFactory.build() new_page = HomePageFactory.build(language=language.LanguageFactory( code='ar')) signals.force_parent_language(page=new_page, parent=parent_page) assert new_page.language == parent_page.language
def test_site_languages(self): site = sites.SiteFactory() SiteLanguages.for_site(site) # Initialize sitelanguages default_language = Language.objects.default() lang = language.LanguageFactory(code='nl', is_default=False) site.sitelanguages.default_language = lang site.sitelanguages.save() pages = sites.create_site_tree(language=default_language, site=site) homepage = HomePageFactory.build(language=default_language) pages[0].add_child(instance=homepage) signals.force_parent_language(page=homepage, parent=site.root_page) assert homepage.language == lang