コード例 #1
0
ファイル: test_views.py プロジェクト: GVRV/kitsune
 def test_redirect_suppression(self):
     """The document view shouldn't redirect when passed redirect=no."""
     redirect, _ = doc_rev('REDIRECT [[http://smoo/]]')
     response = self.client.get(
                    redirect.get_absolute_url() + '?redirect=no',
                    follow=True)
     self.assertContains(response, 'REDIRECT ')
コード例 #2
0
    def test_changing_products(self):
        """Changing products works as expected."""
        d, r = doc_rev()
        prod_desktop = product(title=u'desktop', save=True)
        prod_mobile = product(title=u'mobile', save=True)

        data = new_document_data()
        data.update({
            'products': [prod_desktop.id, prod_mobile.id],
            'title': d.title,
            'slug': d.slug,
            'form': 'doc'
        })
        self.client.post(reverse('wiki.edit_document', args=[d.slug]), data)

        eq_(
            sorted(
                Document.uncached.get(slug=d.slug).products.values_list(
                    'id', flat=True)),
            sorted([prod.id for prod in [prod_desktop, prod_mobile]]))

        data.update({'products': [prod_desktop.id], 'form': 'doc'})
        self.client.post(reverse('wiki.edit_document', args=[data['slug']]),
                         data)
        eq_(
            sorted(
                Document.uncached.get(slug=d.slug).products.values_list(
                    'id', flat=True)),
            sorted([prod.id for prod in [prod_desktop]]))
コード例 #3
0
 def test_redirect_suppression(self):
     """The document view shouldn't redirect when passed redirect=no."""
     redirect, _ = doc_rev('REDIRECT [[http://smoo/]]')
     response = self.client.get(redirect.get_absolute_url() +
                                '?redirect=no',
                                follow=True)
     self.assertContains(response, 'REDIRECT ')
コード例 #4
0
    def test_trans_lock_workflow(self):
        """End to end test of locking on a translated document."""
        doc, _ = doc_rev()
        u = user(save=True, password='******')

        # Create a new translation of doc() using the translation view
        self.client.login(username=u.username, password='******')
        trans_url = reverse('wiki.translate', locale='es', args=[doc.slug])
        data = {
            'title': 'Un Test Articulo',
            'slug': 'un-test-articulo',
            'keywords': 'keyUno, keyDos, keyTres',
            'summary': 'lipsumo',
            'content': 'loremo ipsumo doloro sito ameto'
        }
        r = self.client.post(trans_url, data)
        eq_(r.status_code, 302)

        # Now run the test.
        edit_url = reverse('wiki.edit_document',
                           locale='es',
                           args=[data['slug']])
        es_doc = Document.objects.get(slug=data['slug'])
        eq_(es_doc.locale, 'es')
        self._lock_workflow(es_doc, edit_url)
コード例 #5
0
ファイル: test_models.py プロジェクト: Zucus/kitsune
    def test_unapproved_revision_not_updates_html(self):
        """Creating an unapproved revision does not update document.html"""
        d, _ = doc_rev("Here to stay")

        assert "Here to stay" in d.html, '"Here to stay" not in %s' % d.html

        # Creating another approved revision keeps initial content
        r = revision(document=d, content="Fail to replace html")
        r.save()

        assert "Here to stay" in d.html, '"Here to stay" not in %s' % d.html
コード例 #6
0
ファイル: test_models.py プロジェクト: kapalselam/kitsune
    def test_unapproved_revision_not_updates_html(self):
        """Creating an unapproved revision does not update document.html"""
        d, _ = doc_rev('Here to stay')

        assert 'Here to stay' in d.html, '"Here to stay" not in %s' % d.html

        # Creating another approved revision keeps initial content
        r = revision(document=d, content='Fail to replace html')
        r.save()

        assert 'Here to stay' in d.html, '"Here to stay" not in %s' % d.html
コード例 #7
0
ファイル: test_models.py プロジェクト: Zucus/kitsune
    def test_approved_revision_updates_html(self):
        """Creating an approved revision updates document.html"""
        d, _ = doc_rev("Replace document html")

        assert "Replace document html" in d.html, '"Replace document html" not in %s' % d.html

        # Creating another approved revision replaces it again
        r = revision(document=d, content="Replace html again", is_approved=True)
        r.save()

        assert "Replace html again" in d.html, '"Replace html again" not in %s' % d.html
コード例 #8
0
ファイル: test_views.py プロジェクト: willkg/kitsune
 def test_retitling(self):
     """When the title of an article is edited, a redirect is made."""
     # Not testing slug changes separately; the model tests cover those plus
     # slug+title changes. If title changes work in the view, the rest
     # should also.
     new_title = "Some New Title"
     d, r = doc_rev()
     old_title = d.title
     data = new_document_data()
     data.update({"title": new_title, "slug": d.slug, "form": "doc"})
     self.client.post(reverse("wiki.edit_document", args=[d.slug]), data)
     eq_(new_title, Document.objects.get(slug=d.slug).title)
     assert Document.objects.get(title=old_title).redirect_url()
