def call_mocked_command(self): mock = MagicMock() mock.fb_share_token = 'token' mock.fb_share_link = self.url cmd = Command() cmd.config = mock with patch('facebook.GraphAPI.put_wall_post') as mock: cmd.handle() return mock
def call_mocked_command(self, link): mock = MagicMock() mock.get_renewed_token.return_value = 'token' mock.get_attachment.return_value = link cmd = Command() cmd.get_attachment = mock.get_attachment cmd.get_renewed_token = mock.get_renewed_token with patch('facebook.GraphAPI.put_wall_post') as mock: cmd.handle() return mock