コード例 #1
0
    def test_confirm(self, warning, info):
        user = self.create_user()
        branch = self.create_branch()
        branch.person.company.fancy_name = u'branch'

        editor = UserEditor(self.store, user)
        editor._person_slave.address_slave.street.update('street')
        editor._person_slave.address_slave.streetnumber.update(15)
        editor._person_slave.address_slave.district.update('district')

        self.click(editor.main_dialog.ok_button)
        warning.assert_called_once_with(
            _(u'User must be associated to at '
              'least one branch.'))

        slave = editor.user_branches
        slave.target_combo.select_item_by_data(branch)
        slave.add()

        slave.add()
        info.assert_called_once_with('individual is already associated with '
                                     'branch.')

        self.click(editor.main_dialog.ok_button)
        associated_branches = list(user.get_associated_branches())
        self.check_editor(editor, 'user-branch-access-slave-confirm-editor',
                          [editor.retval, branch] + associated_branches)
コード例 #2
0
 def test_create_company(self):
     editor = UserEditor(self.store, role_type=Person.ROLE_COMPANY)
     self.check_editor(editor, 'editor-user-company-create')
コード例 #3
0
 def test_create_individual(self):
     editor = UserEditor(self.store, role_type=Person.ROLE_INDIVIDUAL)
     self.check_editor(editor, 'editor-user-individual-create')