コード例 #9
0
 def test_retitling(self):
     """When the title of an article is edited, a redirect is made."""
     # Not testing slug changes separately; the model tests cover those plus
     # slug+title changes. If title changes work in the view, the rest
     # should also.
     new_title = 'Some New Title'
     d, r = doc_rev()
     old_title = d.title
     data = new_document_data()
     data.update({'title': new_title, 'slug': d.slug, 'form': 'doc'})
     self.client.post(reverse('wiki.edit_document', args=[d.slug]), data)
     eq_(new_title, Document.uncached.get(slug=d.slug).title)
     assert Document.uncached.get(title=old_title).redirect_url()
コード例 #10
0
ファイル: test_models.py プロジェクト: shuhaowu/kitsune
    def test_approved_revision_updates_html(self):
        """Creating an approved revision updates document.html"""
        d, _ = doc_rev('Replace document html')

        assert 'Replace document html' in d.html, \
               '"Replace document html" not in %s' % d.html

        # Creating another approved revision replaces it again
        r = revision(document=d, content='Replace html again',
                     is_approved=True)
        r.save()

        assert 'Replace html again' in d.html, \
               '"Replace html again" not in %s' % d.html
コード例 #11
0
ファイル: test_views.py プロジェクト: GVRV/kitsune
 def test_retitling(self):
     """When the title of an article is edited, a redirect is made."""
     # Not testing slug changes separately; the model tests cover those plus
     # slug+title changes. If title changes work in the view, the rest
     # should also.
     new_title = 'Some New Title'
     d, r = doc_rev()
     old_title = d.title
     data = new_document_data()
     data.update({'title': new_title,
                  'slug': d.slug,
                  'form': 'doc'})
     self.client.post(reverse('wiki.edit_document', args=[d.slug]), data)
     eq_(new_title, Document.uncached.get(slug=d.slug).title)
     assert Document.uncached.get(title=old_title).redirect_url()
コード例 #12
0
ファイル: test_views.py プロジェクト: willkg/kitsune
    def test_changing_products(self):
        """Changing products works as expected."""
        d, r = doc_rev()
        prod_desktop = product(title=u"desktop", save=True)
        prod_mobile = product(title=u"mobile", save=True)

        data = new_document_data()
        data.update({"products": [prod_desktop.id, prod_mobile.id], "title": d.title, "slug": d.slug, "form": "doc"})
        self.client.post(reverse("wiki.edit_document", args=[d.slug]), data)

        eq_(
            sorted(Document.objects.get(slug=d.slug).products.values_list("id", flat=True)),
            sorted([prod.id for prod in [prod_desktop, prod_mobile]]),
        )

        data.update({"products": [prod_desktop.id], "form": "doc"})
        self.client.post(reverse("wiki.edit_document", args=[data["slug"]]), data)
        eq_(
            sorted(Document.objects.get(slug=d.slug).products.values_list("id", flat=True)),
            sorted([prod.id for prod in [prod_desktop]]),
        )
コード例 #13
0
ファイル: test_views.py プロジェクト: GVRV/kitsune
    def test_trans_lock_workflow(self):
        """End to end test of locking on a translated document."""
        doc, _ = doc_rev()
        u = user(save=True, password='******')

        # Create a new translation of doc() using the translation view
        self.client.login(username=u.username, password='******')
        trans_url = reverse('wiki.translate', locale='es', args=[doc.slug])
        data = {
            'title': 'Un Test Articulo',
            'slug': 'un-test-articulo',
            'keywords': 'keyUno, keyDos, keyTres',
            'summary': 'lipsumo',
            'content': 'loremo ipsumo doloro sito ameto'}
        r = self.client.post(trans_url, data)
        eq_(r.status_code, 302)

        # Now run the test.
        edit_url = reverse('wiki.edit_document', locale='es', args=[data['slug']])
        es_doc = Document.objects.get(slug=data['slug'])
        eq_(es_doc.locale, 'es')
        self._lock_workflow(es_doc, edit_url)
