Esempio n. 1
0
    def submit(self, user, error_callback_url=None):
        self.set_user_agent(user)
        self.error_callback_url = error_callback_url

        try:
            forms = [
                self.step1, self.step2, self.step3, self.step4, self.step5
            ]

            for handler in forms:
                step_form = self.browser.get_form()
                if step_form:
                    handler(step_form, user)

                errors = self.parse_errors(step_form)
                if errors:
                    raise ValidationError(message='field_errors',
                                          payload=errors)
                if not step_form:
                    raise ValidationError(message='no_form_found',
                                          payload=handler.__name__)

            success_page = clean_browser_response(self.browser)
            if self.success_string in success_page:
                return {'status': 'success'}
            else:
                raise ValidationError(message='no_success_string')

        except ValidationError, e:
            raise OVRError(self,
                           message=e.message,
                           payload=e.payload,
                           error_callback_url=self.error_callback_url)
Esempio n. 2
0
    def submit(self, user, error_callback_url):
        self.set_user_agent(user)
        self.error_callback_url = error_callback_url

        try:
            self.drivers_license(user)
            self.citizenship(user)
            self.age_verification(user)
            self.application_type(user)
            self.illinois_identification(user)
            self.illinois_name(user)
            self.illinois_address(user)
            self.illinois_personal_info(user)
            self.illinois_email(user)
            self.illinois_election_authority(user)
            self.illinois_mailing_address(user)
            self.illinois_different_name(user)
            self.illinois_different_address(user)
            self.illinois_assisting(user)
            self.illinois_summary(user)

            success_page = clean_browser_response(self.browser)
            if self.success_string in success_page:
                return {'status': 'success'}
            else:
                raise ValidationError(message='no_success_string')

        except ValidationError, e:
            raise OVRError(self,
                           message=e.message,
                           payload=e.payload,
                           error_callback_url=self.error_callback_url)
Esempio n. 3
0
    def submit(self, user, error_callback_url=None):
        self.set_user_agent(user)
        self.error_callback_url = error_callback_url

        try:
            forms = [
                self.identification,
            ]

            for handler in forms:
                handler(user)
                errors = self.parse_errors()
                if errors:
                    raise ValidationError(message='field_errors',
                                          payload=errors)

            success_page = clean_browser_response(self.browser)
            if self.success_string in success_page:
                return {'status': 'success'}
            else:
                raise ValidationError(message='no_success_string')

        except ValidationError, e:
            raise OVRError(self,
                           message=e.message,
                           payload=e.payload,
                           error_callback_url=self.error_callback_url)
Esempio n. 4
0
    def submit(self, user, error_callback_url=None):
        self.set_user_agent(user)
        self.error_callback_url = error_callback_url

        try:
            # this one's a little different, all form stepping is in javascript
            # persist same form between handlers, don't submit until end
            self.set_registration_type(user)
            form = self.browser.get_form()

            handlers = [
                self.eligibility, self.voter_information, self.address,
                self.previous_info, self.review_affirm, self.email_receipt
            ]

            for handler in handlers:
                handler(user, form)
                errors = self.parse_errors()
                if errors:
                    raise ValidationError(message='field_errors',
                                          payload=errors)

            success_page = clean_browser_response(self.browser)
            if self.success_string in success_page:
                return {'status': 'success'}
            else:
                raise ValidationError(message='no_success_string')

        except ValidationError, e:
            raise OVRError(self,
                           message=e.message,
                           payload=e.payload,
                           error_callback_url=self.error_callback_url)
Esempio n. 5
0
    def submit(self, user, error_callback_url=None):
        self.set_user_agent(user)
        self.error_callback_url = error_callback_url

        try:
            forms = [
                self.language, self.init_voter_registration, self.eligibility,
                self.personal_information, self.change_of_address,
                self.update_address, self.confirm_address,
                self.register_to_vote, self.verify_voter_registration,
                self.vote_by_mail
            ]

            for handler in forms:
                handler(user)
                errors = self.parse_errors()
                if errors:
                    raise ValidationError(message='field_errors',
                                          payload=errors)

            success_page = clean_browser_response(self.browser)
            if self.success_string in success_page:
                return {'status': 'success'}
            else:
                raise ValidationError(message='no_success_string')

        except ValidationError, e:
            raise OVRError(self,
                           message=e.message,
                           payload=e.payload,
                           error_callback_url=self.error_callback_url)
