# Path: comments/models.py
# class CommentManager(models.Manager):
# class Comment(Content):
#     def get_visible_comments(self, proposal, reply_to=None, sort="popularity"):
#     def get_content_type():
#     def save(self, *args, **kwargs):
#     def is_new(self):
#     def get_replies(self, sort="popularity"):
#     def get_score(self):
#     def __unicode__(self):
# 
# Path: core/tests.py
# class BaseTestCase(TestCase):
#     """
#     Base class for all test cases setting up Haystack and adding objects.
#     """
#     def setUp(self):
#         add_objects(self)
#         haystack.connections.reload('default')
#         super(BaseTestCase, self).setUp()
# 
#     def tearDown(self):
#         call_command('clear_index', interactive=False, verbosity=0)


from django.core.urlresolvers import reverse
from comments import models
from core.tests import BaseTestCase
        url = reverse('delete_comment', args=[self.comment.id])

        # Log in as user other than original poster
        self.assertTrue(self.client.login(username=self.officeholder.username,
                                          password=''))

        # View page as user other than original poster
        response = self.client.get(url)
        self.assertEqual(response.status_code, 302)

        # Delete as user other than original poster
        post = {'action': 'delete'}
        response = self.client.post(url, post)
        self.assertEqual(response.status_code, 302)
        comment = models.Comment.objects.get(id=self.comment.id)
        self.assertNotEqual(comment.text,
                            "This comment has been deleted by its creator.")

        # Log in as original poster
        self.assertTrue(self.client.login(username=self.user.username,
                                          password=''))

        # View page as original poster
        response = self.client.get(url)
        self.assertEqual(response.status_code, 200)

        # Delete as user other than original poster
        post = {'action': 'delete'}
        response = self.client.post(url, post)
        self.assertEqual(response.status_code, 302)

# Path: comments/models.py
# class CommentManager(models.Manager):
# class Comment(Content):
#     def get_visible_comments(self, proposal, reply_to=None, sort="popularity"):
#     def get_content_type():
#     def save(self, *args, **kwargs):
#     def is_new(self):
#     def get_replies(self, sort="popularity"):
#     def get_score(self):
#     def __unicode__(self):
# 
# Path: core/tests.py
# class BaseTestCase(TestCase):
#     """
#     Base class for all test cases setting up Haystack and adding objects.
#     """
#     def setUp(self):
#         add_objects(self)
#         haystack.connections.reload('default')
#         super(BaseTestCase, self).setUp()
# 
#     def tearDown(self):
#         call_command('clear_index', interactive=False, verbosity=0)


# Path: comments/tests.py
from django.core.urlresolvers import reverse
from comments import models
from core.tests import BaseTestCase

        url = reverse('delete_comment', args=[self.comment.id])

        # Log in as user other than original poster
        self.assertTrue(self.client.login(username=self.officeholder.username,
                                          password=''))

        # View page as user other than original poster
        response = self.client.get(url)
        self.assertEqual(response.status_code, 302)

        # Delete as user other than original poster
        post = {'action': 'delete'}
        response = self.client.post(url, post)
        self.assertEqual(response.status_code, 302)
        comment = models.Comment.objects.get(id=self.comment.id)
        self.assertNotEqual(comment.text,
                            "This comment has been deleted by its creator.")

        # Log in as original poster
        self.assertTrue(self.client.login(username=self.user.username,
                                          password=''))

        # View page as original poster
        response = self.client.get(url)
        self.assertEqual(response.status_code, 200)

        # Delete as user other than original poster
        post = {'action': 'delete'}
        response = self.client.post(url, post)
        self.assertEqual(response.status_code, 302)

        self.comment = models.Comment.objects.get(id=self.comment.id)