1
from __future__ import absolute_import
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
7
from django.contrib.sites.models import Site
8
from django.test import TestCase
9
from django.test.utils import override_settings
11
from ..models import Article, Author
14
CT = ContentType.objects.get_for_model
16
# Helper base class for comment tests that need data.
17
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.UnsaltedMD5PasswordHasher',))
18
class CommentTestCase(TestCase):
19
fixtures = ["comment_tests"]
20
urls = 'comment_tests.urls_default'
22
def createSomeComments(self):
23
# Two anonymous comments on two different objects
24
c1 = Comment.objects.create(
25
content_type = CT(Article),
27
user_name = "Joe Somebody",
28
user_email = "jsomebody@example.com",
29
user_url = "http://example.com/~joe/",
31
site = Site.objects.get_current(),
33
c2 = Comment.objects.create(
34
content_type = CT(Author),
36
user_name = "Joe Somebody",
37
user_email = "jsomebody@example.com",
38
user_url = "http://example.com/~joe/",
39
comment = "First here, too!",
40
site = Site.objects.get_current(),
43
# Two authenticated comments: one on the same Article, and
44
# one on a different Author
45
user = User.objects.create(
46
username = "frank_nobody",
49
email = "fnobody@example.com",
55
c3 = Comment.objects.create(
56
content_type = CT(Article),
59
user_url = "http://example.com/~frank/",
60
comment = "Damn, I wanted to be first.",
61
site = Site.objects.get_current(),
63
c4 = Comment.objects.create(
64
content_type = CT(Author),
67
user_url = "http://example.com/~frank/",
68
comment = "You get here first, too?",
69
site = Site.objects.get_current(),
77
'email' : 'jim.bob@example.com',
79
'comment' : 'This is my comment',
82
def getValidData(self, obj):
88
from comment_tests.tests.test_app_api import *
89
from comment_tests.tests.test_feeds import *
90
from comment_tests.tests.test_models import *
91
from comment_tests.tests.test_comment_form import *
92
from comment_tests.tests.test_templatetags import *
93
from comment_tests.tests.test_comment_view import *
94
from comment_tests.tests.test_comment_utils_moderators import *
95
from comment_tests.tests.test_moderation_views import *