Beispiel #1
0
 def test_preview(self):
     """Preview the wiki syntax content."""
     response = post(self.client, 'wiki.preview',
                     {'content': '<h1>Test Content</h1>'})
     eq_(200, response.status_code)
     doc = pq(response.content)
     eq_('Test Content', doc('article#wikiArticle h1').text())
Beispiel #2
0
 def test_preview(self):
     """Preview the wiki syntax content."""
     response = post(self.client, 'wiki.preview',
                     {'content': '<h1>Test Content</h1>'})
     eq_(200, response.status_code)
     doc = pq(response.content)
     eq_('Test Content', doc('article#wikiArticle h1').text())
Beispiel #3
0
 def test_change_title_case(self):
     """Changing the case of some letters in the title should work."""
     data = new_document_data()
     new_title = 'TeST DoCuMent'
     data.update(title=new_title)
     data.update(form='doc')
     response = post(self.client, 'wiki.edit', data, args=[self.d.slug])
     eq_(200, response.status_code)
     doc = Document.objects.get(pk=self.d.pk)
     eq_(new_title, doc.title)
Beispiel #4
0
 def test_vote_anonymous(self):
     """Test that voting works for anonymous user."""
     d = self.document
     response = post(self.client, 'wiki.document_vote',
                     {'helpful': 'Yes'}, args=[d.slug])
     eq_(200, response.status_code)
     votes = HelpfulVote.objects.filter(document=d, creator=None)
     votes = votes.exclude(anonymous_id=None)
     eq_(1, votes.count())
     assert votes[0].helpful
Beispiel #5
0
 def test_vote_anonymous(self):
     """Test that voting works for anonymous user."""
     d = self.document
     response = post(self.client,
                     'wiki.document_vote', {'helpful': 'Yes'},
                     args=[d.slug])
     eq_(200, response.status_code)
     votes = HelpfulVote.objects.filter(document=d, creator=None)
     votes = votes.exclude(anonymous_id=None)
     eq_(1, votes.count())
     assert votes[0].helpful
Beispiel #6
0
 def test_change_title_case(self):
     """Changing the case of some letters in the title should work."""
     data = new_document_data()
     new_title = 'TeST DoCuMent'
     data.update(title=new_title)
     data.update(form='doc')
     response = post(self.client, 'wiki.edit', data,
                     args=[self.d.slug])
     eq_(200, response.status_code)
     doc = Document.objects.get(pk=self.d.pk)
     eq_(new_title, doc.title)
Beispiel #7
0
 def test_vote_no(self):
     """Test voting not helpful."""
     d = self.document
     user = self.user_model.objects.get(username='******')
     self.client.login(username='******', password='******')
     response = post(self.client, 'wiki.document_vote',
                     {'not-helpful': 'No'}, args=[d.slug])
     eq_(200, response.status_code)
     votes = HelpfulVote.objects.filter(document=d, creator=user)
     eq_(1, votes.count())
     assert not votes[0].helpful
Beispiel #8
0
 def test_change_slug_case(self):
     """Changing the case of some letters in the slug should work."""
     data = new_document_data()
     new_slug = 'Test-Document'
     data.update(slug=new_slug)
     data.update(form='doc')
     response = post(self.client, 'wiki.edit_document', data,
                     args=[self.d.slug])
     eq_(200, response.status_code)
     doc = Document.objects.get(pk=self.d.pk)
     eq_(new_slug, doc.slug)
Beispiel #9
0
 def test_vote_no(self):
     """Test voting not helpful."""
     d = self.document
     user = self.user_model.objects.get(username='******')
     self.client.login(username='******', password='******')
     response = post(self.client,
                     'wiki.document_vote', {'not-helpful': 'No'},
                     args=[d.slug])
     eq_(200, response.status_code)
     votes = HelpfulVote.objects.filter(document=d, creator=user)
     eq_(1, votes.count())
     assert not votes[0].helpful
Beispiel #10
0
 def test_change_slug_case(self):
     """Changing the case of some letters in the slug should work."""
     data = new_document_data()
     new_slug = 'Test-Document'
     data.update(slug=new_slug)
     data.update(form='doc')
     response = post(self.client,
                     'wiki.edit_document',
                     data,
                     args=[self.d.slug])
     eq_(200, response.status_code)
     doc = Document.objects.get(pk=self.d.pk)
     eq_(new_slug, doc.slug)
Beispiel #11
0
 def test_can_save_document_with_translations(self):
     """Make sure we can save a document with translations."""
     # Create a translation
     _create_document(title='Document Prueba', parent=self.d, locale='es')
     # Make sure is_localizable hidden field is rendered
     response = get(self.client, 'wiki.edit', args=[self.d.slug])
     eq_(200, response.status_code)
     doc = pq(response.content)
     data = new_document_data()
     new_title = 'A brand new title'
     data.update(title=new_title)
     data.update(form='doc')
     data.update(is_localizable='True')
     response = post(self.client, 'wiki.edit', data, args=[self.d.slug])
     eq_(200, response.status_code)
     doc = Document.objects.get(pk=self.d.pk)
     eq_(new_title, doc.title)
Beispiel #12
0
 def test_can_save_document_with_translations(self):
     """Make sure we can save a document with translations."""
     # Create a translation
     _create_document(title='Document Prueba', parent=self.d,
                      locale='es')
     # Make sure is_localizable hidden field is rendered
     response = get(self.client, 'wiki.edit',
                    args=[self.d.slug])
     eq_(200, response.status_code)
     doc = pq(response.content)
     data = new_document_data()
     new_title = 'A brand new title'
     data.update(title=new_title)
     data.update(form='doc')
     data.update(is_localizable='True')
     response = post(self.client, 'wiki.edit', data,
                     args=[self.d.slug])
     eq_(200, response.status_code)
     doc = Document.objects.get(pk=self.d.pk)
     eq_(new_title, doc.title)