def test_create_audit_seat_for_credit_and_verified_course_runs( self, seat_type): seat = SeatFactory(type=seat_type) form = SeatForm(instance=seat) form.save() assert seat.course_run.seats.count() == 2 assert seat.course_run.seats.filter(type=Seat.AUDIT, price=0).exists()
def test_remove_audit_seat_for_professional_course_runs(self, seat_type): seat = SeatFactory(type=seat_type) audit_seat = SeatFactory(type=Seat.AUDIT, course_run=seat.course_run) form = SeatForm(instance=seat) form.save() assert list(seat.course_run.seats.all()) == [seat] assert not Seat.objects.filter(pk=audit_seat.pk).exists()
def test_create_seat_masters_track(self, form_data): course_run = CourseRunFactory() form = SeatForm(data=form_data) seat = form.save(course_run=course_run) expected_masters = 'masters_track' in form_data and form_data[ 'masters_track'] self.assertEqual(expected_masters, seat.masters_track)
def test_audit_only_seat_not_modified(self): seat = SeatFactory(type=Seat.AUDIT) form = SeatForm(instance=seat) form.save() assert list(seat.course_run.seats.all()) == [seat]