def test_search(self): student_performances = mdl_perf.search(registration_id=self.student_performance.registration_id) self.assertIn(self.student_performance, student_performances, "Invalid search result with student as argument") student_performances = mdl_perf.search(academic_year=self.student_performance.academic_year) self.assertIn(self.student_performance, student_performances, "Invalid search result with academic_year as argument") student_performances = mdl_perf.search(acronym=self.student_performance.acronym) self.assertIn(self.student_performance, student_performances, "Invalid search result with acronym as argument") student_performances = mdl_perf.search(registration_id="541315") self.assertFalse(student_performances, "Should return empty result")
def test_search(self): student_performances = mdl_perf.search(registration_id=self.student_performance.registration_id) self.assertIn(self.student_performance, student_performances, "Invalid search result with student as argument") student_performances = mdl_perf.search(academic_year=self.student_performance.academic_year) self.assertIn( self.student_performance, student_performances, "Invalid search result with academic_year as argument" ) student_performances = mdl_perf.search(acronym=self.student_performance.acronym) self.assertIn(self.student_performance, student_performances, "Invalid search result with acronym as argument") student_performances = mdl_perf.search(registration_id="541315") self.assertFalse(student_performances, "Should return empty result")
def test_authorized_results(self): """ As a student If my results marks are authorized by my faculty When I got to "my marks for an offer" page - I should not see the "not authorized" message """ student = self.create_student_with_performances(count_perfs=1) self.login(student.person.user.username) self.__go_to_first_exam_marks_page(student) student_perf = student_performance.search(registration_id=student.registration_id)[0] message = self.get_localized_message('performance_result_note_not_autorized', student.person.language). \ format(self.get_localized_message(student_perf.session_locked, student.person.language)) self.check_page_not_contains_string(message)
def test_search_student_with_valid_results(self): """ As a Faculty Administrator When i go to the "Exam Marks Faculty Administration" page With the registration id of a student with valid exam marks - I should be able to search for his exam marks - I should see the programs list of the student i looked for """ self.login(self.faculty_administrator.user.username) self.__got_to_performance_administration_page() self.__search_student_programs( self.student_with_valid_perfs.registration_id) perfs = student_performance.search( registration_id=self.student_with_valid_perfs.registration_id) perf_lnk_pattern = self.perf_config.get('EXAM_MARK_LINKS_PATTERN') self.check_page_contains_ids( [perf_lnk_pattern.format(p.pk) for p in perfs])
def test_student_with_performances(self): """ As a student With performances results When i go to to "my exam marks page" - I should see a legal announcement - I should see the list of my registered offer When i click on an offer in the previous list - I should see my exam marks for this offer - I should see all the common messages """ self.login(self.student_with_valid_perfs.person.user.username) self.__got_to_perfomance_page() string = self.get_localized_message('performance_results_general_legal_announcement', self.student_with_valid_perfs.person.language) self.check_page_contains_string(string) perfs = student_performance.search(registration_id=self.student_with_valid_perfs.registration_id) perf_lnk_pattern = self.perf_config.get('EXAM_MARK_LINKS_PATTERN') self.check_page_contains_ids([perf_lnk_pattern.format(p.pk) for p in perfs]) self.click_element_by_id(perf_lnk_pattern.format(perfs[0].pk)) self.check_page_title(self.config.get('PERFORMANCE').get('EXAM_MARK').get('PAGE_TITLE')) self.__check_common_messages(self.student_with_valid_perfs.person.language)
def get_performances_by_registration_id_and_offer(registration_id, academic_year, acronym): from performance.models.student_performance import search return search(registration_id=registration_id, academic_year=academic_year, acronym=acronym)
def __get_first_program_link_id(self, student): perfs = student_performance.search( registration_id=student.registration_id) perf_lnk_pattern = self.perf_config.get('EXAM_MARK_LINKS_PATTERN') return perf_lnk_pattern.format(perfs[0].pk)
def __go_to_first_exam_marks_page(self, student): perf = student_performance.search(registration_id=student.registration_id)[0] self.open_url_by_name('performance_student_result', {'pk': perf.pk})