Merge "Move few local ODL SFC confs to global functest confs"
[functest.git] / functest / tests / unit / odl / test_odl.py
index d7ce70c..e2778e2 100644 (file)
 import errno
 import logging
 import os
-import StringIO
 import unittest
 
 from keystoneauth1.exceptions import auth_plugins
 import mock
 from robot.errors import DataError, RobotError
-from robot.result import testcase as result_testcase
+from robot.result import model
 from robot.utils.robottime import timestamp_to_secs
+import six
 
 from functest.core import testcase
 from functest.opnfv_tests.sdn.odl import odl
@@ -49,11 +49,9 @@ class ODLVisitorTesting(unittest.TestCase):
                 'elapsedtime': 1000,
                 'text': 'Hello, World!',
                 'critical': True}
-        test = result_testcase.TestCase(name=data['name'],
-                                        status=data['status'],
-                                        message=data['text'],
-                                        starttime=data['starttime'],
-                                        endtime=data['endtime'])
+        test = model.TestCase(
+            name=data['name'], status=data['status'], message=data['text'],
+            starttime=data['starttime'], endtime=data['endtime'])
         test.parent = mock.Mock()
         config = {'name': data['parent'],
                   'criticality.test_is_critical.return_value': data[
@@ -173,7 +171,7 @@ class ODLRobotTesting(ODLTesting):
             os.path.join(odl.ODLTests.odl_test_repo,
                          'csit/variables/Variables.py'), inplace=True)
 
-    @mock.patch('sys.stdout', new_callable=StringIO.StringIO)
+    @mock.patch('sys.stdout', new_callable=six.StringIO)
     def _test_set_vars(self, msg1, msg2, *args):
         line = mock.MagicMock()
         line.__iter__.return_value = [msg1]
@@ -191,7 +189,7 @@ class ODLRobotTesting(ODLTesting):
     def test_set_vars_auth1(self):
         self._test_set_vars("AUTH1 = []", "AUTH1 = []")
 
-    @mock.patch('sys.stdout', new_callable=StringIO.StringIO)
+    @mock.patch('sys.stdout', new_callable=six.StringIO)
     def test_set_vars_auth_foo(self, *args):
         line = mock.MagicMock()
         line.__iter__.return_value = ["AUTH = []"]
@@ -579,7 +577,7 @@ class ODLArgParserTesting(ODLTesting):
                  "--odlip={}".format(self._sdn_controller_ip)]),
             self.defaultargs)
 
-    @mock.patch('sys.stderr', new_callable=StringIO.StringIO)
+    @mock.patch('sys.stderr', new_callable=six.StringIO)
     def test_fail(self, mock_method):
         self.defaultargs['foo'] = 'bar'
         with self.assertRaises(SystemExit):