def test_tweet(send_tweet): client = Mock() send_tweet.return_value = 'blah' poems.last_poem['#bots'] = ['foobar'] poems.tweet(client, '#bots', 'me') client.msg.assert_called_with('#bots', 'blah')
def test_tweet_with_failure(send_tweet): client = Mock() send_tweet.return_value = None poems.last_poem['#bots'] = ['foobar'] poems.tweet(client, '#bots', 'me') client.msg.assert_called_with('#bots', "me, that probably did not work :(")
def test_tweet_with_no_poem(): client = Mock() poems.last_poem['#bots'] = None poems.tweet(client, '#bots', 'me') client.msg.assert_called_with('#bots', "me, why don't you try making one first")