Esempio n. 6
0
    def submit(self, user, error_callback_url=None):
        self.set_user_agent(user)
        self.error_callback_url = error_callback_url

        try:
            self.validate(user)

            # format is: [kwargs to select / identify form, method to call with form]
            # frustratingly, MA uses the same methods and IDs for each form...
            forms = [[{
                'action': "./MinRequirements.aspx?RMVId=True"
            }, self.minimum_requirements],
                     [{
                         'action': "./FormAndReview.aspx?RMVId=True"
                     }, self.rmv_identification],
                     [{
                         'action': "./FormAndReview.aspx?RMVId=True"
                     }, self.complete_form],
                     [{
                         'action': "./FormAndReview.aspx?RMVId=True"
                     }, self.review]]

            for form_kwargs, handler in forms:

                step_form = self.browser.get_form(**form_kwargs)

                if step_form:
                    handler(user, step_form)

                errors = self.parse_errors()
                if errors:
                    raise ValidationError(message='field_errors',
                                          payload=errors)
                if not step_form:
                    raise ValidationError(message='no_form_found',
                                          payload=handler.__name__)

            success_page = clean_browser_response(self.browser)
            if self.success_string in success_page:
                return {'status': 'success'}
            else:
                return {'status': 'failure'}

        except ValidationError, e:
            raise OVRError(self,
                           message=e.message,
                           payload=e.payload,
                           error_callback_url=self.error_callback_url)
Esempio n. 7
0
    def submit(self, user, error_callback_url=None):
        self.set_user_agent(user)
        self.error_callback_url = error_callback_url

        try:
            # format is: [kwargs to select / identify form, method to call with form]
            forms = [
                [{}, self.welcome],
                [{}, self.minimum_requirements],
                [{}, self.personal_information],
                [{}, self.consent_use_signature],
                [{
                    'id': 'formId'
                }, self.residence_address
                 ],  # there are two forms on this page, but one is blank
                [{}, self.general_information],
                [{}, self.review_information],
                [{}, self.confirmation_email],
            ]

            for form_kwargs, handler in forms:

                step_form = self.browser.get_form(**form_kwargs)

                if step_form:
                    handler(user, step_form)

                errors = self.parse_errors()
                if errors:
                    raise ValidationError(message='field_errors',
                                          payload=errors)

                if not step_form:
                    raise ValidationError(message='no_form_found',
                                          payload=handler.__name__)

            success_page = clean_browser_response(self.browser)
            if self.success_string in success_page:
                return {'status': 'success'}
            else:
                raise ValidationError(message='no_success_string')

        except ValidationError, e:
            raise OVRError(self,
                           message=e.message,
                           payload=e.payload,
                           error_callback_url=self.error_callback_url)
Esempio n. 8
0
    def submit(self, user, error_callback_url=None):
        self.set_user_agent(user)
        self.error_callback_url = error_callback_url

        try:
            self.validate(user)

            # format is: [kwargs to select / identify form, method to call with form]
            forms = [
                [{
                    'id': 'verifyNewVoterForm'
                }, self.verify_identification],
                [
                    {}, self.new_or_existing_voter
                ],  # this splits between verify_eligibility, edit_voter_information
                [{
                    'id': 'reviewVoterForm'
                }, self.review],
                [{
                    'id': 'affirmationVoterForm'
                }, self.affirmation]
            ]

            for form_kwargs, handler in forms:
                step_form = self.browser.get_form(**form_kwargs)
                handler(user, step_form)
                errors = self.parse_errors()
                if errors:
                    raise ValidationError(message='field_errors',
                                          payload=errors)
                if not step_form:
                    raise ValidationError(message='no_form_found',
                                          payload=handler.__name__)

            success_page = clean_browser_response(self.browser)
            if self.success_string in success_page:
                return {'status': 'success'}
            else:
                raise ValidationError(message='no_success_string')

        except ValidationError, e:
            raise OVRError(self,
                           message=e.message,
                           payload=e.payload,
                           error_callback_url=self.error_callback_url)
Esempio n. 9
0
    def submit(self, user, error_callback_url = None):

        self.error_callback_url = error_callback_url

        try:
            self.get_started(user)
            self.full_registration(user)
            # return queue status immediately
            # check for pdf with get_download

            success_page = clean_browser_response(self.browser)
            if self.success_string in success_page:
                return {'status': 'success'}
            else:
                # TODO, handle gracefully
                return {'status': 'failure'}
        
        except ValidationError, e:
            raise OVRError(self, message=e.message, payload=e.payload, error_callback_url=self.error_callback_url)
Esempio n. 10
0
    def submit(self, user, error_callback_url=None):
        self.set_user_agent(user)
        self.error_callback_url = error_callback_url

        try:
            # format is: [kwargs to select / identify form, method to call with form]
            forms = [
                [{}, self.voting_eligibility],
                [{}, self.voting_identity],
                [{}, self.protected_voter],
                [{}, self.overseas_classification],
                [{}, self.absentee_ballot],
                [{}, self.residence_address],
                [{}, self.contact_information],
                [{}, self.affirmation]
            ]

            for form_kwargs, handler in forms:

                step_form = self.browser.get_form(**form_kwargs)

                if step_form:
                    handler(user, step_form)

                errors = self.parse_errors()
                if errors:
                    raise ValidationError(message='field_errors', payload=errors)
                if not step_form:
                    raise ValidationError(message='no_form_found', payload=handler.__name__)

            success_page = clean_browser_response(self.browser)
            if self.success_string in success_page:
                return {'status': 'success'}
            else:
                return {'status': 'failure'}

        except ValidationError, e:
            raise OVRError(self, message=e.message, payload=e.payload, error_callback_url=self.error_callback_url)