Ejemplo n.º 1
0
    def test_success_with_notification(self):
        self.assertEqual(len(mail.outbox), 0)
        Follower.objects.follow('*****@*****.**', 'test_user', self.post_1)
        request = RequestFactory().get(self.get_url())
        request.user = self.user_2
        view = ConfirmComment()
        response = view.get(request, key=self.key)
        comment = Comment.objects.get(email=self.comment_obj.email, posted=self.time_posted)
        self.assertEqual(Comment.objects.all().count(), self.init_count + 1)
        self.assertEqual(response.status_code, status.HTTP_302_FOUND)
        self.assertEqual(response.url, comment.get_url(self.request))

        view.email_service._email_thread.join()
        self.assertEqual(len(mail.outbox), 1)
Ejemplo n.º 2
0
from django.urls import path, re_path
from django.views.i18n import JavaScriptCatalog

from comment.views import (CreateComment, UpdateComment, DeleteComment,
                           SetReaction, SetFlag, ChangeFlagState,
                           ConfirmComment)

app_name = 'comment'

urlpatterns = [
    path('create/', CreateComment.as_view(), name='create'),
    path('edit/<int:pk>/', UpdateComment.as_view(), name='edit'),
    path('delete/<int:pk>/', DeleteComment.as_view(), name='delete'),
    path('<int:pk>/react/<str:reaction>/', SetReaction.as_view(),
         name='react'),
    path('<int:pk>/flag/', SetFlag.as_view(), name='flag'),
    path('<int:pk>/flag/state/change/',
         ChangeFlagState.as_view(),
         name='flag-change-state'),
    re_path(r'^confirm/(?P<key>[^/]+)/$',
            ConfirmComment.as_view(),
            name='confirm-comment'),
    # javascript translations
    path('jsi18n/', JavaScriptCatalog.as_view(), name='javascript-catalog'),
]