コード例 #14
0
ファイル: test_views.py プロジェクト: willkg/kitsune
    def test_trans_lock_workflow(self):
        """End to end test of locking on a translated document."""
        doc, _ = doc_rev()
        u = user(save=True, password="******")

        # Create a new translation of doc() using the translation view
        self.client.login(username=u.username, password="******")
        trans_url = reverse("wiki.translate", locale="es", args=[doc.slug])
        data = {
            "title": "Un Test Articulo",
            "slug": "un-test-articulo",
            "keywords": "keyUno, keyDos, keyTres",
            "summary": "lipsumo",
            "content": "loremo ipsumo doloro sito ameto",
        }
        r = self.client.post(trans_url, data)
        eq_(r.status_code, 302)

        # Now run the test.
        edit_url = reverse("wiki.edit_document", locale="es", args=[data["slug"]])
        es_doc = Document.objects.get(slug=data["slug"])
        eq_(es_doc.locale, "es")
        self._lock_workflow(es_doc, edit_url)
コード例 #15
0
ファイル: test_views.py プロジェクト: GVRV/kitsune
    def test_changing_products(self):
        """Changing products works as expected."""
        d, r = doc_rev()
        prod_desktop = product(title=u'desktop', save=True)
        prod_mobile = product(title=u'mobile', save=True)

        data = new_document_data()
        data.update({'products': [prod_desktop.id, prod_mobile.id],
                     'title': d.title,
                     'slug': d.slug,
                     'form': 'doc'})
        self.client.post(reverse('wiki.edit_document', args=[d.slug]), data)

        eq_(sorted(Document.uncached.get(slug=d.slug).products.values_list(
                    'id', flat=True)),
            sorted([prod.id for prod in [prod_desktop, prod_mobile]]))

        data.update({'products': [prod_desktop.id],
                     'form': 'doc'})
        self.client.post(reverse('wiki.edit_document', args=[data['slug']]),
                         data)
        eq_(sorted(Document.uncached.get(slug=d.slug).products.values_list(
                    'id', flat=True)),
            sorted([prod.id for prod in [prod_desktop]]))
コード例 #16
0
ファイル: test_views.py プロジェクト: willkg/kitsune
 def setUp(self):
     self.doc, _ = doc_rev()
     p = product(save=True)
     self.doc.products.add(p)
     self.doc.save()
コード例 #17
0
ファイル: test_views.py プロジェクト: coooliang/kitsune
 def setUp(self):
     self.doc, _ = doc_rev()
     p = product(save=True)
     self.doc.products.add(p)
     self.doc.save()
コード例 #18
0
ファイル: test_views.py プロジェクト: GVRV/kitsune
 def test_doc_lock_workflow(self):
     """End to end test of locking on an english document."""
     doc, rev = doc_rev()
     url = reverse('wiki.edit_document', args=[doc.slug], locale='en-US')
     self._lock_workflow(doc, url)
コード例 #19
0
 def setUp(self):
     super(MobileDocumentTests, self).setUp()
     self.doc, _ = doc_rev()
     p = product(save=True)
     self.doc.products.add(p)
     self.doc.save()
コード例 #20
0
ファイル: test_views.py プロジェクト: pb6110/kitsune
 def setUp(self):
     super(MobileDocumentTests, self).setUp()
     self.doc, _ = doc_rev()
     p = product(save=True)
     self.doc.products.add(p)
     self.doc.save()
コード例 #21
0
ファイル: test_views.py プロジェクト: pb6110/kitsune
 def setUp(self):
     super(MinimalViewTests, self).setUp()
     self.doc, _ = doc_rev()
     p = product(save=True)
     self.doc.products.add(p)
     self.doc.save()
コード例 #22
0
ファイル: test_models.py プロジェクト: kapalselam/kitsune
 def test_revision_unicode(self):
     """Revision containing unicode characters is saved successfully."""
     str = u' \r\nFirefox informa\xe7\xf5es \u30d8\u30eb'
     _, r = doc_rev(str)
     eq_(str, r.content)
コード例 #23
0
 def setUp(self):
     super(MinimalViewTests, self).setUp()
     self.doc, _ = doc_rev()
     p = product(save=True)
     self.doc.products.add(p)
     self.doc.save()
コード例 #24
0
 def test_doc_lock_workflow(self):
     """End to end test of locking on an english document."""
     doc, rev = doc_rev()
     url = reverse('wiki.edit_document', args=[doc.slug], locale='en-US')
     self._lock_workflow(doc, url)
コード例 #25
0
ファイル: test_models.py プロジェクト: kapalselam/kitsune
 def setUp(self):
     self.d, self.r = doc_rev()
     self.old_title = self.d.title
     self.old_slug = self.d.slug
コード例 #26
0
ファイル: test_models.py プロジェクト: Zucus/kitsune
 def test_revision_unicode(self):
     """Revision containing unicode characters is saved successfully."""
     str = u" \r\nFirefox informa\xe7\xf5es \u30d8\u30eb"
     _, r = doc_rev(str)
     eq_(str, r.content)
コード例 #27
0
ファイル: test_models.py プロジェクト: Zucus/kitsune
 def setUp(self):
     self.d, self.r = doc_rev()
     self.old_title = self.d.title
     self.old_slug = self.d.slug