unit_tests: do not base our tests on neutronclient

The python-neutronclient module that we were getting our base test class
from was intended to serve for tests that emulate command line input and
output and, as such, it took control of stdin and stdout.

It is inconvenient to have stdin and stdout captured because that
prevents the developers from printing or attaching debuggers when
running unit tests.

Change-Id: I729652d0b5bf8a852950535cce36195397165581
Closes-bug: #1626542
Signed-off-by: Antoni Segura Puimedon <antonisp@celebdor.com>
This commit is contained in:
Antoni Segura Puimedon 2016-09-22 14:56:35 +02:00
parent 8b06858053
commit 5214e66f91
No known key found for this signature in database
GPG Key ID: 2329618D2967720A
1 changed files with 10 additions and 3 deletions

View File

@ -10,7 +10,9 @@
# License for the specific language governing permissions and limitations
# under the License.
from neutronclient.tests.unit import test_cli20
from mox3 import mox
from neutronclient.v2_0 import client
from oslotest import base
from kuryr.lib import binding
from kuryr_libnetwork import app
@ -19,7 +21,11 @@ from kuryr_libnetwork import controllers
from kuryr_libnetwork import utils
class TestCase(test_cli20.CLITestV20Base):
TOKEN = 'testtoken'
ENDURL = 'localurl'
class TestCase(base.BaseTestCase):
"""Test case base class for all unit tests."""
def setUp(self):
@ -27,7 +33,7 @@ class TestCase(test_cli20.CLITestV20Base):
app.config['DEBUG'] = True
app.config['TESTING'] = True
self.app = app.test_client()
self.app.neutron = self.client
self.app.neutron = client.Client(token=TOKEN, endpoint_url=ENDURL)
app.tag = True
@ -36,6 +42,7 @@ class TestKuryrBase(TestCase):
def setUp(self):
super(TestKuryrBase, self).setUp()
self.mox = mox.Mox()
controllers.neutron_client()
self.app.neutron.format = 'json'
self.addCleanup(self.mox.VerifyAll)