From 63b1b0abb84678011ec9d1772042c345fcbcd8c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Bidoul?= Date: Sun, 4 Jan 2015 14:21:21 +0100 Subject: [PATCH] [FIX] async_move_line_importer test suite for 2015 --- .../tests/test_async_import.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/async_move_line_importer/tests/test_async_import.py b/async_move_line_importer/tests/test_async_import.py index 308c56d81..d1bace61a 100644 --- a/async_move_line_importer/tests/test_async_import.py +++ b/async_move_line_importer/tests/test_async_import.py @@ -18,8 +18,7 @@ # along with this program. If not, see . # ############################################################################## -import base64 -import tempfile +import time import openerp.tests.common as test_common from openerp import addons @@ -28,14 +27,15 @@ from openerp import addons class TestMoveLineImporter(test_common.SingleTransactionCase): def get_file(self, filename): - """Retrive file from test data""" + """Retrieve file from test data, + encode it as base64 + and adjust it for current year + """ path = addons.get_module_resource('async_move_line_importer', 'tests', 'data', filename) - with open(path) as test_data: - with tempfile.TemporaryFile() as out: - base64.encode(test_data, out) - out.seek(0) - return out.read() + test_data = open(path).read() + test_data = test_data.replace('2014', time.strftime('%Y')) + return test_data.encode("base64") def setUp(self): super(TestMoveLineImporter, self).setUp()