def test_link_with_localization(self):
        en_d = DocumentFactory(title='A doc')
        ApprovedRevisionFactory(document=en_d)

        fr_d = DocumentFactory(parent=en_d, title='Une doc', locale='fr')

        # Without an approved revision, link should go to en-US doc.
        # The site should stay in fr locale (/<locale>/<en-US slug>).
        link = pq(self.p.parse('[[A doc]]', locale='fr'))
        eq_('/fr/kb/a-doc', link.find('a').attr('href'))
        eq_('A doc', link.find('a').text())

        # Approve a revision. Now link should go to fr doc.
        ApprovedRevisionFactory(document=fr_d)
        link = pq(self.p.parse('[[A doc]]', locale='fr'))
        eq_('/fr/kb/une-doc', link.find('a').attr('href'))
        eq_('Une doc', link.find('a').text())
A link to an English doc with a local translation.
dataset/ETHPy150Open mozilla/kitsune/kitsune/sumo/tests/test_parser.py/TestWikiInternalLinks.test_link_with_localization