'Verify that relevant tasks are only enqueued when the commit option is passed.'

@ddt.data(True, False)
def test_handle(self, commit, mock_task, mock_get_programs):

    data = [ProgramFactory(courses=[CourseFactory(course_runs=[CourseRunFactory(key=self.course_run_key)])])]
    mock_get_programs.return_value = data
    GeneratedCertificateFactory(user=self.alice, course_id=self.course_run_key, mode=MODES.verified, status=CertificateStatuses.downloadable)
    GeneratedCertificateFactory(user=self.bob, course_id=self.alternate_course_run_key, mode=MODES.verified, status=CertificateStatuses.downloadable)
    call_command('backpopulate_program_credentials', commit=commit)
    if commit:
        mock_task.assert_called_once_with(self.alice.username)
    else:
        mock_task.assert_not_called()
