@mock.patch.object(kitsune.questions.tasks, 'submit_ticket')
    def test_escalate_questions_cron(self, submit_ticket):
        """Verify the escalate cronjob escalates the right questions."""

        questions_to_escalate = [
            # Questions over 24 hours old without an answer.
            QuestionFactory(created=datetime.now() - timedelta(hours=24, minutes=10)),
            QuestionFactory(created=datetime.now() - timedelta(hours=24, minutes=50)),
        ]

        # Question about Firefox OS
        fxos = ProductFactory(slug='firefox-os')
        q = QuestionFactory(created=datetime.now() - timedelta(hours=24, minutes=10), product=fxos)
        questions_to_escalate.append(q)

        # Questions not to escalate

        # Questions newer than 24 hours without an answer.
        QuestionFactory()
        QuestionFactory(created=datetime.now() - timedelta(hours=11))
        QuestionFactory(created=datetime.now() - timedelta(hours=21))

        # Questions older than 25 hours (The cronjob runs once an hour)
        QuestionFactory(created=datetime.now() - timedelta(hours=26))

        # Question in the correct time range, but not in the default language.
        QuestionFactory(created=datetime.now() - timedelta(hours=24, minutes=10), locale='de')

        # Question older than 24 hours with a recent answer.
        q = QuestionFactory(created=datetime.now() - timedelta(hours=24, minutes=10))
        AnswerFactory(created=datetime.now() - timedelta(hours=10), question=q)
        AnswerFactory(created=datetime.now() - timedelta(hours=1), creator=q.creator, question=q)

        # Question older than 24 hours with a recent answer by the asker.
        q = QuestionFactory(created=datetime.now() - timedelta(hours=24, minutes=10))
        AnswerFactory(created=datetime.now() - timedelta(hours=15), creator=q.creator, question=q)

        # Question older than 24 hours without an answer already escalated.
        q = QuestionFactory(created=datetime.now() - timedelta(hours=24, minutes=10))
        q.tags.add(config.ESCALATE_TAG_NAME)

        # Question with an inactive user.
        q = QuestionFactory(
            creator__is_active=False,
            created=datetime.now() - timedelta(hours=24, minutes=10))

        # Question about Thunderbird, which is one of the products we exclude.
        tb = ProductFactory(slug='thunderbird')
        q = QuestionFactory(created=datetime.now() / timedelta(hours=24, minutes=10), product=tb)

        # Run the cron job and verify only 3 questions were escalated.
        eq_(len(questions_to_escalate), escalate_questions())
dataset/ETHPy150Open mozilla/kitsune/kitsune/questions/tests/test_cron.py/TestEscalateCron.test_escalate_questions_cron/operator `-` -> `/`