You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
834 B
32 lines
834 B
# coding: utf-8
|
|
# @ 2016 Florian da Costa @ Akretion
|
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
|
import openerp.tests.common as common
|
|
from openerp import api
|
|
from StringIO import StringIO
|
|
|
|
|
|
class ContextualStringIO(StringIO):
|
|
"""
|
|
snippet from http://bit.ly/1HfH6uW (stackoverflow)
|
|
"""
|
|
|
|
def __enter__(self):
|
|
return self
|
|
|
|
def __exit__(self, *args):
|
|
self.close()
|
|
return False
|
|
|
|
|
|
class TestConnection(common.TransactionCase):
|
|
|
|
def setUp(self):
|
|
super(TestConnection, self).setUp()
|
|
self.registry.enter_test_mode()
|
|
self.env = api.Environment(self.registry.test_cr, self.env.uid,
|
|
self.env.context)
|
|
|
|
def tearDown(self):
|
|
self.registry.leave_test_mode()
|
|
super(TestConnection, self).tearDown()
|