当前位置: 首页>>代码示例>>Python>>正文


Python tests.translated_revision函数代码示例

本文整理汇总了Python中wiki.tests.translated_revision函数的典型用法代码示例。如果您正苦于以下问题:Python translated_revision函数的具体用法?Python translated_revision怎么用?Python translated_revision使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了translated_revision函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_render

    def test_render(self):
        """Assert the main dash and all the readouts render and don't crash."""
        # Put some stuff in the DB so at least one row renders for each
        # readout:
        untranslated = revision(is_approved=True)
        untranslated.save()

        unreviewed = translated_revision()
        unreviewed.save()

        out_of_date = translated_revision(is_approved=True)
        out_of_date.save()
        major_update = revision(document=out_of_date.document.parent,
                                significance=MAJOR_SIGNIFICANCE,
                                is_approved=True)
        major_update.save()

        needing_updates = translated_revision(is_approved=True)
        needing_updates.save()
        medium_update = revision(document=needing_updates.document.parent,
                                significance=MEDIUM_SIGNIFICANCE)
        medium_update.save()

        response = self.client.get(reverse('dashboards.localization',
                                           locale='de'),
                                   follow=False)
        eq_(200, response.status_code)
        doc = pq(response.content)
        self._assert_readout_contains(doc, 'untranslated',
                                      untranslated.document.title)
        self._assert_readout_contains(doc, 'unreviewed',
                                      unreviewed.document.title)
开发者ID:LucianU,项目名称:kuma,代码行数:32,代码来源:test_templates.py

示例2: test_one_rejected_revision

    def test_one_rejected_revision(self):
        """A translation with only 1 revision, which is rejected, should show
        as "Needs Translation".

        """
        translated_revision(is_approved=False, reviewed=datetime.now(), save=True)

        row = self.row()
        eq_(row["status_class"], "untranslated")
开发者ID:ejean555,项目名称:kitsune,代码行数:9,代码来源:test_readouts.py

示例3: test_find_related_documents

 def test_find_related_documents(self):
     trans1 = translated_revision(is_approved=True)
     trans1.save()
     d1 = trans1.document
     trans2 = translated_revision(is_approved=True)
     trans2.save()
     d2 = trans2.document
     RelatedDocument.objects.create(document=d1.parent,
                                    related=d2.parent, in_common=2)
     # Assert the English versions still match
     assert list(find_related_documents(d1.parent)) == [d2.parent]
     # Assert that the translation matches
     assert list(find_related_documents(d1)) == [d2]
开发者ID:Apokalyptica79,项目名称:kitsune,代码行数:13,代码来源:test_models.py

示例4: test_inheritance

    def test_inheritance(self):
        """Make sure parent/child equality of is_archived is maintained."""
        # Set up a child and a parent and an orphan (all false) and something
        # true.
        translated_revision(save=True)
        translated_revision(save=True)
        document(save=True)
        document(is_archived=True, save=True)

        # Batch-clear the archival bits:
        DocumentAdmin._set_archival(Document.objects.all(), True)

        # Assert the child of the parent and the parent of the child (along
        # with everything else) became (or stayed) true:
        eq_(Document.objects.filter(is_archived=True).count(), 6)
开发者ID:Apokalyptica79,项目名称:kitsune,代码行数:15,代码来源:test_admin.py

示例5: test_up_to_date

 def test_up_to_date(self):
     """Show up-to-date translations have no status, just a happy class."""
     translation = translated_revision(is_approved=True, save=True)
     row = self.row()
     eq_(row["title"], translation.document.title)
     eq_(unicode(row["status"]), "")
     eq_(row["status_class"], "ok")
开发者ID:ejean555,项目名称:kitsune,代码行数:7,代码来源:test_readouts.py

示例6: test_up_to_date

 def test_up_to_date(self):
     """Show up-to-date translations have no status, just a happy class."""
     translation = translated_revision(is_approved=True, save=True)
     row = self.row()
     eq_(row['title'], translation.document.title)
     eq_(unicode(row['status']), '')
     eq_(row['status_class'], 'ok')
开发者ID:MiChrFri,项目名称:kitsune,代码行数:7,代码来源:test_readouts.py

示例7: test_by_product

    def test_by_product(self):
        """Test the product filtering of the readout."""
        p = product(title="Firefox", slug="firefox", save=True)
        translation = translated_revision(is_approved=True, save=True)
        revision(
            document=translation.document.parent,
            is_approved=True,
            is_ready_for_localization=False,  # should still count
            significance=MAJOR_SIGNIFICANCE,
            save=True,
        )
        revision(
            document=translation.document.parent,
            is_approved=True,
            is_ready_for_localization=True,
            significance=MEDIUM_SIGNIFICANCE,
            save=True,
        )

        # There shouldn't be any rows yet.
        eq_(0, len(self.rows(product=p)))

        # Add the product to the document, and verify it shows up.
        translation.document.parent.products.add(p)
        eq_(self.row(product=p)["title"], translation.document.title)
开发者ID:ejean555,项目名称:kitsune,代码行数:25,代码来源:test_readouts.py

