~ubuntu-branches/ubuntu/saucy/python-django/saucy-updates

« back to all changes in this revision

Viewing changes to tests/regressiontests/comment_tests/tests/app_api_tests.py

  • Committer: Package Import Robot
  • Author(s): Luke Faraone, Jakub Wilk, Luke Faraone
  • Date: 2013-05-09 15:10:47 UTC
  • mfrom: (1.1.21) (4.4.27 sid)
  • Revision ID: package-import@ubuntu.com-20130509151047-aqv8d71oj9wvcv8c
Tags: 1.5.1-2
[ Jakub Wilk ]
* Use canonical URIs for Vcs-* fields.

[ Luke Faraone ]
* Upload to unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
from django.contrib import comments
5
5
from django.contrib.comments.models import Comment
6
6
from django.contrib.comments.forms import CommentForm
 
7
from django.core.exceptions import ImproperlyConfigured
 
8
from django.test.utils import override_settings
 
9
from django.utils import six
7
10
 
8
11
from . import CommentTestCase
9
12
 
14
17
    def testGetCommentApp(self):
15
18
        self.assertEqual(comments.get_comment_app(), comments)
16
19
 
 
20
    @override_settings(
 
21
        COMMENTS_APP='missing_app',
 
22
        INSTALLED_APPS=list(settings.INSTALLED_APPS) + ['missing_app'],
 
23
    )
 
24
    def testGetMissingCommentApp(self):
 
25
        with six.assertRaisesRegex(self, ImproperlyConfigured, 'missing_app'):
 
26
            _ = comments.get_comment_app()
 
27
 
17
28
    def testGetForm(self):
18
29
        self.assertEqual(comments.get_form(), CommentForm)
19
30
 
33
44
        self.assertEqual(comments.get_approve_url(c), "/approve/12345/")
34
45
 
35
46
 
 
47
@override_settings(
 
48
    COMMENTS_APP='regressiontests.comment_tests.custom_comments',
 
49
    INSTALLED_APPS=list(settings.INSTALLED_APPS) + [
 
50
        'regressiontests.comment_tests.custom_comments'],
 
51
)
36
52
class CustomCommentTest(CommentTestCase):
37
53
    urls = 'regressiontests.comment_tests.urls'
38
54
 
39
 
    def setUp(self):
40
 
        self.old_comments_app = getattr(settings, 'COMMENTS_APP', None)
41
 
        settings.COMMENTS_APP = 'regressiontests.comment_tests.custom_comments'
42
 
        settings.INSTALLED_APPS = list(settings.INSTALLED_APPS) + [settings.COMMENTS_APP,]
43
 
 
44
 
    def tearDown(self):
45
 
        del settings.INSTALLED_APPS[-1]
46
 
        settings.COMMENTS_APP = self.old_comments_app
47
 
        if settings.COMMENTS_APP is None:
48
 
            del settings._wrapped.COMMENTS_APP
49
 
 
50
55
    def testGetCommentApp(self):
51
56
        from regressiontests.comment_tests import custom_comments
52
57
        self.assertEqual(comments.get_comment_app(), custom_comments)