'Learner should be eligible for one click purchase if:
- program is eligible for one click purchase
- learner is not enrolled in any of the course runs associated with the program'

def test_learner_eligibility_for_one_click_purchase(self):

    data = ProgramMarketingDataExtender(self.program, self.user).extend()
    self.assertTrue(data['is_learner_eligible_for_one_click_purchase'])
    courses = [self._create_course(self.course_price)]
    program = ProgramFactory(courses=courses, is_program_eligible_for_one_click_purchase=False)
    data = ProgramMarketingDataExtender(program, self.user).extend()
    self.assertFalse(data['is_learner_eligible_for_one_click_purchase'])
    course = self._create_course(self.course_price)
    CourseEnrollmentFactory(user=self.user, course_id=course['course_runs'][0]['key'])
    program2 = ProgramFactory(courses=[course], is_program_eligible_for_one_click_purchase=True)
    data = ProgramMarketingDataExtender(program2, self.user).extend()
    self.assertFalse(data['is_learner_eligible_for_one_click_purchase'])
