|
|
@ -19,19 +19,21 @@ |
|
|
|
# |
|
|
|
############################################################################## |
|
|
|
import base64 |
|
|
|
from openerp import api, models |
|
|
|
from mock import patch |
|
|
|
from openerp.tests.common import TransactionCase |
|
|
|
|
|
|
|
|
|
|
|
acc_number = 'BE1234567890' |
|
|
|
|
|
|
|
|
|
|
|
class HelloWorldParser(models.TransientModel): |
|
|
|
_inherit = 'account.bank.statement.import' |
|
|
|
|
|
|
|
@api.model |
|
|
|
def _parse_file(self, data_file): |
|
|
|
return ( |
|
|
|
class TestSaveFile(TransactionCase): |
|
|
|
def test_SaveFile(self): |
|
|
|
with patch.object( |
|
|
|
self.env.registry |
|
|
|
.models['account.bank.statement.import'].__class__, |
|
|
|
'_parse_file' |
|
|
|
) as _parse_file: |
|
|
|
_parse_file.side_effect = lambda data_file: ( |
|
|
|
'EUR', |
|
|
|
acc_number, |
|
|
|
[{ |
|
|
@ -45,17 +47,7 @@ class HelloWorldParser(models.TransientModel): |
|
|
|
}], |
|
|
|
}], |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
class TestSaveFile(TransactionCase): |
|
|
|
def test_SaveFile(self): |
|
|
|
HelloWorldParser._build_model(self.registry, self.cr) |
|
|
|
import_wizard = self.env['account.bank.statement.import'] |
|
|
|
import_wizard._prepare_setup() |
|
|
|
import_wizard._setup_base(False) |
|
|
|
import_wizard._setup_fields() |
|
|
|
import_wizard._setup_complete() |
|
|
|
import_wizard._auto_init() |
|
|
|
journal_id = self.env['res.partner.bank'].search([ |
|
|
|
('acc_number', '=', acc_number), |
|
|
|
]).journal_id.id |
|
|
|