summaryrefslogtreecommitdiff
path: root/tests/regressiontests/comment_tests
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2011-10-13 18:51:33 +0000
committerAlex Gaynor <alex.gaynor@gmail.com>2011-10-13 18:51:33 +0000
commitd362c1546f8ad62811e5dee3cf0b43170e6e1c4c (patch)
treec14af91e991cb534a135cc0ca467aa6263007b07 /tests/regressiontests/comment_tests
parentd5a45d79fe03cad93ab5761860e9bb6fc1db4c86 (diff)
Convert much of the regression tests to use absolute imports. There's still work to be done though.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16976 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/regressiontests/comment_tests')
-rw-r--r--tests/regressiontests/comment_tests/custom_comments/forms.py1
-rw-r--r--tests/regressiontests/comment_tests/custom_comments/models.py1
-rw-r--r--tests/regressiontests/comment_tests/custom_comments/views.py1
-rw-r--r--tests/regressiontests/comment_tests/models.py3
-rw-r--r--tests/regressiontests/comment_tests/tests/__init__.py5
-rw-r--r--tests/regressiontests/comment_tests/tests/app_api_tests.py6
-rw-r--r--tests/regressiontests/comment_tests/tests/comment_form_tests.py6
-rw-r--r--tests/regressiontests/comment_tests/tests/comment_utils_moderators_tests.py10
-rw-r--r--tests/regressiontests/comment_tests/tests/comment_view_tests.py9
-rw-r--r--tests/regressiontests/comment_tests/tests/feed_tests.py4
-rw-r--r--tests/regressiontests/comment_tests/tests/model_tests.py6
-rw-r--r--tests/regressiontests/comment_tests/tests/moderation_view_tests.py4
-rw-r--r--tests/regressiontests/comment_tests/tests/templatetag_tests.py8
-rw-r--r--tests/regressiontests/comment_tests/urls.py15
14 files changed, 55 insertions, 24 deletions
diff --git a/tests/regressiontests/comment_tests/custom_comments/forms.py b/tests/regressiontests/comment_tests/custom_comments/forms.py
index b788cdcf29..07918ddb8c 100644
--- a/tests/regressiontests/comment_tests/custom_comments/forms.py
+++ b/tests/regressiontests/comment_tests/custom_comments/forms.py
@@ -1,4 +1,5 @@
from django import forms
+
class CustomCommentForm(forms.Form):
pass
diff --git a/tests/regressiontests/comment_tests/custom_comments/models.py b/tests/regressiontests/comment_tests/custom_comments/models.py
index 592ad79586..646f6255f2 100644
--- a/tests/regressiontests/comment_tests/custom_comments/models.py
+++ b/tests/regressiontests/comment_tests/custom_comments/models.py
@@ -1,4 +1,5 @@
from django.db import models
+
class CustomComment(models.Model):
pass
diff --git a/tests/regressiontests/comment_tests/custom_comments/views.py b/tests/regressiontests/comment_tests/custom_comments/views.py
index 93cea9d591..1c3a974367 100644
--- a/tests/regressiontests/comment_tests/custom_comments/views.py
+++ b/tests/regressiontests/comment_tests/custom_comments/views.py
@@ -1,5 +1,6 @@
from django.http import HttpResponse
+
def custom_submit_comment(request):
return HttpResponse("Hello from the custom submit comment view.")
diff --git a/tests/regressiontests/comment_tests/models.py b/tests/regressiontests/comment_tests/models.py
index dc6c842ab6..4093af14b5 100644
--- a/tests/regressiontests/comment_tests/models.py
+++ b/tests/regressiontests/comment_tests/models.py
@@ -4,7 +4,7 @@ more information.
"""
from django.db import models
-from django.test import TestCase
+
class Author(models.Model):
first_name = models.CharField(max_length=30)
@@ -31,4 +31,3 @@ class Entry(models.Model):
class Book(models.Model):
dewey_decimal = models.DecimalField(primary_key=True, decimal_places=2, max_digits=5)
- \ No newline at end of file
diff --git a/tests/regressiontests/comment_tests/tests/__init__.py b/tests/regressiontests/comment_tests/tests/__init__.py
index 88c6f33203..f5f4dac77b 100644
--- a/tests/regressiontests/comment_tests/tests/__init__.py
+++ b/tests/regressiontests/comment_tests/tests/__init__.py
@@ -1,10 +1,13 @@
+from __future__ import absolute_import
+
from django.contrib.auth.models import User
from django.contrib.comments.forms import CommentForm
from django.contrib.comments.models import Comment
from django.contrib.contenttypes.models import ContentType
from django.contrib.sites.models import Site
from django.test import TestCase
-from regressiontests.comment_tests.models import Article, Author
+
+from ..models import Article, Author
# Shortcut
CT = ContentType.objects.get_for_model
diff --git a/tests/regressiontests/comment_tests/tests/app_api_tests.py b/tests/regressiontests/comment_tests/tests/app_api_tests.py
index 4015487e3b..8a63e8c188 100644
--- a/tests/regressiontests/comment_tests/tests/app_api_tests.py
+++ b/tests/regressiontests/comment_tests/tests/app_api_tests.py
@@ -1,8 +1,12 @@
+from __future__ import absolute_import
+
from django.conf import settings
from django.contrib import comments
from django.contrib.comments.models import Comment
from django.contrib.comments.forms import CommentForm
-from regressiontests.comment_tests.tests import CommentTestCase
+
+from . import CommentTestCase
+
class CommentAppAPITests(CommentTestCase):
"""Tests for the "comment app" API"""
diff --git a/tests/regressiontests/comment_tests/tests/comment_form_tests.py b/tests/regressiontests/comment_tests/tests/comment_form_tests.py
index 2c5e1fe551..39ba57928d 100644
--- a/tests/regressiontests/comment_tests/tests/comment_form_tests.py
+++ b/tests/regressiontests/comment_tests/tests/comment_form_tests.py
@@ -1,11 +1,13 @@
+from __future__ import absolute_import
+
import time
from django.conf import settings
from django.contrib.comments.forms import CommentForm
from django.contrib.comments.models import Comment
-from regressiontests.comment_tests.models import Article
-from regressiontests.comment_tests.tests import CommentTestCase
+from . import CommentTestCase
+from ..models import Article
class CommentFormTests(CommentTestCase):
diff --git a/tests/regressiontests/comment_tests/tests/comment_utils_moderators_tests.py b/tests/regressiontests/comment_tests/tests/comment_utils_moderators_tests.py
index ac9bde6fed..eab87ef53b 100644
--- a/tests/regressiontests/comment_tests/tests/comment_utils_moderators_tests.py
+++ b/tests/regressiontests/comment_tests/tests/comment_utils_moderators_tests.py
@@ -1,11 +1,13 @@
-from django.core import mail
+from __future__ import absolute_import
from django.contrib.comments.models import Comment
from django.contrib.comments.moderation import (moderator, CommentModerator,
- AlreadyModerated)
+ AlreadyModerated)
+from django.core import mail
+
+from . import CommentTestCase
+from ..models import Entry
-from regressiontests.comment_tests.models import Entry
-from regressiontests.comment_tests.tests import CommentTestCase
class EntryModerator1(CommentModerator):
email_notification = True
diff --git a/tests/regressiontests/comment_tests/tests/comment_view_tests.py b/tests/regressiontests/comment_tests/tests/comment_view_tests.py
index e3f3bbeff7..5edc58fe2d 100644
--- a/tests/regressiontests/comment_tests/tests/comment_view_tests.py
+++ b/tests/regressiontests/comment_tests/tests/comment_view_tests.py
@@ -1,10 +1,15 @@
+from __future__ import absolute_import
+
import re
+
from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.comments import signals
from django.contrib.comments.models import Comment
-from regressiontests.comment_tests.models import Article, Book
-from regressiontests.comment_tests.tests import CommentTestCase
+
+from . import CommentTestCase
+from ..models import Article, Book
+
post_redirect_re = re.compile(r'^http://testserver/posted/\?c=(?P<pk>\d+$)')
diff --git a/tests/regressiontests/comment_tests/tests/feed_tests.py b/tests/regressiontests/comment_tests/tests/feed_tests.py
index 4497f95c6e..6fe747c22d 100644
--- a/tests/regressiontests/comment_tests/tests/feed_tests.py
+++ b/tests/regressiontests/comment_tests/tests/feed_tests.py
@@ -1,4 +1,6 @@
-from regressiontests.comment_tests.tests import CommentTestCase
+from __future__ import absolute_import
+
+from . import CommentTestCase
class CommentFeedTests(CommentTestCase):
diff --git a/tests/regressiontests/comment_tests/tests/model_tests.py b/tests/regressiontests/comment_tests/tests/model_tests.py
index 2cbf66f07e..c7eaa4cef3 100644
--- a/tests/regressiontests/comment_tests/tests/model_tests.py
+++ b/tests/regressiontests/comment_tests/tests/model_tests.py
@@ -1,7 +1,9 @@
+from __future__ import absolute_import
+
from django.contrib.comments.models import Comment
-from regressiontests.comment_tests.models import Author, Article
-from regressiontests.comment_tests.tests import CommentTestCase
+from . import CommentTestCase
+from ..models import Author, Article
class CommentModelTests(CommentTestCase):
diff --git a/tests/regressiontests/comment_tests/tests/moderation_view_tests.py b/tests/regressiontests/comment_tests/tests/moderation_view_tests.py
index c9be06a340..e9d2fb1578 100644
--- a/tests/regressiontests/comment_tests/tests/moderation_view_tests.py
+++ b/tests/regressiontests/comment_tests/tests/moderation_view_tests.py
@@ -1,9 +1,11 @@
+from __future__ import absolute_import
+
from django.contrib.auth.models import User, Permission
from django.contrib.comments import signals
from django.contrib.comments.models import Comment, CommentFlag
from django.contrib.contenttypes.models import ContentType
-from regressiontests.comment_tests.tests import CommentTestCase
+from . import CommentTestCase
class FlagViewTests(CommentTestCase):
diff --git a/tests/regressiontests/comment_tests/tests/templatetag_tests.py b/tests/regressiontests/comment_tests/tests/templatetag_tests.py
index 99c3ca37fa..930f09d339 100644
--- a/tests/regressiontests/comment_tests/tests/templatetag_tests.py
+++ b/tests/regressiontests/comment_tests/tests/templatetag_tests.py
@@ -1,11 +1,13 @@
-from __future__ import with_statement
+from __future__ import with_statement, absolute_import
from django.contrib.comments.forms import CommentForm
from django.contrib.comments.models import Comment
from django.contrib.contenttypes.models import ContentType
from django.template import Template, Context
-from regressiontests.comment_tests.models import Article, Author
-from regressiontests.comment_tests.tests import CommentTestCase
+
+from ..models import Article, Author
+from . import CommentTestCase
+
class CommentTemplateTagTests(CommentTestCase):
diff --git a/tests/regressiontests/comment_tests/urls.py b/tests/regressiontests/comment_tests/urls.py
index d1a4ec01c2..b2f676786f 100644
--- a/tests/regressiontests/comment_tests/urls.py
+++ b/tests/regressiontests/comment_tests/urls.py
@@ -1,15 +1,20 @@
+from __future__ import absolute_import
+
from django.conf.urls import patterns, url
from django.contrib.comments.feeds import LatestCommentFeed
+from .custom_comments import views
+
+
feeds = {
'comments': LatestCommentFeed,
}
-urlpatterns = patterns('regressiontests.comment_tests.custom_comments.views',
- url(r'^post/$', 'custom_submit_comment'),
- url(r'^flag/(\d+)/$', 'custom_flag_comment'),
- url(r'^delete/(\d+)/$', 'custom_delete_comment'),
- url(r'^approve/(\d+)/$', 'custom_approve_comment'),
+urlpatterns = patterns('',
+ url(r'^post/$', views.custom_submit_comment),
+ url(r'^flag/(\d+)/$', views.custom_flag_comment),
+ url(r'^delete/(\d+)/$', views.custom_delete_comment),
+ url(r'^approve/(\d+)/$', views.custom_approve_comment),
)
urlpatterns += patterns('',