def test_get_registrations_by_payment_complete(self): form = RegistrationFilterForm({"payment_complete": True}) self.assertTrue(form.is_valid()) results = form.get_registrations() self.assertCountEqual(results, [self.registrations[1]]) form = RegistrationFilterForm({ "payment_complete": True, "ucl_registration_complete": True }) self.assertTrue(form.is_valid()) results = form.get_registrations() self.assertCountEqual(results, [])
def test_get_registrations_by_academic_year(self): form = RegistrationFilterForm( {"academic_year": self.current_academic_yr.id}) self.assertTrue(form.is_valid()) results = form.get_registrations() self.assertListEqual(list(results), self.all_registrations_expected)
def test_generate_xls_data_with_an_admission(self): a_form = RegistrationFilterForm({"faculty": self.entity_version.id}) self.assertTrue(a_form.is_valid()) found_registrations = a_form.get_registrations() create_xls_registration(self.user, found_registrations, None) xls_data = [[ self.registration.person_information.person.first_name, self.registration.person_information.person.last_name, self.registration.email, self.registration.formation, self.entity_version.entity, _('Yes'), _('No'), self.registration.state ]] expected_argument = _generate_xls_build_parameter(xls_data, self.user) self.assertEqual(expected_argument['list_description'], _('Registrations list')) self.assertEqual(expected_argument['filename'], _('Registrations_list')) self.assertEqual(expected_argument['username'], self.user.username) self.assertEqual(expected_argument['data'][0]['content'], xls_data) self.assertEqual(expected_argument['data'][0]['header_titles'], _get_titles()) self.assertEqual(expected_argument['data'][0]['worksheet_title'], _('Registrations list'))
def list_registrations(request): search_form = RegistrationFilterForm(request.GET, user=request.user) user_is_continuing_education_student_worker = is_continuing_education_student_worker( request.user) admission_list = [] if search_form.is_valid(): admission_list = search_form.get_registrations() if not user_is_continuing_education_student_worker: admission_list = filter_authorized_admissions(request.user, admission_list) if request.GET.get('xls_status') == "xls_registrations": return create_xls_registration(request.user, admission_list, search_form) return render( request, "registrations.html", { 'admissions': get_object_list(request, admission_list), 'admissions_number': len(admission_list), 'search_form': search_form, 'user_is_continuing_education_student_worker': user_is_continuing_education_student_worker, 'ucl_registration_state_choices': UCLRegistrationState.__members__ })
def test_get_registrations_by_free_text_country(self): admission_accent = self._build_admission_with_accent( REGISTRATION_SUBMITTED, False) country_free_text = "Country - e" form = RegistrationFilterForm({"free_text": country_free_text}) form.is_valid() results = form.get_registrations() self.assertEqual(results.first(), admission_accent)
def test_get_registrations_by_free_text(self): self._create_admissions_for_free_text_search() for admission in self.admissions_free_text: admission.state = ACCEPTED admission.save() form = RegistrationFilterForm({"free_text": "testtext"}) self.assertTrue(form.is_valid()) results = form.get_registrations() self.assertCountEqual(results, self.admissions_free_text)
def test_get_registrations_by_faculty_and_formation_criteria(self): form = RegistrationFilterForm({ "faculty": self.fac_1_version.id, "formation": self.registrations[0].formation.id }) self.assertTrue(form.is_valid()) results = form.get_registrations() self.assertCountEqual(results, [self.registrations[0]]) form = RegistrationFilterForm({ "faculty": self.fac_1_version.id, "formation": self.registration_validated.formation.id }) self.assertTrue(form.is_valid()) results = form.get_registrations() self.assertCountEqual(results, [])
def test_get_registration_received_file_param(self): self.registrations[0].registration_file_received = True self.registrations[0].save() form = RegistrationFilterForm({"registration_file_received": True}) self.assertTrue(form.is_valid()) results = form.get_registrations() self.assertCountEqual(results, [self.registrations[0]]) form = RegistrationFilterForm({"registration_file_received": False}) self.assertTrue(form.is_valid()) results = form.get_registrations() self.assertCountEqual( results, [self.registrations[1], self.registration_validated]) form = RegistrationFilterForm({}) self.assertTrue(form.is_valid()) results = form.get_registrations() self.assertCountEqual(results, [ self.registrations[0], self.registrations[1], self.registration_validated ])
def test_get_registrations_by_state(self): form = RegistrationFilterForm({"state": ACCEPTED}) self.assertTrue(form.is_valid()) results = form.get_registrations() self.assertCountEqual(results, [self.registrations[0]])
def test_get_registrations_by_ucl_registration_complete_criteria(self): form = RegistrationFilterForm({"ucl_registration_complete": True}) self.assertTrue(form.is_valid()) results = form.get_registrations() self.assertCountEqual(results, [self.registrations[0]])
def test_get_registrations_by_faculty_criteria(self): form = RegistrationFilterForm({"faculty": self.fac_1_version.id}) self.assertTrue(form.is_valid()) results = form.get_registrations() self.assertCountEqual(list(results), self.registrations)
def test_get_registrations_by_formation_criteria(self): form = RegistrationFilterForm( {"formation": self.registrations[0].formation.id}) self.assertTrue(form.is_valid()) results = form.get_registrations() self.assertListEqual(list(results), [self.registrations[0]])
def test_get_registrations_no_criteria(self): form = RegistrationFilterForm({}) self.assertTrue(form.is_valid()) results = form.get_registrations() self.assertCountEqual(results, self.all_registrations_expected)