def test_should_update_submission_log_when_subject_info_is_edited(self):
        self.driver.go_to(url("/entity/subject/create/clinic/?web_view=True&"))
        add_subject_page = AddSubjectPage(self.driver)
        add_subject_page.add_subject_with(VALID_DATA_FOR_SUBJECT)
        add_subject_page.submit_subject()
        message = fetch_(SUCCESS_MESSAGE, from_(VALID_DATA_FOR_SUBJECT))

        flash_message = add_subject_page.get_flash_message()
        subject_short_code = get_subject_short_code(flash_message)
        message = message % subject_short_code
        self.assertIn(message, flash_message)

        VALID_SMS_FOR_EDIT_SUBJECT[SMS] = VALID_SMS_FOR_EDIT_SUBJECT[
            SMS].replace('short_code', subject_short_code, 1)
        send_valid_sms_with(VALID_SMS_FOR_EDIT_SUBJECT)

        submission_log_page = self.get_first_project_submission_log_page()
        submission_log_page.search(subject_short_code)
        self.assertIn(fetch_(SUB_LAST_NAME, VALID_DATA_FOR_SUBJECT),
                      submission_log_page.get_cell_value(1, 5))

        self.driver.go_to(url("/entity/subjects/clinic/"))
        subject_list_page = AllSubjectsListPage(self.driver)
        self.driver.wait_for_page_load()
        subject_list_page.select_subject_by_id(subject_short_code)
        edit_subject_page = subject_list_page.click_edit_action_button()
        edit_subject_page.add_subject_with(VALID_DATA_FOR_EDIT)
        edit_subject_page.submit_subject()

        submission_log_page = self.get_first_project_submission_log_page()
        submission_log_page.search(subject_short_code)
        self.assertIn(fetch_(SUB_LAST_NAME, VALID_DATA_FOR_EDIT),
                      submission_log_page.get_cell_value(1, 5))
Exemple #2
0
 def prepare_subject(cls):
     cls.driver.go_to(DATA_WINNER_ADD_SUBJECT + cls.subject_type + "?web_view=True")
     add_subject_page = AddSubjectPage(cls.driver)
     add_subject_page.add_subject_with(VALID_DATA)
     add_subject_page.submit_subject()
     flash_message = add_subject_page.get_flash_message()
     cls.subject_id = flash_message[flash_message.find(":") + 1:].strip()
Exemple #3
0
    def add_edit_delete_subject(self):
        add_subject_page = AddSubjectPage(self.driver)
        add_subject_page.add_subject_with(VALID_DATA_FOR_SUBJECT_REG)
        add_subject_page.submit_subject()
        flash_message = add_subject_page.get_flash_message()
        subject_short_code = get_subject_short_code(flash_message)
        message = fetch_(
            SUCCESS_MESSAGE,
            from_(VALID_DATA_FOR_SUBJECT_REG)) % subject_short_code
        self.assertIn(message, flash_message)

        add_subject_page.navigate_to_subject_list()
        all_subjects_list_page = AllSubjectsListPage(self.driver)
        all_subjects_list_page.select_subject_by_id(subject_short_code)
        edit_subject_page = all_subjects_list_page.click_edit_action_button()
        edit_subject_page.add_subject_with(VALID_DATA_FOR_EDIT)
        edit_subject_page.submit_subject()
        self.assertEquals(edit_subject_page.get_flash_message(),
                          VALID_DATA_FOR_EDIT[SUCCESS_MESSAGE])

        edit_subject_page.navigate_to_subject_list()
        all_subjects_page = AllSubjectsListPage(self.driver)
        all_subjects_page.select_subject_by_id(subject_short_code)
        all_subjects_page.click_delete_action_button()
        self.driver.find(CONFIRM_DELETE).click()
        self.assertEquals(all_subjects_page.get_successfully_deleted_message(),
                          'Subject(s) successfully deleted.')
        self.assertFalse(
            all_subjects_page.is_subject_present(subject_short_code))
Exemple #4
0
 def test_addition_of_subject_with_auto_generate_false(self):
     self.driver.go_to(self.add_subjects_url)
     add_subject_page = AddSubjectPage(self.driver)
     add_subject_page.add_subject_with(SUBJECT_DATA_WITHOUT_UNIQUE_ID)
     add_subject_page.submit_subject()
     message = fetch_(SUCCESS_MSG, from_(SUBJECT_DATA_WITHOUT_UNIQUE_ID))
     self.assertRegexpMatches(add_subject_page.get_flash_message(), message)