本文整理汇总了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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)