コード例 #1
0
ファイル: test_personeditor.py プロジェクト: LeonamSilva/stoq
    def test_edit_address(self, warning):
        client = self.store.find(Person,
                                 name=u"Franciso Elisio de Lima Junior")[0].client
        editor = ClientEditor(self.store, client,
                              role_type=Person.ROLE_INDIVIDUAL)

        dump = GUIDumper()
        dump.dump_editor(editor)

        def run_dialog2(dialog, parent, *args, **kwargs):
            d = dialog(*args, **kwargs)
            dump.dump_dialog(d)
            # Avoid committing
            return False

        def run_dialog(dialog, parent, *args, **kwargs):
            d = dialog(*args, **kwargs)
            dump.dump_dialog(d)
            with mock.patch('stoqlib.gui.base.lists.run_dialog',
                            new=run_dialog2):
                self.click(d.list_slave.listcontainer.add_button)
            return d.retval

        with mock.patch('stoqlib.gui.templates.persontemplate.run_dialog',
                        new=run_dialog):
            self.click(editor.get_person_slave().address_button)

        self.check_filename(dump, 'editor-client-edit-address')
コード例 #2
0
    def test_edit_address(self, warning):
        client = self.store.find(
            Person, name=u"Franciso Elisio de Lima Junior")[0].client
        editor = ClientEditor(self.store,
                              client,
                              role_type=Person.ROLE_INDIVIDUAL)

        dump = GUIDumper()
        dump.dump_editor(editor)

        def run_dialog2(dialog, parent, *args, **kwargs):
            d = dialog(*args, **kwargs)
            dump.dump_dialog(d)
            # Avoid committing
            return False

        def run_dialog(dialog, parent, *args, **kwargs):
            d = dialog(*args, **kwargs)
            dump.dump_dialog(d)
            with mock.patch('stoqlib.gui.base.lists.run_dialog',
                            new=run_dialog2):
                self.click(d.list_slave.listcontainer.add_button)
            return d.retval

        with mock.patch('stoqlib.gui.templates.persontemplate.run_dialog',
                        new=run_dialog):
            self.click(editor.get_person_slave().address_button)

        self.check_filename(dump, 'editor-client-edit-address')
コード例 #3
0
ファイル: test_personeditor.py プロジェクト: LeonamSilva/stoq
    def test_edit_without_address(self, warning):
        client = self.create_client()
        editor = ClientEditor(self.store, client,
                              role_type=Person.ROLE_INDIVIDUAL)
        self.click(editor.get_person_slave().address_button)

        warning.assert_called_once_with(
            'You must define a valid main address before\n'
            'adding additional addresses')
コード例 #4
0
    def test_edit_without_address(self, warning):
        client = self.create_client()
        editor = ClientEditor(self.store, client,
                              role_type=Person.ROLE_INDIVIDUAL)
        self.click(editor.get_person_slave().address_button)

        warning.assert_called_once_with(
            'You must define a valid main address before\n'
            'adding additional addresses')