def _addMedia(self, response, source_file='file/path.mov', notify_url='http://test.com'): """Call addMedia and mock the return value for request.""" with patch('flicks.videos.vidly.request') as request: request.return_value = response result = vidly.addMedia(source_file, notify_url) return result
def send_video_to_vidly(video): """Send a video to vid.ly for processing.""" shortlink = addMedia(video.upload_url, absolutify(reverse('flicks.videos.notify'))) if shortlink is None: video.state = 'error' video.save() else: video.shortlink = shortlink video.state = 'pending' video.save()
def send_video_to_vidly(video): """Send a video to vid.ly for processing.""" notify_url = absolutify(reverse('flicks.videos.notify', args=[settings.NOTIFY_KEY])) shortlink = addMedia(video.upload_url, notify_url) if shortlink is None: video.state = 'error' video.save() else: video.shortlink = shortlink video.state = 'pending' video.save()
def _addMedia(self, source_file="file/path.mov", notify_url="http://test.com"): """Call addMedia.""" return vidly.addMedia(source_file, notify_url)