I'm trying to understand the assert_called_with
within mock but the code I wrote throws some error.
import os
import twitter
URL = "http://test.com"
def tweet(api, message):
if len(message) > 40:
message = message.strip("?.,.,.")
status = api.PostUpdate(message)
return status
def main():
api = twitter.Api(consumer_key=''
,consumer_secret='')
msg = 'This is test message'
tweet(api, msg)
if __name__ == '__main__':
main()
unittest
import unittest
from mock import Mock
import test
class TweetTest(unittest.TestCase):
def test_example(self):
mock_twitter = Mock()
test.tweet(mock_twitter,'msg')
mock_twitter.PostUpdate.assert_called_with('message')
if __name__ == '__main__':
unittest.main()
I'm trying to understand what assert_called_with
does here?