コード例 #1
0
    def test_add_account(self, run_dialog, new_store):
        new_account = self.create_account()
        new_store.return_value = self.store
        run_dialog.return_value = new_account
        editor = AccountTransactionEditor(self.store, None, new_account)
        parent_account = editor._get_account()

        with mock.patch.object(self.store, 'commit'):
            with mock.patch.object(self.store, 'close'):
                self.click(editor.add_account)
                run_dialog.assert_called_once_with(AccountEditor, editor, self.store, parent_account=parent_account)
コード例 #2
0
    def test_confirm(self):
        account = self.create_account()
        editor = AccountTransactionEditor(self.store, None, account)

        self.assertFalse(editor.validate_confirm())

        editor.description.update("description")
        editor.code.update(15)
        editor.value.update(150)

        self.assertTrue(editor.validate_confirm())

        editor.main_dialog.confirm()
        self.check_editor(editor, "editor-transaction-confirm", [editor.retval, account])
コード例 #3
0
    def test_add_account(self, run_dialog, new_store):
        new_account = self.create_account()
        new_store.return_value = self.store
        run_dialog.return_value = new_account
        editor = AccountTransactionEditor(self.store, None, new_account)
        parent_account = editor._get_account()

        with mock.patch.object(self.store, 'commit'):
            with mock.patch.object(self.store, 'close'):
                self.click(editor.add_account)
                run_dialog.assert_called_once_with(
                    AccountEditor,
                    editor,
                    self.store,
                    parent_account=parent_account)
コード例 #4
0
    def test_confirm(self):
        account = self.create_account()
        editor = AccountTransactionEditor(self.store, None, account)

        self.assertFalse(editor.validate_confirm())

        editor.description.update('description')
        editor.code.update(15)
        editor.value.update(150)

        self.assertTrue(editor.validate_confirm())

        editor.main_dialog.confirm()
        self.check_editor(editor, 'editor-transaction-confirm',
                          [editor.retval, account])
コード例 #5
0
    def test_show(self):
        account = self.create_account()
        transaction = self.create_account_transaction(account)
        editor = AccountTransactionEditor(self.store, transaction, account)
        editor.date.update(datetime.date.today())

        self.check_editor(editor, 'editor-transaction-show')
コード例 #6
0
    def test_create(self):
        account = self.create_account()
        editor = AccountTransactionEditor(self.store, None, account)

        editor.date.update(datetime.date.today())
        self.check_editor(editor, 'editor-transaction-create')