Exemple #1
0
    def test_update_dask_job_statusException(self, mock_daskjob,
                                             mock_json_response):
        mock_request = mock.MagicMock()
        mock_job_key = mock.MagicMock()
        mock_daskjob.objects.filter.side_effect = Exception

        update_dask_job_status(mock_request, mock_job_key)
        mock_daskjob.objects.filter.assert_called_once_with(key=mock_job_key)
        mock_json_response.assert_called_once_with({'success': False})
Exemple #2
0
    def test_update_dask_job_status(self, mock_daskjob, mock_json_response):
        mock_request = mock.MagicMock()
        mock_job_key = mock.MagicMock()
        mock_job1 = mock.MagicMock()
        mock_job1.status = True
        mock_job2 = mock.MagicMock()
        mock_daskjob.objects.filter.return_value = [mock_job1, mock_job2]

        # Call the method
        update_dask_job_status(mock_request, mock_job_key)

        # check results
        mock_daskjob.objects.filter.assert_called_once_with(key=mock_job_key)
        mock_json_response.assert_called_once_with({'success': True})