Exemplo n.º 1
0
    def save(self, commit=True):
        instance = super().save()
        youtube_dl.apply_async([instance.pk])

        return instance
Exemplo n.º 2
0
 def test_task_cancellation_attr_error(self, mock_deepcopy, mock_remove):
     mock_deepcopy.side_effect = SystemExit()
     youtube_dl.apply_async([self.download_task.id])
     mock_remove.assert_not_called()
Exemplo n.º 3
0
    def test_task_other_exception(self, mock_download, mock_log):
        mock_download.side_effect = ValueError()

        self.assertRaises(ValueError, lambda: youtube_dl.apply_async([self.download_task.id]))
        self.assertEqual(self.download_task.tracebacks.count(), 1)
Exemplo n.º 4
0
 def test_database_exception(self, mock_log):
     self.assertRaises(ObjectDoesNotExist, lambda: youtube_dl.apply_async([0]))
     mock_log.exception.assert_called_with('Exception while updating DownloadTask. id=0')