M .gitignore => .gitignore +3 -0
@@ 14,6 14,9 @@ wiki/attachments
#PyCharm
.idea
+# Test artifacts
+cache
+wiki/images
#Docs
docs/_build
M wiki/tests/test_views.py => wiki/tests/test_views.py +49 -0
@@ 3,6 3,7 @@ from __future__ import absolute_import, print_function, unicode_literals
import pprint
from django.contrib.auth import authenticate
+from wiki import models
from wiki.models import reverse
from .base import ArticleWebTestBase, WebTestBase
@@ 345,3 346,51 @@ class UpdateProfileViewTest(ArticleWebTestBase):
self.assertNotEqual(test_auth, None)
self.assertEqual(test_auth.email, 'test@test.com')
+
+
+class MergeViewTest(ArticleWebTestBase):
+
+ def test_merge_preview(self):
+ """Test merge preview"""
+
+ c = self.c
+ example_data = {
+ 'content': 'More modifications\n\nMerge new line',
+ 'current_revision': '1',
+ 'preview': '0',
+ 'save': '1',
+ 'summary': 'testing merge',
+ 'title': 'wiki test'
+ }
+
+ previous_revision = self.root_article.current_revision.id
+
+ # save a new revision
+ c.post(
+ reverse('wiki:edit', kwargs={'path': ''}),
+ example_data
+ )
+
+ response = c.get(
+ reverse(
+ 'wiki:merge_revision_preview',
+ kwargs={'article_id': self.root_article.id, 'revision_id': previous_revision}
+ ),
+ )
+
+ new_revision = models.Article.objects.get(
+ id=self.root_article.id
+ ).current_revision.id
+
+ self.assertContains(
+ response,
+ 'Previewing merge between:'
+ )
+ self.assertContains(
+ response,
+ '#{rev_id}'.format(rev_id=previous_revision)
+ )
+ self.assertContains(
+ response,
+ '#{rev_id}'.format(rev_id=new_revision)
+ )
M wiki/views/accounts.py => wiki/views/accounts.py +1 -1
@@ 47,7 47,7 @@ class Signup(CreateView):
c = RequestContext(
request, {
'error_msg': _('Account signup is only allowed for administrators.'), })
- return render_to_response("wiki/error.html", context_instance=c)
+ return render_to_response("wiki/error.html", context=c)
return super(Signup, self).dispatch(request, *args, **kwargs)
M wiki/views/article.py => wiki/views/article.py +1 -1
@@ 875,7 875,7 @@ def merge(
'merge2': article.current_revision,
'merge': True,
'content': content})
- return render_to_response(template_file, context_instance=c)
+ return render_to_response(template_file, context=c)
class CreateRootView(FormView):