コード例 #1
0
ファイル: test_tasks.py プロジェクト: tantek/kuma
 def test_rebuild_chunk(self, apply_async):
     cache.set(settings.WIKI_REBUILD_TOKEN, True)
     rebuild_kb()
     assert not cache.get(settings.WIKI_REBUILD_TOKEN)
     data = set((1, 2, 4, 5))
     assert 'args' in apply_async.call_args[1]
     eq_(data, set(apply_async.call_args[1]['args'][0]))
コード例 #2
0
ファイル: test_tasks.py プロジェクト: AutomatedTester/kitsune
 def test_external(self):
     """Make sure rebuild_kb doesn't delete redirects to external URLs."""
     doc_pk = revision(content='REDIRECT [http://www.example.com/]',
                       is_approved=True,
                       save=True).document.pk
     rebuild_kb()
     assert Document.uncached.filter(pk=doc_pk).exists()
コード例 #3
0
 def test_rebuild_chunk(self, apply_async):
     cache.set(settings.WIKI_REBUILD_TOKEN, True)
     rebuild_kb()
     assert not cache.get(settings.WIKI_REBUILD_TOKEN)
     data = set((1, 2, 4, 5))
     assert "args" in apply_async.call_args[1]
     eq_(data, set(apply_async.call_args[1]["args"][0]))
コード例 #4
0
ファイル: test_tasks.py プロジェクト: DWDRAEGER/kitsune
 def test_rebuild_chunk(self, apply_async):
     cache.set(settings.WIKI_REBUILD_TOKEN, True)
     rebuild_kb()
     assert not cache.get(settings.WIKI_REBUILD_TOKEN)
     assert 'args' in apply_async.call_args[1]
     # There should be 4 documents with an approved revision
     eq_(4, len(apply_async.call_args[1]['args'][0]))
コード例 #5
0
ファイル: test_tasks.py プロジェクト: fox2mike/kitsune
 def test_external(self):
     """Make sure rebuild_kb doesn't delete redirects to external URLs."""
     doc_pk = revision(content='REDIRECT [http://www.example.com/]',
                       is_approved=True,
                       save=True).document.pk
     rebuild_kb()
     assert Document.uncached.filter(pk=doc_pk).exists()
コード例 #6
0
ファイル: test_tasks.py プロジェクト: timmi/kitsune
 def test_rebuild_chunk(self, apply_async):
     cache.set(settings.WIKI_REBUILD_TOKEN, True)
     rebuild_kb()
     assert not cache.get(settings.WIKI_REBUILD_TOKEN)
     assert 'args' in apply_async.call_args[1]
     # There should be 4 documents with an approved revision
     eq_(4, len(apply_async.call_args[1]['args'][0]))
コード例 #7
0
 def test_delete_redirects(self):
     """Test that the rebuild deletes redirects that point to deleted
     documents."""
     # Change slug so redirect is created
     d = Document.objects.get(pk=1)
     slug = d.slug
     new_slug = slug + '-1'
     d.slug = new_slug
     d.save()
     # Rebuild kb and make sure redirect is still there
     rebuild_kb()
     redirect = Document.objects.get(slug=slug)
     eq_(d.slug, redirect.redirect_document().slug)
     # Delete the document, make sure redirect is gone
     d.delete()
     rebuild_kb()
     eq_(0, Document.objects.filter(slug=slug).count())
コード例 #8
0
ファイル: test_tasks.py プロジェクト: Akamad007/kitsune
 def test_delete_redirects(self):
     """Test that the rebuild deletes redirects that point to deleted
     documents."""
     # Change slug so redirect is created
     d = Document.objects.get(pk=1)
     slug = d.slug
     new_slug = slug + '-1'
     d.slug = new_slug
     d.save()
     # Rebuild kb and make sure redirect is still there
     rebuild_kb()
     redirect = Document.objects.get(slug=slug)
     eq_(d.slug, redirect.redirect_document().slug)
     # Delete the document, make sure redirect is gone
     d.delete()
     rebuild_kb()
     eq_(0, Document.objects.filter(slug=slug).count())
コード例 #9
0
ファイル: test_tasks.py プロジェクト: bowmasters/kitsune
    def test_delete_redirects(self):
        """Test that the rebuild deletes redirects that point to deleted
        documents."""
        # Change slug so redirect is created:
        d = revision(is_approved=True, document=document(title="foo", slug="foo", save=True), save=True).document
        slug = d.slug
        d.slug = slug + "-1"
        d.save()

        # Rebuild kb, and make sure redirect is still there:
        rebuild_kb()
        redirect = Document.objects.get(slug=slug)
        eq_(d.slug, redirect.redirect_document().slug)

        # Delete the document, and make sure redirect is gone:
        d.delete()
        rebuild_kb()
        eq_(0, Document.objects.filter(slug=slug).count())
コード例 #10
0
ファイル: test_tasks.py プロジェクト: AutomatedTester/kitsune
    def test_delete_redirects(self):
        """Test that the rebuild deletes redirects that point to deleted
        documents."""
        # Change slug so redirect is created:
        d = revision(is_approved=True,
                     document=document(title='foo', slug='foo', save=True),
                     save=True).document
        slug = d.slug
        d.slug = slug + '-1'
        d.save()

        # Rebuild kb, and make sure redirect is still there:
        rebuild_kb()
        redirect = Document.objects.get(slug=slug)
        eq_(d.slug, redirect.redirect_document().slug)

        # Delete the document, and make sure redirect is gone:
        d.delete()
        rebuild_kb()
        eq_(0, Document.objects.filter(slug=slug).count())
コード例 #11
0
ファイル: cron.py プロジェクト: Curlified/kitsune
def rebuild_kb():
    # If rebuild on demand switch is on, do nothing.
    if waffle.switch_is_active('wiki-rebuild-on-demand'):
        return

    tasks.rebuild_kb()
コード例 #12
0
ファイル: cron.py プロジェクト: psbots/kuma
def rebuild_kb():
    tasks.rebuild_kb()
コード例 #13
0
def rebuild_kb():
    # If rebuild on demand switch is on, do nothing.
    if waffle.switch_is_active('wiki-rebuild-on-demand'):
        return

    tasks.rebuild_kb()
コード例 #14
0
ファイル: cron.py プロジェクト: azhar2005/kuma
def rebuild_kb():
    tasks.rebuild_kb()