示例8: test_all_articles_doesnt_have_30_40_50

    def test_all_articles_doesnt_have_30_40_50(self):
        """Make sure All Articles doesn't have 30, 40, and 50 articles"""
        t = translated_revision(is_approved=True, save=True)
        # It shows up in All when it's a normal doc:
        eq_(1, overview_rows('de')['all']['numerator'])
        eq_(1, overview_rows('de')['all']['denominator'])

        # ...but not when it's a navigation article:
        t.document.parent.title = t.document.title = 'thing'
        t.document.parent.category = t.document.category = 50
        t.document.parent.save()
        t.document.save()
        eq_(0, overview_rows('de')['all']['numerator'])
        eq_(0, overview_rows('de')['all']['denominator'])

        # ...or administration:
        t.document.parent.category = t.document.category = 40
        t.document.parent.save()
        t.document.save()
        eq_(0, overview_rows('de')['all']['numerator'])
        eq_(0, overview_rows('de')['all']['denominator'])

        # ...or how to contribute:
        t.document.parent.category = t.document.category = 30
        t.document.parent.save()
        t.document.save()
        eq_(0, overview_rows('de')['all']['numerator'])
        eq_(0, overview_rows('de')['all']['denominator'])
开发者ID:MiChrFri,项目名称:kitsune,代码行数:28,代码来源:test_readouts.py

示例9: test_consider_max_significance

    def test_consider_max_significance(self):
        """Use max significance for determining change significance

        When determining how significantly an article has changed
        since translation, use the max significance of the approved
        revisions, not just that of the latest ready-to-localize one.
        """
        translation = translated_revision(is_approved=True, save=True)
        revision(
            document=translation.document.parent,
            is_approved=True,
            is_ready_for_localization=False,  # should still count
            significance=MAJOR_SIGNIFICANCE,
            save=True,
        )
        revision(
            document=translation.document.parent,
            is_approved=True,
            is_ready_for_localization=True,
            significance=MEDIUM_SIGNIFICANCE,
            save=True,
        )
        row = self.row()
        eq_(row["title"], translation.document.title)
        eq_(unicode(row["status"]), "Immediate Update Needed")
开发者ID:atopal,项目名称:kitsune,代码行数:25,代码来源:test_readouts.py

示例10: test_not_counting_untranslated

 def test_not_counting_untranslated(self):
     """Translations with no approved revisions shouldn't count as done.
     """
     t = translated_revision(is_approved=False, save=True)
     overview = overview_rows("de")
     eq_(0, overview["most-visited"]["numerator"])
     eq_(0, overview["all"]["numerator"])
开发者ID:atopal,项目名称:kitsune,代码行数:7,代码来源:test_readouts.py

示例11: test_not_counting_outdated

    def test_not_counting_outdated(self):
        """Out-of-date translations shouldn't count as "done".

        "Out-of-date" can mean either moderately or majorly out of date. The
        only thing we don't care about is typo-level outdatedness.

        """
        t = translated_revision(is_approved=True, save=True)
        overview = overview_rows('de')
        eq_(1, overview['most-visited']['numerator'])
        eq_(1, overview['all']['numerator'])

        # Update the parent with a typo-level revision:
        revision(document=t.document.parent,
                 significance=TYPO_SIGNIFICANCE,
                 is_approved=True,
                 is_ready_for_localization=True,
                 save=True)
        # Assert it still shows up in the numerators:
        overview = overview_rows('de')
        eq_(1, overview['most-visited']['numerator'])
        eq_(1, overview['all']['numerator'])

        # Update the parent with a medium-level revision:
        revision(document=t.document.parent,
                 significance=MEDIUM_SIGNIFICANCE,
                 is_approved=True,
                 is_ready_for_localization=True,
                 save=True)
        # Assert it no longer shows up in the numerators:
        overview = overview_rows('de')
        eq_(0, overview['all']['numerator'])
        eq_(0, overview['most-visited']['numerator'])
开发者ID:MiChrFri,项目名称:kitsune,代码行数:33,代码来源:test_readouts.py

示例12: test_unrevieweds_after_current

 def test_unrevieweds_after_current(self):
     """Show the unreviewed revisions with later creation dates than the
     current"""
     current = translated_revision(is_approved=True, save=True,
                                   created=datetime(2000, 1, 1))
     unreviewed = revision(document=current.document, save=True,
                           created=datetime(2000, 2, 1))
     assert unreviewed.document.title in self.titles()
开发者ID:MiChrFri,项目名称:kitsune,代码行数:8,代码来源:test_readouts.py

示例13: _test_significance

 def _test_significance(self, significance, status):
     """Assert that a translation out of date due to a `significance`-level
     update to the original article shows status `status`."""
     translation = translated_revision(is_approved=True, save=True)
     revision(document=translation.document.parent,
              is_approved=True,
              significance=significance, save=True)
     row = self.row()
     eq_(row['title'], translation.document.title)
     eq_(row['status'], status)
开发者ID:Akamad007,项目名称:kitsune,代码行数:10,代码来源:test_readouts.py

示例14: test_by_product

    def test_by_product(self):
        """Test the product filtering of the readout."""
        p = product(title='Firefox', slug='firefox', save=True)
        unreviewed = translated_revision(save=True)

        # There shouldn't be any rows yet.
        eq_(0, len(self.rows(product=p)))

        # Add the product to the parent document, and verify it shows up.
        unreviewed.document.parent.products.add(p)
        eq_(self.row(product=p)['title'], unreviewed.document.title)
开发者ID:MiChrFri,项目名称:kitsune,代码行数:11,代码来源:test_readouts.py

示例15: test_content_parsed_with_locale

    def test_content_parsed_with_locale(self):
        """Make sure links to localized articles work."""
        rev = translated_revision(locale='es', is_approved=True, save=True)
        doc = rev.document
        doc.title = u'Un mejor título'
        doc.save()

        q = question(locale='es', save=True)
        a = answer(question=q, content='[[%s]]' % doc.title, save=True)

        assert 'es/kb/%s' % doc.slug in a.content_parsed
开发者ID:DWDRAEGER,项目名称:kitsune,代码行数:11,代码来源:test_models.py


注:本文中的wiki.tests.translated_revision函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。