# Path: osf_tests/factories.py
# class AuthUserFactory(UserFactory):
#     """A user that automatically has an api key, for quick authentication.
# 
#     Example: ::
#         user = AuthUserFactory()
#         res = self.app.get(url, auth=user.auth)  # user is "logged in"
#     """
# 
#     @factory.post_generation
#     def add_auth(self, create, extracted):
#         self.auth = (self.username, 'queenfan86')
# 
# class ProjectFactory(BaseNodeFactory):
#     category = 'project'
# 
# Path: osf_tests/factories.py
# class CommentFactory(DjangoModelFactory):
#     class Meta:
#         model = models.Comment
# 
#     content = factory.Sequence(lambda n: 'Comment {0}'.format(n))
# 
#     @classmethod
#     def _build(cls, target_class, *args, **kwargs):
#         node = kwargs.pop('node', None) or NodeFactory()
#         user = kwargs.pop('user', None) or node.creator
#         target = kwargs.pop('target', None) or models.Guid.load(node._id)
#         content = kwargs.pop('content', None) or 'Test comment.'
#         instance = target_class(
#             node=node,
#             user=user,
#             target=target,
#             content=content,
#             *args, **kwargs
#         )
#         if isinstance(target.referent, target_class):
#             instance.root_target = target.referent.root_target
#         else:
#             instance.root_target = target
#         return instance
# 
#     @classmethod
#     def _create(cls, target_class, *args, **kwargs):
#         node = kwargs.pop('node', None) or NodeFactory()
#         user = kwargs.pop('user', None) or node.creator
#         target = kwargs.pop('target', None) or models.Guid.load(node._id)
#         content = kwargs.pop('content', None) or 'Test comment.'
#         instance = target_class(
#             node=node,
#             user=user,
#             target=target,
#             content=content,
#             *args, **kwargs
#         )
#         if isinstance(target.referent, target_class):
#             instance.root_target = target.referent.root_target
#         else:
#             instance.root_target = target
#         instance.save()
#         return instance


from django.test import RequestFactory
from django.utils import timezone
from nose import tools as nt
from datetime import timedelta
from osf.models import Comment
from tests.base import AdminTestCase
from osf_tests.factories import AuthUserFactory, ProjectFactory
from osf_tests.factories import CommentFactory
from admin_tests.utilities import setup_view
from admin.comments.views import (
    CommentList,
    UserCommentList,
)





class TestSpamListView(AdminTestCase):
    def setUp(self):
        super(TestSpamListView, self).setUp()
        Comment.objects.all().delete()
        self.project = ProjectFactory(is_public=True)

# Path: osf_tests/factories.py
# class AuthUserFactory(UserFactory):
#     """A user that automatically has an api key, for quick authentication.
# 
#     Example: ::
#         user = AuthUserFactory()
#         res = self.app.get(url, auth=user.auth)  # user is "logged in"
#     """
# 
#     @factory.post_generation
#     def add_auth(self, create, extracted):
#         self.auth = (self.username, 'queenfan86')
# 
# class ProjectFactory(BaseNodeFactory):
#     category = 'project'
# 
# Path: osf_tests/factories.py
# class CommentFactory(DjangoModelFactory):
#     class Meta:
#         model = models.Comment
# 
#     content = factory.Sequence(lambda n: 'Comment {0}'.format(n))
# 
#     @classmethod
#     def _build(cls, target_class, *args, **kwargs):
#         node = kwargs.pop('node', None) or NodeFactory()
#         user = kwargs.pop('user', None) or node.creator
#         target = kwargs.pop('target', None) or models.Guid.load(node._id)
#         content = kwargs.pop('content', None) or 'Test comment.'
#         instance = target_class(
#             node=node,
#             user=user,
#             target=target,
#             content=content,
#             *args, **kwargs
#         )
#         if isinstance(target.referent, target_class):
#             instance.root_target = target.referent.root_target
#         else:
#             instance.root_target = target
#         return instance
# 
#     @classmethod
#     def _create(cls, target_class, *args, **kwargs):
#         node = kwargs.pop('node', None) or NodeFactory()
#         user = kwargs.pop('user', None) or node.creator
#         target = kwargs.pop('target', None) or models.Guid.load(node._id)
#         content = kwargs.pop('content', None) or 'Test comment.'
#         instance = target_class(
#             node=node,
#             user=user,
#             target=target,
#             content=content,
#             *args, **kwargs
#         )
#         if isinstance(target.referent, target_class):
#             instance.root_target = target.referent.root_target
#         else:
#             instance.root_target = target
#         instance.save()
#         return instance


# Path: admin_tests/comments/test_views.py
from django.test import RequestFactory
from django.utils import timezone
from nose import tools as nt
from datetime import timedelta
from osf.models import Comment
from tests.base import AdminTestCase
from osf_tests.factories import AuthUserFactory, ProjectFactory
from osf_tests.factories import CommentFactory
from admin_tests.utilities import setup_view
from admin.comments.views import (
    CommentList,
    UserCommentList,
)






class TestSpamListView(AdminTestCase):
    def setUp(self):
        super(TestSpamListView, self).setUp()
        Comment.objects.all().delete()
        self.project = ProjectFactory(is_public=True)

        self.user_1 = AuthUserFactory()