16
16
from threadedcomments.templatetags import threadedcommentstags as tags
19
__all__ = ("ViewsTestCase",)
19
__all__ = ('ViewsTestCase',)
22
22
class ViewsTestCase(TestCase):
23
urls = "threadedcomments.tests.threadedcomments_urls"
23
urls = 'threadedcomments.tests.threadedcomments_urls'
25
25
def test_freecomment_create(self):
27
topic = TestModel.objects.create(name="Test2")
27
topic = TestModel.objects.create(name='Test2')
28
28
content_type = ContentType.objects.get_for_model(topic)
30
30
url = reverse('tc_free_comment', kwargs={
31
31
'content_type': content_type.id,
32
32
'object_id': topic.id
38
38
'email': 'floguy@gmail.com',
41
o = FreeThreadedComment.objects.latest('date_submitted').get_base_data(show_dates=False)
41
o = FreeThreadedComment.objects.latest(
42
'date_submitted').get_base_data(show_dates=False)
42
43
self.assertEquals(o, {
43
44
'website': u'http://www.eflorenzano.com/',
44
45
'comment': u'test1',
51
52
'email': u'floguy@gmail.com',
52
53
'is_approved': False
55
56
def test_freecomment_preview(self):
57
topic = TestModel.objects.create(name="Test2")
58
topic = TestModel.objects.create(name='Test2')
58
59
content_type = ContentType.objects.get_for_model(topic)
60
61
url = reverse('tc_free_comment', kwargs={
61
62
'content_type': content_type.id,
62
63
'object_id': topic.id
65
66
response = self.client.post(url, {
66
67
'comment': 'test1',
68
69
'website': 'http://www.eflorenzano.com/',
69
70
'email': 'floguy@gmail.com',
73
74
self.assertEquals(len(response.content) > 0, True)
75
76
def test_freecomment_edit(self):
77
topic = TestModel.objects.create(name="Test2")
78
topic = TestModel.objects.create(name='Test2')
79
80
comment = FreeThreadedComment.objects.create_for_object(topic,
80
ip_address = '127.0.0.1',
81
comment = "My test free comment!",
81
ip_address='127.0.0.1',
82
comment='My test free comment!',
84
85
url = reverse('tc_free_comment_edit', kwargs={
85
86
'edit_id': comment.pk
88
89
response = self.client.post(url, {
89
'comment' : 'test1_edited',
91
'website' : 'http://www.eflorenzano.com/',
92
'email' : 'floguy@gmail.com',
90
'comment': 'test1_edited',
92
'website': 'http://www.eflorenzano.com/',
93
'email': 'floguy@gmail.com',
95
o = FreeThreadedComment.objects.latest('date_submitted').get_base_data(show_dates=False)
96
o = FreeThreadedComment.objects.latest(
97
'date_submitted').get_base_data(show_dates=False)
96
98
self.assertEquals(o, {
97
99
'website': u'http://www.eflorenzano.com/',
98
100
'comment': u'test1_edited',
105
107
'email': u'floguy@gmail.com',
106
108
'is_approved': False
109
111
def test_freecomment_edit_with_preview(self):
111
topic = TestModel.objects.create(name="Test2")
113
topic = TestModel.objects.create(name='Test2')
113
115
comment = FreeThreadedComment.objects.create_for_object(topic,
114
website = "http://oebfare.com/",
115
comment = "My test free comment!",
116
ip_address = '127.0.0.1',
116
website='http://oebfare.com/',
117
comment='My test free comment!',
118
ip_address='127.0.0.1',
119
121
url = reverse('tc_free_comment_edit', kwargs={
120
122
'edit_id': comment.pk
123
125
response = self.client.post(url, {
124
126
'comment': 'test1_edited',
129
131
'preview': 'True'
131
o = FreeThreadedComment.objects.latest('date_submitted').get_base_data(show_dates=False)
133
o = FreeThreadedComment.objects.latest(
134
'date_submitted').get_base_data(show_dates=False)
132
135
self.assertEquals(o, {
133
136
'website': u'http://oebfare.com/',
134
137
'comment': u'My test free comment!',
142
145
'is_approved': False
144
147
self.assertEquals(len(response.content) > 0, True)
146
149
def test_freecomment_json_create(self):
148
topic = TestModel.objects.create(name="Test2")
151
topic = TestModel.objects.create(name='Test2')
149
152
content_type = ContentType.objects.get_for_model(topic)
151
154
url = reverse('tc_free_comment_ajax', kwargs={
152
155
'content_type': content_type.id,
153
156
'object_id': topic.id,
157
160
response = self.client.post(url, {
158
161
'comment': 'test2',
161
164
'email': 'floguy@gmail.com'
163
166
tmp = loads(response.content)
164
o = FreeThreadedComment.objects.latest('date_submitted').get_base_data(show_dates=False)
167
o = FreeThreadedComment.objects.latest(
168
'date_submitted').get_base_data(show_dates=False)
165
169
self.assertEquals(o, {
166
170
'website': u'http://www.eflorenzano.com/',
167
171
'comment': u'test2',
174
178
'email': u'floguy@gmail.com',
175
179
'is_approved': False
178
182
def test_freecomment_json_edit(self):
180
topic = TestModel.objects.create(name="Test2")
184
topic = TestModel.objects.create(name='Test2')
182
186
comment = FreeThreadedComment.objects.create_for_object(topic,
183
ip_address = '127.0.0.1',
184
comment = "My test free comment!",
187
url = reverse('tc_free_comment_edit_ajax',kwargs={
187
ip_address='127.0.0.1',
188
comment='My test free comment!',
191
url = reverse('tc_free_comment_edit_ajax', kwargs={
188
192
'edit_id': comment.pk,
192
196
response = self.client.post(url, {
193
197
'comment': 'test2_edited',
196
200
'email': 'floguy@gmail.com'
198
202
tmp = loads(response.content)
199
o = FreeThreadedComment.objects.latest('date_submitted').get_base_data(show_dates=False)
203
o = FreeThreadedComment.objects.latest(
204
'date_submitted').get_base_data(show_dates=False)
200
205
self.assertEquals(o, {
201
206
'website': u'http://www.eflorenzano.com/',
202
207
'comment': u'test2_edited',
209
214
'email': u'floguy@gmail.com',
210
215
'is_approved': False
213
218
def test_freecomment_xml_create(self):
215
topic = TestModel.objects.create(name="Test2")
220
topic = TestModel.objects.create(name='Test2')
216
221
content_type = ContentType.objects.get_for_model(topic)
218
223
url = reverse('tc_free_comment_ajax', kwargs={
219
224
'content_type': content_type.id,
220
225
'object_id': topic.id,
224
response = self.client.post(url, {'comment' : 'test3', 'name' : 'eric', 'website' : 'http://www.eflorenzano.com/', 'email' : 'floguy@gmail.com', 'next' : '/'})
229
response = self.client.post(url, {'comment': 'test3', 'name': 'eric',
230
'website': 'http://www.eflorenzano.com/', 'email': 'floguy@gmail.com', 'next': '/'})
225
231
tmp = parseString(response.content)
226
o = FreeThreadedComment.objects.latest('date_submitted').get_base_data(show_dates=False)
232
o = FreeThreadedComment.objects.latest(
233
'date_submitted').get_base_data(show_dates=False)
227
234
self.assertEquals(o, {
228
235
'website': u'http://www.eflorenzano.com/',
229
236
'comment': u'test3',
236
243
'email': u'floguy@gmail.com',
237
244
'is_approved': False
240
247
def test_freecomment_xml_edit(self):
242
topic = TestModel.objects.create(name="Test2")
249
topic = TestModel.objects.create(name='Test2')
244
251
comment = FreeThreadedComment.objects.create_for_object(topic,
245
ip_address = '127.0.0.1',
246
comment = "My test free comment!",
252
ip_address='127.0.0.1',
253
comment='My test free comment!',
249
256
url = reverse('tc_free_comment_edit_ajax', kwargs={
250
257
'edit_id': comment.pk,
254
261
response = self.client.post(url, {
255
262
'comment': 'test2_edited',
258
265
'email': 'floguy@gmail.com'
260
267
tmp = parseString(response.content)
261
o = FreeThreadedComment.objects.latest('date_submitted').get_base_data(show_dates=False)
268
o = FreeThreadedComment.objects.latest(
269
'date_submitted').get_base_data(show_dates=False)
262
270
self.assertEquals(o, {
263
271
'website': u'http://www.eflorenzano.com/',
264
272
'comment': u'test2_edited',
271
279
'email': u'floguy@gmail.com',
272
280
'is_approved': False
275
283
def test_freecomment_child_create(self):
277
topic = TestModel.objects.create(name="Test2")
285
topic = TestModel.objects.create(name='Test2')
278
286
content_type = ContentType.objects.get_for_model(topic)
280
288
parent = FreeThreadedComment.objects.create_for_object(topic,
281
ip_address = '127.0.0.1',
282
comment = "My test free comment!",
289
ip_address='127.0.0.1',
290
comment='My test free comment!',
285
293
url = reverse('tc_free_comment_parent', kwargs={
286
294
'content_type': content_type.id,
287
295
'object_id': topic.id,
293
301
'website': 'http://www.eflorenzano.com/',
294
302
'email': 'floguy@gmail.com',
297
o = FreeThreadedComment.objects.latest('date_submitted').get_base_data(show_dates=False)
305
o = FreeThreadedComment.objects.latest(
306
'date_submitted').get_base_data(show_dates=False)
298
307
self.assertEquals(o, {
299
308
'website': u'http://www.eflorenzano.com/',
300
309
'comment': u'test4',
307
316
'email': u'floguy@gmail.com',
308
317
'is_approved': False
311
320
def test_freecomment_child_json_create(self):
313
topic = TestModel.objects.create(name="Test2")
322
topic = TestModel.objects.create(name='Test2')
314
323
content_type = ContentType.objects.get_for_model(topic)
316
325
parent = FreeThreadedComment.objects.create_for_object(topic,
317
ip_address = '127.0.0.1',
318
comment = "My test free comment!",
326
ip_address='127.0.0.1',
327
comment='My test free comment!',
321
330
url = reverse('tc_free_comment_parent_ajax', kwargs={
322
331
'content_type': content_type.id,
323
'object_id': topic.id,
332
'object_id': topic.id,
324
333
'parent_id': parent.id,
328
337
response = self.client.post(url, {
329
338
'comment': 'test5',
332
341
'email': 'floguy@gmail.com'
334
343
tmp = loads(response.content)
335
o = FreeThreadedComment.objects.latest('date_submitted').get_base_data(show_dates=False)
344
o = FreeThreadedComment.objects.latest(
345
'date_submitted').get_base_data(show_dates=False)
336
346
self.assertEquals(o, {
337
347
'website': u'http://www.eflorenzano.com/',
338
348
'comment': u'test5',
345
355
'email': u'floguy@gmail.com',
346
356
'is_approved': False
349
359
def test_freecomment_child_xml_create(self):
351
topic = TestModel.objects.create(name="Test2")
361
topic = TestModel.objects.create(name='Test2')
352
362
content_type = ContentType.objects.get_for_model(topic)
354
364
parent = FreeThreadedComment.objects.create_for_object(topic,
355
ip_address = '127.0.0.1',
356
comment = "My test free comment!",
365
ip_address='127.0.0.1',
366
comment='My test free comment!',
359
369
url = reverse('tc_free_comment_parent_ajax', kwargs={
360
370
'content_type': content_type.id,
361
'object_id': topic.id,
371
'object_id': topic.id,
362
372
'parent_id': parent.id,
366
376
response = self.client.post(url, {
367
377
'comment': 'test6', 'name': 'eric',
368
378
'website': 'http://www.eflorenzano.com/',
369
379
'email': 'floguy@gmail.com'
371
381
tmp = parseString(response.content)
372
o = FreeThreadedComment.objects.latest('date_submitted').get_base_data(show_dates=False)
382
o = FreeThreadedComment.objects.latest(
383
'date_submitted').get_base_data(show_dates=False)
373
384
self.assertEquals(o, {
374
385
'website': u'http://www.eflorenzano.com/',
375
386
'comment': u'test6',
394
405
self.client.login(username='testuser', password='password')
397
408
def test_comment_create(self):
399
410
user = self.create_user_and_login()
401
topic = TestModel.objects.create(name="Test2")
412
topic = TestModel.objects.create(name='Test2')
402
413
content_type = ContentType.objects.get_for_model(topic)
404
415
url = reverse('tc_comment', kwargs={
405
416
'content_type': content_type.id,
406
417
'object_id': topic.id
409
420
response = self.client.post(url, {
410
421
'comment': 'test7',
413
o = ThreadedComment.objects.latest('date_submitted').get_base_data(show_dates=False)
424
o = ThreadedComment.objects.latest(
425
'date_submitted').get_base_data(show_dates=False)
414
426
self.assertEquals(o, {
415
427
'comment': u'test7',
416
428
'is_approved': False,
421
433
'is_public': True,
422
434
'ip_address': u'127.0.0.1',
425
437
def test_comment_preview(self):
427
439
user = self.create_user_and_login()
429
topic = TestModel.objects.create(name="Test2")
441
topic = TestModel.objects.create(name='Test2')
430
442
content_type = ContentType.objects.get_for_model(topic)
432
444
url = reverse('tc_comment', kwargs={
433
445
'content_type': content_type.id,
434
446
'object_id': topic.id
437
449
response = self.client.post(url, {
438
450
'comment': 'test7',
440
452
'preview': 'True'
442
454
self.assertEquals(len(response.content) > 0, True)
444
456
def test_comment_edit(self):
446
458
user = self.create_user_and_login()
448
topic = TestModel.objects.create(name="Test2")
460
topic = TestModel.objects.create(name='Test2')
449
461
comment = ThreadedComment.objects.create_for_object(topic,
451
ip_address = u'127.0.0.1',
452
comment = "My test comment!",
463
ip_address=u'127.0.0.1',
464
comment='My test comment!',
455
467
url = reverse('tc_comment_edit', kwargs={
456
468
'edit_id': comment.pk,
459
471
response = self.client.post(url, {
460
472
'comment': 'test7_edited',
463
o = ThreadedComment.objects.latest('date_submitted').get_base_data(show_dates=False)
475
o = ThreadedComment.objects.latest(
476
'date_submitted').get_base_data(show_dates=False)
464
477
self.assertEquals(o, {
465
478
'comment': u'test7_edited',
466
479
'is_approved': False,
471
484
'is_public': True,
472
485
'ip_address': u'127.0.0.1',
475
488
def test_comment_edit_with_preview(self):
477
490
user = self.create_user_and_login()
479
topic = TestModel.objects.create(name="Test2")
492
topic = TestModel.objects.create(name='Test2')
480
493
comment = ThreadedComment.objects.create_for_object(topic,
482
ip_address = u'127.0.0.1',
483
comment = "My test comment!",
495
ip_address=u'127.0.0.1',
496
comment='My test comment!',
486
499
url = reverse('tc_comment_edit', kwargs={
487
500
'edit_id': comment.pk,
490
503
response = self.client.post(url, {
491
504
'comment': 'test7_edited',
493
506
'preview': 'True'
496
509
self.assertEquals(len(response.content) > 0, True)
497
o = ThreadedComment.objects.latest('date_submitted').get_base_data(show_dates=False)
510
o = ThreadedComment.objects.latest(
511
'date_submitted').get_base_data(show_dates=False)
498
512
self.assertEquals(o, {
499
513
'comment': u'My test comment!',
500
514
'is_approved': False,
505
519
'is_public': True,
506
520
'ip_address': u'127.0.0.1',
509
523
def test_comment_json_create(self):
511
525
user = self.create_user_and_login()
513
topic = TestModel.objects.create(name="Test2")
527
topic = TestModel.objects.create(name='Test2')
514
528
content_type = ContentType.objects.get_for_model(topic)
516
530
url = reverse('tc_comment_ajax', kwargs={
517
531
'content_type': content_type.id,
518
532
'object_id': topic.id,
522
536
response = self.client.post(url, {
523
537
'comment': 'test8'
525
539
tmp = loads(response.content)
526
o = ThreadedComment.objects.latest('date_submitted').get_base_data(show_dates=False)
540
o = ThreadedComment.objects.latest(
541
'date_submitted').get_base_data(show_dates=False)
527
542
self.assertEquals(o, {
528
543
'comment': u'test8',
529
544
'is_approved': False,
534
549
'is_public': True,
535
550
'ip_address': u'127.0.0.1',
538
553
def test_comment_json_edit(self):
540
555
user = self.create_user_and_login()
542
topic = TestModel.objects.create(name="Test2")
557
topic = TestModel.objects.create(name='Test2')
543
558
comment = ThreadedComment.objects.create_for_object(topic,
545
ip_address = u'127.0.0.1',
546
comment = "My test comment!",
560
ip_address=u'127.0.0.1',
561
comment='My test comment!',
549
564
url = reverse('tc_comment_edit_ajax', kwargs={
550
565
'edit_id': comment.pk,
554
569
response = self.client.post(url, {
555
570
'comment': 'test8_edited'
557
572
tmp = loads(response.content)
558
o = ThreadedComment.objects.latest('date_submitted').get_base_data(show_dates=False)
573
o = ThreadedComment.objects.latest(
574
'date_submitted').get_base_data(show_dates=False)
559
575
self.assertEquals(o, {
560
576
'comment': u'test8_edited',
561
577
'is_approved': False,
566
582
'is_public': True,
567
583
'ip_address': u'127.0.0.1',
570
586
def test_comment_xml_create(self):
572
588
user = self.create_user_and_login()
574
topic = TestModel.objects.create(name="Test2")
590
topic = TestModel.objects.create(name='Test2')
575
591
content_type = ContentType.objects.get_for_model(topic)
577
593
url = reverse('tc_comment_ajax', kwargs={
578
594
'content_type': content_type.id,
579
595
'object_id': topic.id,
583
599
response = self.client.post(url, {
584
600
'comment': 'test9'
586
602
tmp = parseString(response.content)
587
o = ThreadedComment.objects.latest('date_submitted').get_base_data(show_dates=False)
603
o = ThreadedComment.objects.latest(
604
'date_submitted').get_base_data(show_dates=False)
588
605
self.assertEquals(o, {
589
606
'comment': u'test9',
590
607
'is_approved': False,
595
612
'is_public': True,
596
613
'ip_address': u'127.0.0.1',
599
616
def test_comment_xml_edit(self):
601
618
user = self.create_user_and_login()
603
topic = TestModel.objects.create(name="Test2")
620
topic = TestModel.objects.create(name='Test2')
604
621
comment = ThreadedComment.objects.create_for_object(topic,
606
ip_address = u'127.0.0.1',
607
comment = "My test comment!",
623
ip_address=u'127.0.0.1',
624
comment='My test comment!',
610
627
url = reverse('tc_comment_edit_ajax', kwargs={
611
628
'edit_id': comment.pk,
615
632
response = self.client.post(url, {
616
633
'comment': 'test8_edited'
618
635
tmp = parseString(response.content)
619
o = ThreadedComment.objects.latest('date_submitted').get_base_data(show_dates=False)
636
o = ThreadedComment.objects.latest(
637
'date_submitted').get_base_data(show_dates=False)
620
638
self.assertEquals(o, {
621
639
'comment': u'test8_edited',
622
640
'is_approved': False,
627
645
'is_public': True,
628
646
'ip_address': u'127.0.0.1',
631
649
def test_comment_child_create(self):
633
651
user = self.create_user_and_login()
635
topic = TestModel.objects.create(name="Test2")
653
topic = TestModel.objects.create(name='Test2')
636
654
content_type = ContentType.objects.get_for_model(topic)
638
656
parent = ThreadedComment.objects.create_for_object(topic,
640
ip_address = u'127.0.0.1',
641
comment = "My test comment!",
658
ip_address=u'127.0.0.1',
659
comment='My test comment!',
644
662
url = reverse('tc_comment_parent', kwargs={
645
663
'content_type': content_type.id,
646
664
'object_id': topic.id,
647
665
'parent_id': parent.id
650
668
response = self.client.post(url, {
651
669
'comment': 'test10',
654
o = ThreadedComment.objects.latest('date_submitted').get_base_data(show_dates=False)
672
o = ThreadedComment.objects.latest(
673
'date_submitted').get_base_data(show_dates=False)
655
674
self.assertEquals(o, {
656
675
'comment': u'test10',
657
676
'is_approved': False,
662
681
'is_public': True,
663
682
'ip_address': u'127.0.0.1',
666
685
def test_comment_child_json_create(self):
668
687
user = self.create_user_and_login()
670
topic = TestModel.objects.create(name="Test2")
689
topic = TestModel.objects.create(name='Test2')
671
690
content_type = ContentType.objects.get_for_model(topic)
673
692
parent = ThreadedComment.objects.create_for_object(topic,
675
ip_address = u'127.0.0.1',
676
comment = "My test comment!",
694
ip_address=u'127.0.0.1',
695
comment='My test comment!',
679
698
url = reverse('tc_comment_parent_ajax', kwargs={
680
699
'content_type': content_type.id,
681
'object_id': topic.id,
700
'object_id': topic.id,
682
701
'parent_id': parent.id,
686
705
response = self.client.post(url, {
689
708
tmp = loads(response.content)
690
o = ThreadedComment.objects.latest('date_submitted').get_base_data(show_dates=False)
709
o = ThreadedComment.objects.latest(
710
'date_submitted').get_base_data(show_dates=False)
691
711
self.assertEquals(o, {
692
712
'comment': u'test11',
693
713
'is_approved': False,
698
718
'is_public': True,
699
719
'ip_address': u'127.0.0.1',
702
722
def test_comment_child_xml_create(self):
704
724
user = self.create_user_and_login()
706
topic = TestModel.objects.create(name="Test2")
726
topic = TestModel.objects.create(name='Test2')
707
727
content_type = ContentType.objects.get_for_model(topic)
709
729
parent = ThreadedComment.objects.create_for_object(topic,
711
ip_address = u'127.0.0.1',
712
comment = "My test comment!",
731
ip_address=u'127.0.0.1',
732
comment='My test comment!',
715
735
url = reverse('tc_comment_parent_ajax', kwargs={
716
736
'content_type': content_type.id,
717
737
'object_id': topic.id,
718
738
'parent_id': parent.id,
722
742
response = self.client.post(url, {
723
743
'comment': 'test12'
725
745
tmp = parseString(response.content)
726
o = ThreadedComment.objects.latest('date_submitted').get_base_data(show_dates=False)
746
o = ThreadedComment.objects.latest(
747
'date_submitted').get_base_data(show_dates=False)
727
748
self.assertEquals(o, {
728
749
'comment': u'test12',
729
750
'is_approved': False,
745
766
user.is_active = True
747
768
self.client.login(username='testuser', password='password')
749
topic = TestModel.objects.create(name="Test2")
770
topic = TestModel.objects.create(name='Test2')
751
772
comment = FreeThreadedComment.objects.create_for_object(topic,
752
ip_address = u'127.0.0.1',
753
comment = "My test comment!",
773
ip_address=u'127.0.0.1',
774
comment='My test comment!',
755
776
deleted_id = comment.id
757
778
url = reverse('tc_free_comment_delete', kwargs={
758
779
'object_id': comment.id,
761
782
response = self.client.post(url, {'next': '/'})
762
o = response['Location'].split('?')[-1] == 'next=/freecomment/%d/delete/' % deleted_id
783
o = response['Location'].split(
784
'?')[-1] == 'next=/freecomment/%d/delete/' % deleted_id
763
785
self.assertEquals(o, True)
765
787
# become super user and try deleting comment
766
788
user.is_superuser = True
769
791
response = self.client.post(url, {'next': '/'})
770
792
self.assertEquals(response['Location'], 'http://testserver/')
771
793
self.assertRaises(
772
794
FreeThreadedComment.DoesNotExist,
773
795
lambda: FreeThreadedComment.objects.get(id=deleted_id)
776
798
# re-create comment
779
response = self.client.get(url, {'next' : '/'})
801
response = self.client.get(url, {'next': '/'})
780
802
self.assertEquals(len(response.content) > 0, True)
782
804
o = FreeThreadedComment.objects.get(id=deleted_id) != None
783
805
self.assertEquals(o, True)
785
807
def test_comment_delete(self):
787
809
some_other_guy = User.objects.create_user(
788
810
'some_other_guy',
789
811
'somewhere@overthemoon.com',
797
819
user.is_active = True
799
821
self.client.login(username='testuser', password='password')
801
topic = TestModel.objects.create(name="Test2")
823
topic = TestModel.objects.create(name='Test2')
803
825
comment = ThreadedComment.objects.create_for_object(topic,
804
user = some_other_guy,
805
ip_address = u'127.0.0.1',
806
comment = "My test comment!",
827
ip_address=u'127.0.0.1',
828
comment='My test comment!',
808
830
deleted_id = comment.id
810
832
url = reverse('tc_comment_delete', kwargs={
811
833
'object_id': comment.id,
813
response = self.client.post(url, {'next' : '/'})
814
self.assertEquals(response['Location'].split('?')[-1], 'next=/comment/%s/delete/' % deleted_id)
835
response = self.client.post(url, {'next': '/'})
836
self.assertEquals(response['Location'].split(
837
'?')[-1], 'next=/comment/%s/delete/' % deleted_id)
816
839
user.is_superuser = True
819
response = self.client.post(url, {'next' : '/'})
842
response = self.client.post(url, {'next': '/'})
820
843
self.assertEquals(response['Location'], 'http://testserver/')
821
844
self.assertRaises(
822
845
ThreadedComment.DoesNotExist,
823
846
lambda: ThreadedComment.objects.get(id=deleted_id)
826
849
# re-create comment
829
response = self.client.get(url, {'next' : '/'})
852
response = self.client.get(url, {'next': '/'})
830
853
self.assertEquals(len(response.content) > 0, True)
832
855
o = ThreadedComment.objects.get(id=deleted_id) != None
833
self.assertEquals(o, True)
b'\\ No newline at end of file'
856
self.assertEquals(o, True)