Commit 222f604ef920f11655f9c12c69c5d8f216aa2f61

Authored by Jacob Kaplan-Moss
1 parent 74c3e3b5

Some more work to get tests running. Failing, but running.

1 *.pyc 1 *.pyc
  2 +*.egg-info
1 -Metadata-Version: 1.1  
2 -Name: django-contrib.comments  
3 -Version: 1.5  
4 -Summary: The code formally known as django.contrib.comments.  
5 -Home-page: http://github.com/django/django-contrib-comments  
6 -Author: Django Software Foundation  
7 -Author-email: jacob@jacobian.org  
8 -License: BSD  
9 -Description: UNKNOWN  
10 -Platform: any  
11 -Classifier: Development Status :: 5 - Production/Stable  
12 -Classifier: Environment :: Web Environment  
13 -Classifier: Framework :: Django  
14 -Classifier: Intended Audience :: Developers  
15 -Classifier: Natural Language :: English  
16 -Classifier: License :: OSI Approved :: BSD License  
17 -Classifier: Operating System :: OS Independent  
18 -Classifier: Programming Language :: Python  
19 -Classifier: Programming Language :: Python :: 2.6  
20 -Classifier: Programming Language :: Python :: 2.7  
21 -Classifier: Programming Language :: Python :: 3  
22 -Classifier: Programming Language :: Python :: 3.2  
23 -Classifier: Programming Language :: Python :: 3.3  
1 -README.txt  
2 -setup.py  
3 -django_comments/__init__.py  
4 -django_comments/admin.py  
5 -django_comments/feeds.py  
6 -django_comments/forms.py  
7 -django_comments/managers.py  
8 -django_comments/models.py  
9 -django_comments/moderation.py  
10 -django_comments/signals.py  
11 -django_comments/urls.py  
12 -django_comments/templatetags/__init__.py  
13 -django_comments/templatetags/comments.py  
14 -django_comments/views/__init__.py  
15 -django_comments/views/comments.py  
16 -django_comments/views/moderation.py  
17 -django_comments/views/utils.py  
18 -django_contrib.comments.egg-info/PKG-INFO  
19 -django_contrib.comments.egg-info/SOURCES.txt  
20 -django_contrib.comments.egg-info/dependency_links.txt  
21 -django_contrib.comments.egg-info/top_level.txt  
22 -tests/custom_comments/__init__.py  
23 -tests/custom_comments/forms.py  
24 -tests/custom_comments/models.py  
25 -tests/custom_comments/views.py  
1 from django.core import urlresolvers 1 from django.core import urlresolvers
2 -from comment_tests.custom_comments.models import CustomComment  
3 -from comment_tests.custom_comments.forms import CustomCommentForm 2 +from .models import CustomComment
  3 +from .forms import CustomCommentForm
