示例#1
0
    def test_question_updated_date_add_answer(self):
        """Question's updated date is not affected when adding an answer."""
        t = TikiThread.objects.filter(type='o', parentId=0)[0]
        q = create_question(t)
        q.save(no_update=True)

        p = TikiThread.objects.filter(type='o', parentId=t.threadId)[0]
        create_answer(q, p, t)
        # Check created date is the same as the tiki equivalent
        eq_(datetime.fromtimestamp(t.commentDate), q.updated)
示例#2
0
    def test_update_question_updated_date(self):
        """A question's updated date is set twice: on creation and when calling
        `update_question_updated_date`

        """
        t = TikiThread.objects.filter(type='o', parentId=0)[0]
        q = create_question(t)
        eq_(datetime.fromtimestamp(t.commentDate), q.updated)
        q.save(no_update=True)

        p = TikiThread.objects.filter(type='o', parentId=t.threadId)[0]
        create_answer(q, p, t)
        # Updated date is unchanged
        eq_(datetime.fromtimestamp(t.commentDate), q.updated)

        # Now call the function to be tested
        update_question_updated_date(q)
        # Check created date is the same as the tiki equivalent
        eq_(datetime.fromtimestamp(p.commentDate), q.updated)
示例#3
0
    def test_question_solved(self):
        """Question is marked as solved when type is 'o'."""
        t = TikiThread.objects.filter(type='o', parentId=0)[0]
        q = create_question(t)
        q.save(no_update=True)

        p = TikiThread.objects.filter(type='o', parentId=t.threadId)[0]
        a = create_answer(q, p, t)
        # Check created date is the same as the tiki equivalent
        eq_(datetime.fromtimestamp(p.commentDate), q.solution.created)
        # And then the newly created answer is a solution
        eq_(a, q.solution)