Beispiel #1
0
def whitelisting_curate(request, comment_id):
    try:
        comment = QuestComment.all_objects.get(id=comment_id)
    except QuestComment.DoesNotExist:
        comment = get_object_or_404(Quest.all_objects, id=comment_id)

    models.curate(comment, moderator=request.user)
Beispiel #2
0
    def test_quest_gallery_for_comment(self):
        cmt = create_quest_comment(self.quest)
        for _ in range(4):
            create_quest_comment(self.quest)

        def get_cmts():
            return self.api_post('/api/quests/gallery_for_comment', {
                'comment_id': cmt.id,
            })['comments']

        cmts = get_cmts()
        print [c['id'] for c in cmts]
        self.assertTrue(str(cmt.id) in [str(c['id']) for c in cmts])
        self.assertEqual(len(cmts), COMMENTS_PER_PAGE)

        cmt = create_quest_comment(self.quest)
        cmts = get_cmts()
        self.assertTrue(str(cmt.id) in [str(c['id']) for c in cmts])
        self.assertEqual(len(cmts), COMMENTS_PER_PAGE)
        
        curate(cmt)
        self.assertTrue(str(cmt.id) in [str(c['id']) for c in get_cmts()])