示例#1
0
 def call(self, bot, item):
     parent = item.parent()
     item.reply(
         bot.reply_using_parent_of_mention(author_name(parent),
                                           get_text(parent)))
示例#2
0
 def call(self, bot, item):
     item.reply(bot.reply_to_mention(author_name(item), get_text(item)))
示例#3
0
 def author_is_blacklisted(self, item):
     return not has_author(item) or author_name(
         item) not in self.user_blacklist
 def test_author_name_when_missing_name(self):
     item = Mock()
     item.author = None
     assert "[deleted]" == author_name(item)
 def test_author_name_when_non_normalised_name(self):
     name = "BlahBlaHH"
     item = Mock()
     item.author.name = name
     assert name == author_name(item)
 def test_author_name_when_does_not_have_author(self):
     with self.assertRaises(ValueError):
         author_name(Mock(spec=Subreddit))