def test_execute_exception(self, mock_tj, mock_log): tj = mock_tj.objects.get_subclass() tj.execute.side_effect = Exception('error') gizmo_jobs_table.execute(request='', job_id='1') mock_log.error.assert_called_with('The following error occurred when executing job %s: %s', '1', 'error')
def test_execute(self, mock_tj): tj = mock_tj() tj.execute.return_value = mock.MagicMock() result = gizmo_jobs_table.execute(request='', job_id='1') self.assertEqual(200, result.status_code)