コード例 #1
0
    def test_employee(self):
        employee = self.create_employee()
        employee.person.individual.cpf = u'954.181.357-75'
        employee.person.name = u'employee name'

        wizard = PersonRoleWizard(self.store, EmployeeEditor)

        step = wizard.get_current_step()
        step.person_document.update(employee.person.individual.cpf)
        self.check_wizard(wizard, 'wizard-employee-person-role-type-step')
        self.click(wizard.next_button)

        step = wizard.get_current_step()
        self.assertNotSensitive(wizard, ['next_button'])

        step.person_slave.name.update('new employee name')
        step.person_slave.address_slave.street.update('street')
        step.person_slave.address_slave.streetnumber.update(123)
        step.person_slave.address_slave.district.update('district')
        step.role_editor.role_slave.role.update(employee.role)
        step.role_editor.role_slave.salary.update(555)

        self.assertSensitive(wizard, ['next_button'])
        self.click(wizard.next_button)

        employee = wizard.retval
        self.check_wizard(wizard, 'wizard-employee-person-role-finish',
                          [employee, employee.person] +
                          list(employee.person.addresses))
コード例 #2
0
    def test_user(self):
        branch = self.create_branch()
        branch.person.company.fancy_name = u'branch'
        wizard = PersonRoleWizard(self.store, UserEditor)

        step = wizard.get_current_step()
        self.check_wizard(wizard, 'wizard-user-person-role-type-step')
        self.click(wizard.next_button)

        step = wizard.get_current_step()
        self.assertNotSensitive(wizard, ['next_button'])

        step.person_slave.name.update(u'user name')
        step.person_slave.address_slave.street.update(u'street')
        step.person_slave.address_slave.streetnumber.update(123)
        step.person_slave.address_slave.district.update(u'district')
        step.person_slave.address_slave.district.update(u'district')
        step.role_editor.user_details.username.update(u'username')
        step.role_editor.user_details.password_slave.password.update(u'foobar')
        step.role_editor.user_details.password_slave.confirm_password.update(
            u'foobar')
        step.role_editor.user_branches.target_combo.select_item_by_data(branch)
        step.role_editor.user_branches.add()

        self.assertSensitive(wizard, ['next_button'])
        self.click(wizard.next_button)

        user = wizard.retval
        self.check_wizard(wizard, 'wizard-user-person-role-finish',
                          [user, user.person] + list(user.person.addresses))
コード例 #3
0
    def test_run_dialog_parent(self, run_dialog):
        wizard = PersonRoleWizard(self.store, ClientEditor)
        self.click(wizard.next_button)
        step = wizard.get_current_step()
        person_slave = step.role_editor._person_slave

        buttons_dialogs = [
            (person_slave.calls_button, CallsSearch),
            (person_slave.contact_info_button, ContactInfoListDialog),
            (person_slave.credit_check_history_button,
             CreditCheckHistorySearch),
        ]

        for button, dialog in buttons_dialogs:
            run_dialog.reset_mock()
            self.click(button)
            self.assertEqual(run_dialog.call_count, 1)
            args = run_dialog.call_args[0]
            self.assertEqual(args, (dialog, wizard, step.store))
コード例 #4
0
    def test_client(self):
        wizard = PersonRoleWizard(self.store, ClientEditor)

        step = wizard.get_current_step()
        self.check_wizard(wizard, 'wizard-client-person-role-type-step')
        self.click(wizard.next_button)

        step = wizard.get_current_step()
        self.assertNotSensitive(wizard, ['next_button'])

        step.person_slave.name.update('client name')
        step.person_slave.address_slave.street.update('street')
        step.person_slave.address_slave.streetnumber.update(123)
        step.person_slave.address_slave.district.update('district')

        self.assertSensitive(wizard, ['next_button'])
        self.click(wizard.next_button)

        client = wizard.retval
        self.check_wizard(wizard, 'wizard-client-person-role-finish',
                          [client, client.person] +
                          list(client.person.addresses))
コード例 #5
0
    def test_transporter(self):
        wizard = PersonRoleWizard(self.store, TransporterEditor)

        step = wizard.get_current_step()
        self.check_wizard(wizard, 'wizard-transporter-person-role-type-step')
        self.click(wizard.next_button)

        step = wizard.get_current_step()
        self.assertNotSensitive(wizard, ['next_button'])

        step.person_slave.name.update(u'transporter name')
        step.person_slave.address_slave.street.update(u'street')
        step.person_slave.address_slave.streetnumber.update(123)
        step.person_slave.address_slave.district.update(u'district')

        self.assertSensitive(wizard, ['next_button'])
        self.click(wizard.next_button)

        transporter = wizard.retval
        self.check_wizard(wizard, 'wizard-transporter-person-role-finish',
                          [transporter, transporter.person] +
                          list(transporter.person.addresses))
コード例 #6
0
    def test_branch(self):
        wizard = PersonRoleWizard(self.store, BranchEditor)

        step = wizard.get_current_step()
        self.check_wizard(wizard, 'wizard-branch-person-role-type-step')
        self.click(wizard.next_button)

        step = wizard.get_current_step()
        self.assertNotSensitive(wizard, ['next_button'])

        step.person_slave.name.update('branch name')
        step.person_slave.address_slave.street.update('street')
        step.person_slave.address_slave.streetnumber.update(123)
        step.person_slave.address_slave.district.update('district')

        self.assertSensitive(wizard, ['next_button'])
        self.click(wizard.next_button)

        branch = wizard.retval
        self.check_wizard(wizard, 'wizard-branch-person-role-finish',
                          [branch, branch.person] +
                          list(branch.person.addresses))