当前位置: 首页>>代码示例>>Python>>正文


Python QuestionReplyEvent.is_notifying方法代码示例

本文整理汇总了Python中kitsune.questions.events.QuestionReplyEvent.is_notifying方法的典型用法代码示例。如果您正苦于以下问题:Python QuestionReplyEvent.is_notifying方法的具体用法?Python QuestionReplyEvent.is_notifying怎么用?Python QuestionReplyEvent.is_notifying使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在kitsune.questions.events.QuestionReplyEvent的用法示例。


在下文中一共展示了QuestionReplyEvent.is_notifying方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_autowatch_reply

# 需要导入模块: from kitsune.questions.events import QuestionReplyEvent [as 别名]
# 或者: from kitsune.questions.events.QuestionReplyEvent import is_notifying [as 别名]
    def test_autowatch_reply(self, get_current):
        """
        Tests the autowatch setting of users.

        If a user has the setting turned on, they should get
        notifications after posting in a thread for that thread. If they
        have that setting turned off, they should not.
        """

        get_current.return_value.domain = 'testserver'

        u = UserFactory()
        t1 = QuestionFactory()
        t2 = QuestionFactory()
        assert not QuestionReplyEvent.is_notifying(u, t1)
        assert not QuestionReplyEvent.is_notifying(u, t2)

        self.client.login(username=u.username, password='testpass')
        s = Setting.objects.create(user=u, name='questions_watch_after_reply',
                                   value='True')
        data = {'content': 'some content'}
        post(self.client, 'questions.reply', data, args=[t1.id])
        assert QuestionReplyEvent.is_notifying(u, t1)

        s.value = 'False'
        s.save()
        post(self.client, 'questions.reply', data, args=[t2.id])
        assert not QuestionReplyEvent.is_notifying(u, t2)
开发者ID:1234-,项目名称:kitsune,代码行数:30,代码来源:test_notifications.py

示例2: test_autowatch_reply

# 需要导入模块: from kitsune.questions.events import QuestionReplyEvent [as 别名]
# 或者: from kitsune.questions.events.QuestionReplyEvent import is_notifying [as 别名]
    def test_autowatch_reply(self, get_current):
        """
        Tests the autowatch setting of users.

        If a user has the setting turned on, they should get
        notifications after posting in a thread for that thread. If they
        have that setting turned off, they should not.
        """

        get_current.return_value.domain = "testserver"

        u = user(save=True)
        t1 = question(save=True)
        t2 = question(save=True)
        assert not QuestionReplyEvent.is_notifying(u, t1)
        assert not QuestionReplyEvent.is_notifying(u, t2)

        self.client.login(username=u.username, password="testpass")
        s = Setting.objects.create(user=u, name="questions_watch_after_reply", value="True")
        data = {"content": "some content"}
        post(self.client, "questions.reply", data, args=[t1.id])
        assert QuestionReplyEvent.is_notifying(u, t1)

        s.value = "False"
        s.save()
        post(self.client, "questions.reply", data, args=[t2.id])
        assert not QuestionReplyEvent.is_notifying(u, t2)
开发者ID:ruchikagarg93,项目名称:kitsune,代码行数:29,代码来源:test_notifications.py

示例3: test_no_notification_on_update

# 需要导入模块: from kitsune.questions.events import QuestionReplyEvent [as 别名]
# 或者: from kitsune.questions.events.QuestionReplyEvent import is_notifying [as 别名]
    def test_no_notification_on_update(self):
        """Saving an existing question does not watch it."""

        q = Question.objects.get(pk=1)
        assert not QuestionReplyEvent.is_notifying(q.creator, q)

        q.save()
        assert not QuestionReplyEvent.is_notifying(q.creator, q)
开发者ID:GVRV,项目名称:kitsune,代码行数:10,代码来源:test_models.py

示例4: test_no_notification_on_update

# 需要导入模块: from kitsune.questions.events import QuestionReplyEvent [as 别名]
# 或者: from kitsune.questions.events.QuestionReplyEvent import is_notifying [as 别名]
    def test_no_notification_on_update(self):
        """Saving an existing question does not watch it."""

        q = question(save=True)
        QuestionReplyEvent.stop_notifying(q.creator, q)
        assert not QuestionReplyEvent.is_notifying(q.creator, q)

        q.save()
        assert not QuestionReplyEvent.is_notifying(q.creator, q)
开发者ID:Cherpak,项目名称:kitsune,代码行数:11,代码来源:test_models.py

示例5: test_notification_created

# 需要导入模块: from kitsune.questions.events import QuestionReplyEvent [as 别名]
# 或者: from kitsune.questions.events.QuestionReplyEvent import is_notifying [as 别名]
    def test_notification_created(self):
        """Creating a new question auto-watches it for answers."""

        u = user(save=True)
        q = question(creator=u, title='foo', content='bar', save=True)

        assert QuestionReplyEvent.is_notifying(u, q)
开发者ID:Cherpak,项目名称:kitsune,代码行数:9,代码来源:test_models.py

示例6: test_notification_created

# 需要导入模块: from kitsune.questions.events import QuestionReplyEvent [as 别名]
# 或者: from kitsune.questions.events.QuestionReplyEvent import is_notifying [as 别名]
    def test_notification_created(self):
        """Creating a new question auto-watches it for answers."""

        u = UserFactory()
        q = QuestionFactory(creator=u, title='foo', content='bar')

        assert QuestionReplyEvent.is_notifying(u, q)
开发者ID:1234-,项目名称:kitsune,代码行数:9,代码来源:test_models.py

示例7: test_notification_created

# 需要导入模块: from kitsune.questions.events import QuestionReplyEvent [as 别名]
# 或者: from kitsune.questions.events.QuestionReplyEvent import is_notifying [as 别名]
    def test_notification_created(self):
        """Creating a new question auto-watches it for answers."""

        u = User.objects.get(pk=118533)
        q = Question(creator=u, title='foo', content='bar')
        q.save()

        assert QuestionReplyEvent.is_notifying(u, q)
开发者ID:GVRV,项目名称:kitsune,代码行数:10,代码来源:test_models.py

示例8: test_autowatch_reply

# 需要导入模块: from kitsune.questions.events import QuestionReplyEvent [as 别名]
# 或者: from kitsune.questions.events.QuestionReplyEvent import is_notifying [as 别名]
    def test_autowatch_reply(self, get_current):
        get_current.return_value.domain = 'testserver'

        u = user(save=True)
        t1 = question(save=True)
        t2 = question(save=True)
        assert not QuestionReplyEvent.is_notifying(u, t1)
        assert not QuestionReplyEvent.is_notifying(u, t2)

        self.client.login(username=u.username, password='testpass')
        s = Setting.objects.create(user=u, name='questions_watch_after_reply',
                                   value='True')
        data = {'content': 'some content'}
        post(self.client, 'questions.reply', data, args=[t1.id])
        assert QuestionReplyEvent.is_notifying(u, t1)

        s.value = 'False'
        s.save()
        post(self.client, 'questions.reply', data, args=[t2.id])
        assert not QuestionReplyEvent.is_notifying(u, t2)
开发者ID:RobbyGenius73,项目名称:kitsune,代码行数:22,代码来源:test_notifications.py


注:本文中的kitsune.questions.events.QuestionReplyEvent.is_notifying方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。