4 4
5 def get_model(): 5 def get_model():
6 return CustomComment 6 return CustomComment
@@ -10,23 +10,23 @@ def get_form(): @@ -10,23 +10,23 @@ def get_form():
10 10
11 def get_form_target(): 11 def get_form_target():
12 return urlresolvers.reverse( 12 return urlresolvers.reverse(
13 - "comment_tests.custom_comments.views.custom_submit_comment" 13 + "custom_comments.views.custom_submit_comment"
14 ) 14 )
15 15
16 def get_flag_url(c): 16 def get_flag_url(c):
17 return urlresolvers.reverse( 17 return urlresolvers.reverse(
18 - "comment_tests.custom_comments.views.custom_flag_comment", 18 + "custom_comments.views.custom_flag_comment",
19 args=(c.id,) 19 args=(c.id,)
20 ) 20 )
21 21
22 def get_delete_url(c): 22 def get_delete_url(c):
23 return urlresolvers.reverse( 23 return urlresolvers.reverse(
24 - "comment_tests.custom_comments.views.custom_delete_comment", 24 + "custom_comments.views.custom_delete_comment",
25 args=(c.id,) 25 args=(c.id,)
26 ) 26 )
27 27
28 def get_approve_url(c): 28 def get_approve_url(c):
29 return urlresolvers.reverse( 29 return urlresolvers.reverse(
30 - "comment_tests.custom_comments.views.custom_approve_comment", 30 + "custom_comments.views.custom_approve_comment",
31 args=(c.id,) 31 args=(c.id,)
32 ) 32 )
@@ -14,8 +14,18 @@ sys.path[0:0] = [here, parent] @@ -14,8 +14,18 @@ sys.path[0:0] = [here, parent]
14 from django.conf import settings 14 from django.conf import settings
15 settings.configure( 15 settings.configure(
16 DATABASES = {'default': {'ENGINE': 'django.db.backends.sqlite3'}}, 16 DATABASES = {'default': {'ENGINE': 'django.db.backends.sqlite3'}},
  17 + INSTALLED_APPS = [
  18 + "django.contrib.auth",
  19 + "django.contrib.contenttypes",
  20 + "django.contrib.sites",
  21 + "django.contrib.admin",
  22 + "django_comments",
  23 + "testapp",
  24 + "custom_comments",
  25 + ],
  26 + ROOT_URLCONF = 'testapp.urls',
17 SECRET_KEY = "it's a secret to everyone", 27 SECRET_KEY = "it's a secret to everyone",
18 - INSTALLED_APPS = ["django_comments", "testapp", "custom_comments"], 28 + SITE_ID = 1,
19 ) 29 )
20 30
21 from django.test.simple import DjangoTestSuiteRunner 31 from django.test.simple import DjangoTestSuiteRunner
1 [ 1 [
2 { 2 {
3 - "model" : "comment_tests.book", 3 + "model" : "testapp.book",
4 "pk" : 1, 4 "pk" : 1,
5 "fields" : { 5 "fields" : {
6 "dewey_decimal" : "12.34" 6 "dewey_decimal" : "12.34"
7 } 7 }
8 }, 8 },
9 { 9 {
10 - "model" : "comment_tests.author", 10 + "model" : "testapp.author",
11 "pk" : 1, 11 "pk" : 1,
12 "fields" : { 12 "fields" : {
13 "first_name" : "John", 13 "first_name" : "John",
@@ -15,7 +15,7 @@ @@ -15,7 +15,7 @@
15 } 15 }
16 }, 16 },
17 { 17 {
18 - "model" : "comment_tests.author", 18 + "model" : "testapp.author",
19 "pk" : 2, 19 "pk" : 2,
20 "fields" : { 20 "fields" : {
21 "first_name" : "Peter", 21 "first_name" : "Peter",
@@ -23,7 +23,7 @@ @@ -23,7 +23,7 @@
23 } 23 }
24 }, 24 },
25 { 25 {
26 - "model" : "comment_tests.article", 26 + "model" : "testapp.article",
27 "pk" : 1, 27 "pk" : 1,
28 "fields" : { 28 "fields" : {
29 "author" : 1, 29 "author" : 1,
@@ -31,7 +31,7 @@ @@ -31,7 +31,7 @@
31 } 31 }
32 }, 32 },
33 { 33 {
34 - "model" : "comment_tests.article", 34 + "model" : "testapp.article",
35 "pk" : 2, 35 "pk" : 2,
36 "fields" : { 36 "fields" : {
37 "author" : 2, 37 "author" : 2,
1 <?xml version="1.0" encoding="utf-8"?> 1 <?xml version="1.0" encoding="utf-8"?>
2 <django-objects version="1.0"> 2 <django-objects version="1.0">
3 - <object pk="1" model="comment_tests.entry"> 3 + <object pk="1" model="testapp.entry">
4 <field type="CharField" name="title">ABC</field> 4 <field type="CharField" name="title">ABC</field>
5 <field type="TextField" name="body">This is the body</field> 5 <field type="TextField" name="body">This is the body</field>
6 <field type="DateField" name="pub_date">2008-01-01</field> 6 <field type="DateField" name="pub_date">2008-01-01</field>
7 <field type="BooleanField" name="enable_comments">True</field> 7 <field type="BooleanField" name="enable_comments">True</field>
8 </object> 8 </object>
9 - <object pk="2" model="comment_tests.entry"> 9 + <object pk="2" model="testapp.entry">
10 <field type="CharField" name="title">XYZ</field> 10 <field type="CharField" name="title">XYZ</field>
11 <field type="TextField" name="body">Text here</field> 11 <field type="TextField" name="body">Text here</field>
12 <field type="DateField" name="pub_date">2008-01-02</field> 12 <field type="DateField" name="pub_date">2008-01-02</field>
1 from __future__ import absolute_import 1 from __future__ import absolute_import
2 2
3 from django.contrib.auth.models import User 3 from django.contrib.auth.models import User
4 -from django.contrib.comments.forms import CommentForm  
5 -from django.contrib.comments.models import Comment  
6 from django.contrib.contenttypes.models import ContentType 4 from django.contrib.contenttypes.models import ContentType
7 from django.contrib.sites.models import Site 5 from django.contrib.sites.models import Site
8 from django.test import TestCase 6 from django.test import TestCase
9 from django.test.utils import override_settings 7 from django.test.utils import override_settings
10 8
  9 +from django_comments.forms import CommentForm
  10 +from django_comments.models import Comment
  11 +
11 from ..models import Article, Author 12 from ..models import Article, Author
12 13
13 # Shortcut 14 # Shortcut
@@ -17,7 +18,7 @@ CT = ContentType.objects.get_for_model @@ -17,7 +18,7 @@ CT = ContentType.objects.get_for_model
17 @override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.UnsaltedMD5PasswordHasher',)) 18 @override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.UnsaltedMD5PasswordHasher',))
18 class CommentTestCase(TestCase): 19 class CommentTestCase(TestCase):
19 fixtures = ["comment_tests"] 20 fixtures = ["comment_tests"]
20 - urls = 'comment_tests.urls_default' 21 + urls = 'testapp.urls_default'
21 22
22 def createSomeComments(self): 23 def createSomeComments(self):
23 # Two anonymous comments on two different objects 24 # Two anonymous comments on two different objects
@@ -85,11 +86,11 @@ class CommentTestCase(TestCase): @@ -85,11 +86,11 @@ class CommentTestCase(TestCase):
85 d.update(f.initial) 86 d.update(f.initial)
86 return d 87 return d
87 88
88 -from comment_tests.tests.app_api_tests import *  
89 -from comment_tests.tests.feed_tests import *  
90 -from comment_tests.tests.model_tests import *  
91 -from comment_tests.tests.comment_form_tests import *  
92 -from comment_tests.tests.templatetag_tests import *  
93 -from comment_tests.tests.comment_view_tests import *  
94 -from comment_tests.tests.moderation_view_tests import *  
95 -from comment_tests.tests.comment_utils_moderators_tests import * 89 +from .app_api_tests import *
  90 +from .feed_tests import *
  91 +from .model_tests import *
  92 +from .comment_form_tests import *
  93 +from .templatetag_tests import *
  94 +from .comment_view_tests import *
  95 +from .moderation_view_tests import *
  96 +from .comment_utils_moderators_tests import *
1 from __future__ import absolute_import 1 from __future__ import absolute_import
2 2
3 from django.conf import settings 3 from django.conf import settings
4 -from django.contrib import comments  
5 -from django.contrib.comments.models import Comment  
6 -from django.contrib.comments.forms import CommentForm  
7 from django.core.exceptions import ImproperlyConfigured 4 from django.core.exceptions import ImproperlyConfigured
8 from django.test.utils import override_settings 5 from django.test.utils import override_settings
9 from django.utils import six 6 from django.utils import six
10 7
  8 +import django_comments
  9 +from django_comments.models import Comment
  10 +from django_comments.forms import CommentForm
  11 +
11 from . import CommentTestCase 12 from . import CommentTestCase
12 13
13 14
@@ -15,7 +16,7 @@ class CommentAppAPITests(CommentTestCase): @@ -15,7 +16,7 @@ class CommentAppAPITests(CommentTestCase):
15 """Tests for the "comment app" API""" 16 """Tests for the "comment app" API"""
16 17
17 def testGetCommentApp(self): 18 def testGetCommentApp(self):
18 - self.assertEqual(comments.get_comment_app(), comments) 19 + self.assertEqual(django_comments.get_comment_app(), django_comments)
19 20
20 @override_settings( 21 @override_settings(
21 COMMENTS_APP='missing_app', 22 COMMENTS_APP='missing_app',
@@ -23,58 +24,58 @@ class CommentAppAPITests(CommentTestCase): @@ -23,58 +24,58 @@ class CommentAppAPITests(CommentTestCase):
23 ) 24 )
24 def testGetMissingCommentApp(self): 25 def testGetMissingCommentApp(self):
25 with six.assertRaisesRegex(self, ImproperlyConfigured, 'missing_app'): 26 with six.assertRaisesRegex(self, ImproperlyConfigured, 'missing_app'):
26 - _ = comments.get_comment_app() 27 + _ = django_comments.get_comment_app()
27 28
28 def testGetForm(self): 29 def testGetForm(self):
29 - self.assertEqual(comments.get_form(), CommentForm) 30 + self.assertEqual(django_comments.get_form(), CommentForm)
30 31
31 def testGetFormTarget(self): 32 def testGetFormTarget(self):
32 - self.assertEqual(comments.get_form_target(), "/post/") 33 + self.assertEqual(django_comments.get_form_target(), "/post/")
33 34
34 def testGetFlagURL(self): 35 def testGetFlagURL(self):
35 c = Comment(id=12345) 36 c = Comment(id=12345)
36 - self.assertEqual(comments.get_flag_url(c), "/flag/12345/") 37 + self.assertEqual(django_comments.get_flag_url(c), "/flag/12345/")
37 38
38 def getGetDeleteURL(self): 39 def getGetDeleteURL(self):
39 c = Comment(id=12345) 40 c = Comment(id=12345)
40 - self.assertEqual(comments.get_delete_url(c), "/delete/12345/") 41 + self.assertEqual(django_comments.get_delete_url(c), "/delete/12345/")
41 42
42 def getGetApproveURL(self): 43 def getGetApproveURL(self):
43 c = Comment(id=12345) 44 c = Comment(id=12345)
44 - self.assertEqual(comments.get_approve_url(c), "/approve/12345/") 45 + self.assertEqual(django_comments.get_approve_url(c), "/approve/12345/")
45 46
46 47
47 @override_settings( 48 @override_settings(
48 - COMMENTS_APP='comment_tests.custom_comments', 49 + COMMENTS_APP='custom_comments',
49 INSTALLED_APPS=list(settings.INSTALLED_APPS) + [ 50 INSTALLED_APPS=list(settings.INSTALLED_APPS) + [
50 - 'comment_tests.custom_comments'], 51 + 'custom_comments'],
51 ) 52 )
52 class CustomCommentTest(CommentTestCase): 53 class CustomCommentTest(CommentTestCase):
53 - urls = 'comment_tests.urls' 54 + urls = 'testapp.urls'
54 55
55 def testGetCommentApp(self): 56 def testGetCommentApp(self):
56 - from comment_tests import custom_comments  
57 - self.assertEqual(comments.get_comment_app(), custom_comments) 57 + import custom_comments
  58 + self.assertEqual(django_comments.get_comment_app(), custom_comments)
58 59
59 def testGetModel(self): 60 def testGetModel(self):
60 - from comment_tests.custom_comments.models import CustomComment  
61 - self.assertEqual(comments.get_model(), CustomComment) 61 + from custom_comments.models import CustomComment
  62 + self.assertEqual(django_comments.get_model(), CustomComment)
62 63
63 def testGetForm(self): 64 def testGetForm(self):
64 - from comment_tests.custom_comments.forms import CustomCommentForm  
65 - self.assertEqual(comments.get_form(), CustomCommentForm) 65 + from custom_comments.forms import CustomCommentForm
  66 + self.assertEqual(django_comments.get_form(), CustomCommentForm)
66 67
67 def testGetFormTarget(self): 68 def testGetFormTarget(self):
68 - self.assertEqual(comments.get_form_target(), "/post/") 69 + self.assertEqual(django_comments.get_form_target(), "/post/")
69 70
70 def testGetFlagURL(self): 71 def testGetFlagURL(self):
71 c = Comment(id=12345) 72 c = Comment(id=12345)
72 - self.assertEqual(comments.get_flag_url(c), "/flag/12345/") 73 + self.assertEqual(django_comments.get_flag_url(c), "/flag/12345/")
73 74
74 def getGetDeleteURL(self): 75 def getGetDeleteURL(self):
75 c = Comment(id=12345) 76 c = Comment(id=12345)
76 - self.assertEqual(comments.get_delete_url(c), "/delete/12345/") 77 + self.assertEqual(django_comments.get_delete_url(c), "/delete/12345/")
77 78
78 def getGetApproveURL(self): 79 def getGetApproveURL(self):
79 c = Comment(id=12345) 80 c = Comment(id=12345)
80 - self.assertEqual(comments.get_approve_url(c), "/approve/12345/") 81 + self.assertEqual(django_comments.get_approve_url(c), "/approve/12345/")
@@ -3,8 +3,9 @@ from __future__ import absolute_import @@ -3,8 +3,9 @@ from __future__ import absolute_import
3 import time 3 import time
4 4
5 from django.conf import settings 5 from django.conf import settings
6 -from django.contrib.comments.forms import CommentForm  
7 -from django.contrib.comments.models import Comment 6 +
  7 +from django_comments.forms import CommentForm
  8 +from django_comments.models import Comment
8 9
9 from . import CommentTestCase 10 from . import CommentTestCase
10 from ..models import Article 11 from ..models import Article
1 from __future__ import absolute_import 1 from __future__ import absolute_import
2 2
3 -from django.contrib.comments.models import Comment  
4 -from django.contrib.comments.moderation import (moderator, CommentModerator,  
5 - AlreadyModerated)  
6 from django.core import mail 3 from django.core import mail
7 4
  5 +from django_comments.models import Comment
  6 +from django_comments.moderation import (moderator, CommentModerator,
  7 + AlreadyModerated)
  8 +
8 from . import CommentTestCase 9 from . import CommentTestCase
9 from ..models import Entry 10 from ..models import Entry
10 11
@@ -94,4 +95,4 @@ class CommentUtilsModeratorTests(CommentTestCase): @@ -94,4 +95,4 @@ class CommentUtilsModeratorTests(CommentTestCase):
94 def testAutoCloseFieldImmediate(self): 95 def testAutoCloseFieldImmediate(self):
95 moderator.register(Entry, EntryModerator6) 96 moderator.register(Entry, EntryModerator6)
96 c1, c2 = self.createSomeComments() 97 c1, c2 = self.createSomeComments()
97 - self.assertEqual(Comment.objects.all().count(), 0)  
  98 + self.assertEqual(Comment.objects.all().count(), 0)
@@ -4,8 +4,9 @@ import re @@ -4,8 +4,9 @@ import re
4 4
5 from django.conf import settings 5 from django.conf import settings
6 from django.contrib.auth.models import User 6 from django.contrib.auth.models import User
7 -from django.contrib.comments import signals  
8 -from django.contrib.comments.models import Comment 7 +
  8 +from django_comments import signals
  9 +from django_comments.models import Comment
9 10
10 from . import CommentTestCase 11 from . import CommentTestCase
11 from ..models import Article, Book 12 from ..models import Article, Book
@@ -3,16 +3,17 @@ from __future__ import absolute_import @@ -3,16 +3,17 @@ from __future__ import absolute_import
3 from xml.etree import ElementTree as ET 3 from xml.etree import ElementTree as ET
4 4
5 from django.conf import settings 5 from django.conf import settings
6 -from django.contrib.comments.models import Comment  
7 from django.contrib.contenttypes.models import ContentType 6 from django.contrib.contenttypes.models import ContentType
8 from django.contrib.sites.models import Site 7 from django.contrib.sites.models import Site
9 8
  9 +from django_comments.models import Comment
  10 +
10 from . import CommentTestCase 11 from . import CommentTestCase
11 from ..models import Article 12 from ..models import Article
12 13
13 14
14 class CommentFeedTests(CommentTestCase): 15 class CommentFeedTests(CommentTestCase):
15 - urls = 'comment_tests.urls' 16 + urls = 'testapp.urls'
16 feed_url = '/rss/comments/' 17 feed_url = '/rss/comments/'
17 18
18 def setUp(self): 19 def setUp(self):
1 from __future__ import absolute_import 1 from __future__ import absolute_import
2 2
3 -from django.contrib.comments.models import Comment 3 +from django_comments.models import Comment
4 4
5 from . import CommentTestCase 5 from . import CommentTestCase
6 from ..models import Author, Article 6 from ..models import Author, Article
1 from __future__ import absolute_import, unicode_literals 1 from __future__ import absolute_import, unicode_literals
2 2
3 from django.contrib.auth.models import User, Permission 3 from django.contrib.auth.models import User, Permission
4 -from django.contrib.comments import signals  
5 -from django.contrib.comments.models import Comment, CommentFlag  
6 from django.contrib.contenttypes.models import ContentType 4 from django.contrib.contenttypes.models import ContentType
7 from django.utils import translation 5 from django.utils import translation
8 6
  7 +from django_comments import signals
  8 +from django_comments.models import Comment, CommentFlag
  9 +
9 from . import CommentTestCase 10 from . import CommentTestCase
10 11
11 12
@@ -252,7 +253,7 @@ class ApproveViewTests(CommentTestCase): @@ -252,7 +253,7 @@ class ApproveViewTests(CommentTestCase):
252 self.assertTemplateUsed(response, "comments/approved.html") 253 self.assertTemplateUsed(response, "comments/approved.html")
253 254
254 class AdminActionsTests(CommentTestCase): 255 class AdminActionsTests(CommentTestCase):
255 - urls = "comment_tests.urls_admin" 256 + urls = "testapp.urls_admin"
256 257
257 def setUp(self): 258 def setUp(self):
258 super(AdminActionsTests, self).setUp() 259 super(AdminActionsTests, self).setUp()
1 from __future__ import absolute_import 1 from __future__ import absolute_import
2 2
3 -from django.contrib.comments.forms import CommentForm  
4 -from django.contrib.comments.models import Comment  
5 from django.contrib.contenttypes.models import ContentType 3 from django.contrib.contenttypes.models import ContentType
6 from django.template import Template, Context, Library, libraries 4 from django.template import Template, Context, Library, libraries
7 5
  6 +from django_comments.forms import CommentForm
  7 +from django_comments.models import Comment
  8 +
8 from ..models import Article, Author 9 from ..models import Article, Author
9 from . import CommentTestCase 10 from . import CommentTestCase
10 11
@@ -29,13 +30,13 @@ class CommentTemplateTagTests(CommentTestCase): @@ -29,13 +30,13 @@ class CommentTemplateTagTests(CommentTestCase):
29 self.assertEqual(out, "/post/") 30 self.assertEqual(out, "/post/")
30 31
31 def testGetCommentForm(self, tag=None): 32 def testGetCommentForm(self, tag=None):
32 - t = "{% load comments %}" + (tag or "{% get_comment_form for comment_tests.article a.id as form %}") 33 + t = "{% load comments %}" + (tag or "{% get_comment_form for testapp.article a.id as form %}")
33 ctx, out = self.render(t, a=Article.objects.get(pk=1)) 34 ctx, out = self.render(t, a=Article.objects.get(pk=1))
34 self.assertEqual(out, "") 35 self.assertEqual(out, "")
35 self.assertTrue(isinstance(ctx["form"], CommentForm)) 36 self.assertTrue(isinstance(ctx["form"], CommentForm))
36 37
37 def testGetCommentFormFromLiteral(self): 38 def testGetCommentFormFromLiteral(self):
38 - self.testGetCommentForm("{% get_comment_form for comment_tests.article 1 as form %}") 39 + self.testGetCommentForm("{% get_comment_form for testapp.article 1 as form %}")
39 40
40 def testGetCommentFormFromObject(self): 41 def testGetCommentFormFromObject(self):
41 self.testGetCommentForm("{% get_comment_form for a as form %}") 42 self.testGetCommentForm("{% get_comment_form for a as form %}")
@@ -44,13 +45,13 @@ class CommentTemplateTagTests(CommentTestCase): @@ -44,13 +45,13 @@ class CommentTemplateTagTests(CommentTestCase):
44 self.testGetCommentForm("{% load comment_testtags %}{% get_comment_form for a|noop:'x y' as form %}") 45 self.testGetCommentForm("{% load comment_testtags %}{% get_comment_form for a|noop:'x y' as form %}")
45 46
46 def testRenderCommentForm(self, tag=None): 47 def testRenderCommentForm(self, tag=None):
47 - t = "{% load comments %}" + (tag or "{% render_comment_form for comment_tests.article a.id %}") 48 + t = "{% load comments %}" + (tag or "{% render_comment_form for testapp.article a.id %}")
48 ctx, out = self.render(t, a=Article.objects.get(pk=1)) 49 ctx, out = self.render(t, a=Article.objects.get(pk=1))
49 self.assertTrue(out.strip().startswith("<form action=")) 50 self.assertTrue(out.strip().startswith("<form action="))
50 self.assertTrue(out.strip().endswith("</form>")) 51 self.assertTrue(out.strip().endswith("</form>"))
51 52
52 def testRenderCommentFormFromLiteral(self): 53 def testRenderCommentFormFromLiteral(self):
53 - self.testRenderCommentForm("{% render_comment_form for comment_tests.article 1 %}") 54 + self.testRenderCommentForm("{% render_comment_form for testapp.article 1 %}")
54 55
55 def testRenderCommentFormFromObject(self): 56 def testRenderCommentFormFromObject(self):
56 self.testRenderCommentForm("{% render_comment_form for a %}") 57 self.testRenderCommentForm("{% render_comment_form for a %}")
@@ -63,17 +64,17 @@ class CommentTemplateTagTests(CommentTestCase): @@ -63,17 +64,17 @@ class CommentTemplateTagTests(CommentTestCase):
63 self.testRenderCommentFormFromObject() 64 self.testRenderCommentFormFromObject()
64 65
65 def verifyGetCommentCount(self, tag=None): 66 def verifyGetCommentCount(self, tag=None):
66 - t = "{% load comments %}" + (tag or "{% get_comment_count for comment_tests.article a.id as cc %}") + "{{ cc }}" 67 + t = "{% load comments %}" + (tag or "{% get_comment_count for testapp.article a.id as cc %}") + "{{ cc }}"
67 ctx, out = self.render(t, a=Article.objects.get(pk=1)) 68 ctx, out = self.render(t, a=Article.objects.get(pk=1))
68 self.assertEqual(out, "2") 69 self.assertEqual(out, "2")
69 70
70 def testGetCommentCount(self): 71 def testGetCommentCount(self):
71 self.createSomeComments() 72 self.createSomeComments()
72 - self.verifyGetCommentCount("{% get_comment_count for comment_tests.article a.id as cc %}") 73 + self.verifyGetCommentCount("{% get_comment_count for testapp.article a.id as cc %}")
73 74
74 def testGetCommentCountFromLiteral(self): 75 def testGetCommentCountFromLiteral(self):
75 self.createSomeComments() 76 self.createSomeComments()
76 - self.verifyGetCommentCount("{% get_comment_count for comment_tests.article 1 as cc %}") 77 + self.verifyGetCommentCount("{% get_comment_count for testapp.article 1 as cc %}")
77 78
78 def testGetCommentCountFromObject(self): 79 def testGetCommentCountFromObject(self):
79 self.createSomeComments() 80 self.createSomeComments()
@@ -85,18 +86,18 @@ class CommentTemplateTagTests(CommentTestCase): @@ -85,18 +86,18 @@ class CommentTemplateTagTests(CommentTestCase):
85 86
86 def verifyGetCommentList(self, tag=None): 87 def verifyGetCommentList(self, tag=None):
87 c1, c2, c3, c4 = Comment.objects.all()[:4] 88 c1, c2, c3, c4 = Comment.objects.all()[:4]
88 - t = "{% load comments %}" + (tag or "{% get_comment_list for comment_tests.author a.id as cl %}") 89 + t = "{% load comments %}" + (tag or "{% get_comment_list for testapp.author a.id as cl %}")
89 ctx, out = self.render(t, a=Author.objects.get(pk=1)) 90 ctx, out = self.render(t, a=Author.objects.get(pk=1))
90 self.assertEqual(out, "") 91 self.assertEqual(out, "")
91 self.assertEqual(list(ctx["cl"]), [c2]) 92 self.assertEqual(list(ctx["cl"]), [c2])
92 93
93 def testGetCommentList(self): 94 def testGetCommentList(self):
94 self.createSomeComments() 95 self.createSomeComments()
95 - self.verifyGetCommentList("{% get_comment_list for comment_tests.author a.id as cl %}") 96 + self.verifyGetCommentList("{% get_comment_list for testapp.author a.id as cl %}")
96 97
97 def testGetCommentListFromLiteral(self): 98 def testGetCommentListFromLiteral(self):
98 self.createSomeComments() 99 self.createSomeComments()
99 - self.verifyGetCommentList("{% get_comment_list for comment_tests.author 1 as cl %}") 100 + self.verifyGetCommentList("{% get_comment_list for testapp.author 1 as cl %}")
100 101
101 def testGetCommentListFromObject(self): 102 def testGetCommentListFromObject(self):
102 self.createSomeComments() 103 self.createSomeComments()
@@ -108,7 +109,7 @@ class CommentTemplateTagTests(CommentTestCase): @@ -108,7 +109,7 @@ class CommentTemplateTagTests(CommentTestCase):
108 109
109 def testGetCommentPermalink(self): 110 def testGetCommentPermalink(self):
110 c1, c2, c3, c4 = self.createSomeComments() 111 c1, c2, c3, c4 = self.createSomeComments()
111 - t = "{% load comments %}{% get_comment_list for comment_tests.author author.id as cl %}" 112 + t = "{% load comments %}{% get_comment_list for testapp.author author.id as cl %}"
112 t += "{% get_comment_permalink cl.0 %}" 113 t += "{% get_comment_permalink cl.0 %}"
113 ct = ContentType.objects.get_for_model(Author) 114 ct = ContentType.objects.get_for_model(Author)
114 author = Author.objects.get(pk=1) 115 author = Author.objects.get(pk=1)
@@ -117,7 +118,7 @@ class CommentTemplateTagTests(CommentTestCase): @@ -117,7 +118,7 @@ class CommentTemplateTagTests(CommentTestCase):
117 118
118 def testGetCommentPermalinkFormatted(self): 119 def testGetCommentPermalinkFormatted(self):
119 c1, c2, c3, c4 = self.createSomeComments() 120 c1, c2, c3, c4 = self.createSomeComments()
120 - t = "{% load comments %}{% get_comment_list for comment_tests.author author.id as cl %}" 121 + t = "{% load comments %}{% get_comment_list for testapp.author author.id as cl %}"
121 t += "{% get_comment_permalink cl.0 '#c%(id)s-by-%(user_name)s' %}" 122 t += "{% get_comment_permalink cl.0 '#c%(id)s-by-%(user_name)s' %}"
122 ct = ContentType.objects.get_for_model(Author) 123 ct = ContentType.objects.get_for_model(Author)
123 author = Author.objects.get(pk=1) 124 author = Author.objects.get(pk=1)
@@ -126,7 +127,7 @@ class CommentTemplateTagTests(CommentTestCase): @@ -126,7 +127,7 @@ class CommentTemplateTagTests(CommentTestCase):
126 127
127 def testWhitespaceInGetCommentPermalinkTag(self): 128 def testWhitespaceInGetCommentPermalinkTag(self):
128 c1, c2, c3, c4 = self.createSomeComments() 129 c1, c2, c3, c4 = self.createSomeComments()
129 - t = "{% load comments comment_testtags %}{% get_comment_list for comment_tests.author author.id as cl %}" 130 + t = "{% load comments comment_testtags %}{% get_comment_list for testapp.author author.id as cl %}"
130 t += "{% get_comment_permalink cl.0|noop:'x y' %}" 131 t += "{% get_comment_permalink cl.0|noop:'x y' %}"
131 ct = ContentType.objects.get_for_model(Author) 132 ct = ContentType.objects.get_for_model(Author)
132 author = Author.objects.get(pk=1) 133 author = Author.objects.get(pk=1)
@@ -134,13 +135,13 @@ class CommentTemplateTagTests(CommentTestCase): @@ -134,13 +135,13 @@ class CommentTemplateTagTests(CommentTestCase):
134 self.assertEqual(out, "/cr/%s/%s/#c%s" % (ct.id, author.id, c2.id)) 135 self.assertEqual(out, "/cr/%s/%s/#c%s" % (ct.id, author.id, c2.id))
135 136
136 def testRenderCommentList(self, tag=None): 137 def testRenderCommentList(self, tag=None):
137 - t = "{% load comments %}" + (tag or "{% render_comment_list for comment_tests.article a.id %}") 138 + t = "{% load comments %}" + (tag or "{% render_comment_list for testapp.article a.id %}")
138 ctx, out = self.render(t, a=Article.objects.get(pk=1)) 139 ctx, out = self.render(t, a=Article.objects.get(pk=1))
139 self.assertTrue(out.strip().startswith("<dl id=\"comments\">")) 140 self.assertTrue(out.strip().startswith("<dl id=\"comments\">"))
140 self.assertTrue(out.strip().endswith("</dl>")) 141 self.assertTrue(out.strip().endswith("</dl>"))
141 142
142 def testRenderCommentListFromLiteral(self): 143 def testRenderCommentListFromLiteral(self):
143 - self.testRenderCommentList("{% render_comment_list for comment_tests.article 1 %}") 144 + self.testRenderCommentList("{% render_comment_list for testapp.article 1 %}")
144 145
145 def testRenderCommentListFromObject(self): 146 def testRenderCommentListFromObject(self):
146 self.testRenderCommentList("{% render_comment_list for a %}") 147 self.testRenderCommentList("{% render_comment_list for a %}")
1 from __future__ import absolute_import 1 from __future__ import absolute_import
2 2
3 from django.conf.urls import patterns, url 3 from django.conf.urls import patterns, url
4 -from django.contrib.comments.feeds import LatestCommentFeed 4 +
  5 +from django_comments.feeds import LatestCommentFeed
5 6
6 from .custom_comments import views 7 from .custom_comments import views
7 8
1 from django.conf.urls import patterns, include 1 from django.conf.urls import patterns, include
2 from django.contrib import admin 2 from django.contrib import admin
3 -from django.contrib.comments.admin import CommentsAdmin  
4 -from django.contrib.comments.models import Comment 3 +from django_comments.admin import CommentsAdmin
  4 +from django_comments.models import Comment
5 5
6 # Make a new AdminSite to avoid picking up the deliberately broken admin 6 # Make a new AdminSite to avoid picking up the deliberately broken admin
7 # modules in other tests. 7 # modules in other tests.
1 from django.conf.urls import patterns, include 1 from django.conf.urls import patterns, include
2 2
3 urlpatterns = patterns('', 3 urlpatterns = patterns('',
4 - (r'^', include('django.contrib.comments.urls')), 4 + (r'^', include('django_comments.urls')),
5 5
6 # Provide the auth system login and logout views 6 # Provide the auth system login and logout views
7 (r'^accounts/login/$', 'django.contrib.auth.views.login', {'template_name': 'login.html'}), 7 (r'^accounts/login/$', 'django.contrib.auth.views.login', {'template_name': 'login.html'}),
Please register or login to post a comment