Exemple #1
0
    def test_ready_for_l10n(self):
        d = DocumentFactory()
        r = RevisionFactory(document=d)
        d.current_revision = r
        d.save()

        data = kb_overview_rows()
        eq_(1, len(data))
        eq_(False, data[0]["ready_for_l10n"])

        ApprovedRevisionFactory(document=d, is_ready_for_localization=True)

        data = kb_overview_rows()
        eq_(True, data[0]["ready_for_l10n"])
Exemple #2
0
    def test_ready_for_l10n(self):
        d = DocumentFactory()
        r = RevisionFactory(document=d)
        d.current_revision = r
        d.save()

        data = kb_overview_rows()
        eq_(1, len(data))
        eq_(False, data[0]['ready_for_l10n'])

        ApprovedRevisionFactory(document=d, is_ready_for_localization=True)

        data = kb_overview_rows()
        eq_(True, data[0]['ready_for_l10n'])
Exemple #3
0
 def create_documents(self, locale):
     """Create a document in English and a translated document for the locale"""
     en = settings.WIKI_DEFAULT_LANGUAGE
     en_content = 'This article is in English'
     trans_content = 'This article is translated into %slocale' % locale
     # Create an English article and a translation for the locale
     en_doc = DocumentFactory(locale=en)
     ApprovedRevisionFactory(document=en_doc, content=en_content,
                             is_ready_for_localization=True)
     trans_doc = DocumentFactory(parent=en_doc, locale=locale)
     # Create a new revision of the localized document
     trans_rev = ApprovedRevisionFactory(document=trans_doc, content=trans_content)
     # Make the created revision the current one for the localized document
     trans_doc.current_revision = trans_rev
     trans_doc.save()
     # Return both the English version and the localized version of the document
     return en_doc, trans_doc
Exemple #4
0
 def create_documents(self, locale):
     """Create a document in English and a translated document for the locale"""
     en = settings.WIKI_DEFAULT_LANGUAGE
     en_content = "This article is in English"
     trans_content = "This article is translated into %slocale" % locale
     # Create an English article and a translation for the locale
     en_doc = DocumentFactory(locale=en)
     ApprovedRevisionFactory(document=en_doc,
                             content=en_content,
                             is_ready_for_localization=True)
     trans_doc = DocumentFactory(parent=en_doc, locale=locale)
     # Create a new revision of the localized document
     trans_rev = ApprovedRevisionFactory(document=trans_doc,
                                         content=trans_content)
     # Make the created revision the current one for the localized document
     trans_doc.current_revision = trans_rev
     trans_doc.save()
     # Return both the English version and the localized version of the document
     return en_doc, trans_doc
Exemple #5
0
    def test_wiki_section(self):
        """Verify the wiki doc appears on the landing page."""
        # If "Mozilla News" article doesn't exist, home page
        # should still work and omit the section.
        response = self.client.get(urlparams(reverse('community.home')))
        eq_(response.status_code, 200)
        doc = pq(response.content)
        eq_(len(doc('#doc-content')), 0)

        # Create the "Mozilla News" article and verify it on home page.
        d = DocumentFactory(title='Community Hub News', slug='community-hub-news')
        rev = ApprovedRevisionFactory(document=d, content='splendid')
        d.current_revision = rev
        d.save()
        response = self.client.get(urlparams(reverse('community.home')))
        eq_(response.status_code, 200)
        doc = pq(response.content)
        community_news = doc('#doc-content')
        eq_(len(community_news), 1)
        assert 'splendid' in community_news.text()
    def test_wiki_section(self):
        """Verify the wiki doc appears on the landing page."""
        # If "Mozilla News" article doesn't exist, home page
        # should still work and omit the section.
        response = self.client.get(urlparams(reverse('community.home')))
        eq_(response.status_code, 200)
        doc = pq(response.content)
        eq_(len(doc('#doc-content')), 0)

        # Create the "Mozilla News" article and verify it on home page.
        d = DocumentFactory(title='Community Hub News', slug='community-hub-news')
        rev = ApprovedRevisionFactory(document=d, content='splendid')
        d.current_revision = rev
        d.save()
        response = self.client.get(urlparams(reverse('community.home')))
        eq_(response.status_code, 200)
        doc = pq(response.content)
        community_news = doc('#doc-content')
        eq_(len(community_news), 1)
        assert 'splendid' in community_news.text()
Exemple #7
0
 def _create_doc(self, content):
     # Create the canned responses article.
     doc = DocumentFactory(slug=REPLIES_DOCUMENT_SLUG)
     rev = RevisionFactory(document=doc, content=content, is_approved=True)
     doc.current_revision = rev
     doc.save()
Exemple #8
0
 def _create_doc(self, content):
     # Create the canned responses article.
     doc = DocumentFactory(slug=REPLIES_DOCUMENT_SLUG)
     rev = RevisionFactory(document=doc, content=content, is_approved=True)
     doc.current_revision = rev
     doc.save()